Welcome to Geeklog, Anonymous Sunday, May 17 2026 @ 02:50 pm EDT

Geeklog Forums

Real name instead of nickname


Status: offline

roberto

Forum User
Chatty
Registered: 12/01/03
Posts: 43
I have replaced the nickname with the real name in the title it of
articles, but it is possible to replace the nickname with the real name
also in the welcome message and in "Who's Online" box and "What's Related" information?

Tnx
Rob
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
welcome_msg:
In lib-common.php, change

Text Formatted Code
if( !empty( $_USER['username'] ))
{
    $msg .= ', ' . $_USER['username'];
}

 


to

Text Formatted Code
if( !empty( $_USER['fullname'] ))
{
    $msg .= ', ' . $_USER['fullname'];
}
else if( !empty( $_USER['username'] ))
{
    $msg .= ', ' . $_USER['username'];
}

 
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
Who's online (put this in lib-custom and make a new block using it):

Text Formatted Code
function phpblock_whosonline_fullname()
{
    global $_CONF,$_TABLES,$LANG01;

    $expire_time = time() - $_CONF['whosonline_threshold'];

    $result = DB_query( "SELECT DISTINCT {$_TABLES['sessions']}.uid, username,photo,showonline,fullname FROM {$_TABLES['sessions']},{$_TABLES['users']},{$_TABLES['userprefs']} WHERE {$_TABLES['users']}.uid = {$_TABLES['sessions']}.uid AND {$_TABLES['users']}.uid = {$_TABLES['userprefs']}.uid AND start_time >= $expire_time AND {$_TABLES['sessions']}.uid <> 1 ORDER BY username" );
    $nrows = DB_numRows( $result );

    $num_anon = 0;

    for( $i = 1; $i <= $nrows; $i++ )
    {
        $A = DB_fetchArray( $result );

        if( $A['showonline'] == 1 ) {

            $retval .= '<a href="' . $_CONF['site_url']
                    . '/users.php?mode=profile&uid=' . $A['uid'] . '">';
            if (!empty($A['fullname']))
            {
                $retval .= $A['fullname'];
            }
            else
            {
                $retval .= $A['username'];
            }
            $retval .= '</a>';

            if( !empty( $A['photo'] ) AND $_CONF['allow_user_photo'] == 1)
            {
                $retval .= ' <a href="' . $_CONF['site_url']
                        . '/users.php?mode=profile&uid=' . $A['uid']
                        . '"><img src="' . $_CONF['layout_url']
                        . '/images/smallcamera.gif" border="0" alt=""></a>';
            }
            $retval .= '<br>';

        } else {
            // this user does not want to show up in Who's Online
            $num_anon++; // count as anonymous
        }
    }

    $result = DB_query( "SELECT DISTINCT uid,remote_ip FROM {$_TABLES['sessions']} WHERE uid = 1" );
    $num_anon += DB_numRows( $result );

    if( $num_anon > 0 )
    {
        $retval .= $LANG01[41] . ': ' . $num_anon . '<br>';
    }

    return $retval;
}

 
 Quote

Status: offline

roberto

Forum User
Chatty
Registered: 12/01/03
Posts: 43
Hi Turias,

tnx for help!

no problem with the firs code, but with second code display the error "the php function not exist" in the box of block.

I have followed these steps:

1 - copy your code
2 - edit system/lib-custom.php
3 - paste your code at end of file, before ?>
4 - create new php block

the name of function in lib-custom (with "()") and the name in the block admin (without "()") is equal

Where mistake?

tnx and sorry for my english

rob
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
Hmmm. I didn't actually test it (and don't have time right now). What is the exact error you got? And are you sure you set the block to a "phpblock" with function "phpblock_whosonline_fullname"?
 Quote

Status: offline

roberto

Forum User
Chatty
Registered: 12/01/03
Posts: 43
Hi Turias
Quote by Turias: Hmmm. I didn't actually test it (and don't have time right now). What is the exact error you got?

This error, in the block box: " Error in PHP Block. Function, phpblock_wosonline_fullname, does not exist."
And are you sure you set the block to a "phpblock" with function "phpblock_whosonline_fullname"?

yes

Tnx, rob
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by Turias: phpblock_whosonline_fullname

Quote by roberto: phpblock_wosonline_fullname

Hmm ...

bye, Dirk
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
Watch out for that "H" key... it's a doozy.
 Quote

Status: offline

roberto

Forum User
Chatty
Registered: 12/01/03
Posts: 43
Quote by Turias: Watch out for that "H" key... it's a doozy.

Naaaa... error for fast writing, in the forum :-)
I have controlled, in the document and in the admin block is write
correctly, and equal

rob
 Quote

Status: offline

roberto

Forum User
Chatty
Registered: 12/01/03
Posts: 43
Quote by Turias: Watch out for that "H" key... it's a doozy.

Naaaa... error for fast writing, in the forum :-)
I have controlled, in the document and in the admin block is write
correctly, and equal

rob
 Quote

Status: offline

Shane

Forum User
Newbie
Registered: 09/11/03
Posts: 2
There is simple syntax error in the code. Replace:

if (!empty($A['fullname'])

with

if ( !empty( $A['fullname'] ) )

and you'll be good to go!
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
Heh, thanks for catching that. I knew I should have at least checked it before posting it. Smile

I've fixed the version above.
 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 01/12/03
Posts: 445
would it be possible to change the "phpblock_5latest" to show the realnames?
(and/or the visitor stats block?)

geKow
 Quote

All times are EDT. The time is now 02:50 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content