Topic: Trying to display first and last name

i'm trying to display first and last name under the id  when the post is shown.  so i guess probably between the id and the display name(or rank)

i searched around but couldn't find any tips about doing this.  help please~~

Re: Trying to display first and last name

Do you mean the username by id?

FluxBB - v1.4.8

Re: Trying to display first and last name

u know right now you see

"Scriptmx"
"New member"
"Registered: 2007-06-29"
"Posts: 4"

like that  but i want to show  first and last name also

"Scriptmx"
"John Thomas"
"New Member"
"Registered: 2007-06-29"
"Posts: 4"

can someone help me

4 (edited by lie2815 2007-07-05 08:23)

Re: Trying to display first and last name

First, find:

$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' AND p.deleted=0 ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

Replace with:

$result = $db->query('SELECT u.email, u.title, u.real_name, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' AND p.deleted=0 ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

And then, find:

<dd class="usertitle"><strong><?php echo $user_title ?></strong></dd>

And add before:

<dd class="usertitle"><strong><?php echo $cur_post['real_name'] ?></strong></dd>

That should do it.

EDIT: All that in viewtopic.php, of course.

FluxBB - v1.4.8

Re: Trying to display first and last name

Thank you so much but i've gotten a error says cannot fetch  so i looked up the code and  instead of  'real_name'  the field in mysql as 'realname'  so i've changed the code and also the last part was different so i've changed the code to this

$result = $db->query('SELECT u.email, u.title, u.realname, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

hope someone looking for this kind of info would get some help.

anyways i really appreciate your help, lie2815.  thanks!