Advanced search  

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

Pages: [1]   Go Down

Author Topic: Show full name instead of username  (Read 2487 times)

0 Members and 1 Guest are viewing this topic.

FrancWest

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Show full name instead of username
« 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.
Logged

thomasFRU

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 14
    • www.uledoc.de
Re: Show full name instead of username
« Reply #1 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
Logged

pospec4444

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Show full name instead of username
« Reply #2 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.]

Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.