Welcome Username Welcome Username
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Welcome Username

Started by gateway_46806, February 06, 2013, 06:12:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gateway_46806

How would I go about modifying the 'Welcome Username' to Welcome First Name/Nickname/Other Name in CPG15x which was possible in earlier versions of the Coppermine Gallery. Thanks in advance for any assistance.

Αndré

Please post a link to the old mod, so we don't have to re-invent it from scratch. Basically you have to edit the line
cpgRedirectPage($redirect, $lang_login_php['login'], sprintf($lang_login_php['welcome'], $USER_DATA['user_name']).$pending_approvals, 3, 'success');
in login.php.

gateway_46806

Since I don't have a hosted site, I have attached a copy of cpg1.2.0_final
with the example of using first_name instead of user_name in the login and logout.

Αndré

Unfortunately that doesn't help much. What exactly should be displayed as welcome message?

gateway_46806

At different times, I will require something other than the user_name for the welcome and the parting statements.

phill104

You need to be as detailed as you can. We need exact details if we are to come up with come code for you. Al link to the modification on this site would also help. If you cannot provide that then maybe hire a freelancer to code it for you.
It is a mistake to think you can solve any major problems just with potatoes.

gateway_46806

#6
Andre suggested, "edit the line 'cpgRedirectPage($redirect, $lang_login_php['login'], sprintf($lang_login_php['welcome'], $USER_DATA['user_name']).$pending_approvals, 3, 'success');". I have tried adding a field in cpg15x_users of first_name and calling $USER_DATA['first_name'] in the login and calling stripslashes(FIRST_NAME) in the logout, cpgRedirectPage('index.php', $lang_logout_php['logout'], sprintf($lang_logout_php['bye'], stripslashes(USER_NAME)), 3);. Calling 'first_name' or 'FIRST_NAME' doesn't produce anything.

To my knowledge, there isn't a link to the modification for cpg15x. Since I don't have a hosted site to provide a hyperlink, I have attached a copy of cpg1.2.0_final
with the example of using first_name instead of user_name in the login and logout. Something in addition to Andre's suggestion needs to be implemented for cpg15x.

Αndré

Open login.php, find
        cpgRedirectPage($redirect, $lang_login_php['login'], sprintf($lang_login_php['welcome'], $USER_DATA['user_name']).$pending_approvals, 3, 'success');
and replace with
        $first_name = mysql_result(cpg_db_query("SELECT first_name FROM {$CONFIG['TABLE_USERS']} WHERE user_id = ".USER_ID." LIMIT 1"), 0);
        cpgRedirectPage($redirect, $lang_login_php['login'], sprintf($lang_login_php['welcome'], $first_name).$pending_approvals, 3, 'success');

phill104

Quote from: gateway_46806 on February 10, 2013, 06:14:35 PM


To my knowledge, there isn't a link to the modification for cpg15x. Since I don't have a hosted site to provide a hyperlink, I have attached a copy of cpg1.2.0_final
with the example of using first_name instead of user_name in the login and logout.

I was hoping you had a link to an earlier version, for 1.2, 1.3 or 1.4

If Andre's suggestion doesn't do what you want then maybe see if you can find the original mod.
It is a mistake to think you can solve any major problems just with potatoes.