coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: FrancWest on June 29, 2008, 07:02:11 PM

Title: Show full name instead of username
Post by: FrancWest on June 29, 2008, 07:02:11 PM
Hi,

is it possible to display the full name instead of the login name on the login, logout screen and also the menu link 'logout (<username>)'. And if so, which files do I need to adjust ? I've tried replacing <user_name> with <user_profile1> in the login.php page, but it seems that at that point user_profile1 is not filled yet.

Regards,
Franc.
Title: Re: Show full name instead of username
Post by: thomasFRU on November 23, 2008, 02:28:42 PM
You have first have to get the users full name with:

$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_USERS']} WHERE user_name='{$USER_DATA['user_name']}'");
   while ($row = mysql_fetch_assoc($result)) {
      $user_fullname = $row['user_profile1'];

and then change

msg_box($lang_login_php['login'], sprintf($lang_login_php['welcome'], $USER_DATA['user_name']), $lang_continue, $referer);

to

msg_box($lang_login_php['login'], sprintf($lang_login_php['welcome'], $user_fullname), $lang_continue, $referer);

Thomas
Title: Re: Show full name instead of username
Post by: pospec4444 on August 06, 2009, 10:47:35 AM
Isn't there more elegant way to show user_profile1 instead of user_name in whole gallery?

I've search through the code and there are two functions in functions.inc.php: get_username and get_user_name. The get_username calls get_user_name but I can't find it's definition. The get_user_name is defined in UDB class, however it isn't the function which is called from get_username (IMHO).

I also tried to find a plugin which would help me, but it seems that there isn't such one.

I don't think that it is a good idea to re-write php code just for achieving such a small change, but I don't see other way.

Thank you for your suggestions!

[Reason for showing user_profile1 instead of user_name: author name can contain special characters (e.g. Žluťoučký kůň) and I don't want such a weird user_name.]