coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: gateway_46806 on February 06, 2013, 06:12:33 AM

Title: Welcome Username
Post by: gateway_46806 on February 06, 2013, 06:12:33 AM
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.
Title: Re: Welcome Username
Post by: Αndré on February 06, 2013, 09:50:51 AM
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.
Title: Re: Welcome Username
Post by: gateway_46806 on February 08, 2013, 04:37:14 AM
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.
Title: Re: Welcome Username
Post by: Αndré on February 08, 2013, 09:27:50 AM
Unfortunately that doesn't help much. What exactly should be displayed as welcome message?
Title: Re: Welcome Username
Post by: gateway_46806 on February 10, 2013, 04:29:01 AM
At different times, I will require something other than the user_name for the welcome and the parting statements.
Title: Re: Welcome Username
Post by: phill104 on February 10, 2013, 05:25:27 PM
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.
Title: Re: Welcome Username
Post by: gateway_46806 on February 10, 2013, 06:14:35 PM
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.
Title: Re: Welcome Username
Post by: Αndré on February 10, 2013, 07:35:19 PM
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');
Title: Re: Welcome Username
Post by: phill104 on February 10, 2013, 08:40:32 PM
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.