Show full name instead of username Show full name instead of username
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Show full name instead of username

Started by FrancWest, June 29, 2008, 07:02:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

FrancWest

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.

thomasFRU

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

pospec4444

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.]