# 50 Improvement Add option to display "RealName"
From Another Web Company
Viewed 752 times, With a total of 7 Posts
| Have a suggestion, improvement, change or non-beta Forum Entension bug ? Please add them to the todo list
|
|
|
|
|
| 6:00:25 PM - Saturday 18th, April 2009 |
|
This is an untested comment, but i would think if you use $user->getRealName(); during the displaying of a thread/posts it will display the current viewing members name, not the posting members name.
If i create a post and you view the post it might read as:
User: "AWC (Eric)"
Displaying a members Nickname or real name has been suggested and thought about, but there has been "complications" which is why it has never been implemented.
Like anything with this forum extension, no idea or suggestion will every be completely dismissed, being its in the ToDo tracker it will always be there for later thought 
_
|
|
~ What was once an opinion, became a fact, to be later proven wrong ~
|
|
|
|
Clicked A Few Times
Wiki Edits: 4
Threads 28
Posts 158
|
|
| 9:01:57 AM - Monday 20th, April 2009 |
|
| (static) "User::newFromID" creates a user object record for THAT userID only. It's not the same as "global $wgUser".
|
|
|
|
|
|
|
| 12:55:38 PM - Monday 20th, April 2009 |
|
Gotch-ya
When i get back to coding here, ill try and work in another HOOK for you so access to the display info will be available and then you can do what ever you want with it.
_
|
|
|
|
|
|
|
| 12:37:27 AM - Saturday 23rd, May 2009 |
|
Just coded this in for you...
http://wiki.anotherwebcom.com/Forum_Hook_/_awcsforum_post_render_display
You will be able to grab all data which is displayed in a post before it is passed to the skin function so you can do what you want with it. Along with that data, the posters UserName and ID is passed seperate so you can do your thing 
Upload not ready yet, should be uploaded in the next few days, will post in the Beta thread when its ready.
Other changes which will be in 2.5.6
http://wiki.anotherwebcom.com/Current_Forum_Beta_Release#New_changes
_
|
|
|
|
|
|
Clicked A Few Times
Wiki Edits: 4
Threads 28
Posts 158
|
|
| 9:51:10 AM - Tuesday 26th, May 2009 |
|
How would I get the "realname" to populate instead of the username? Would I use the hook to replace the username with the realname like this:
function fnMyHook( &$info_to_tplt, $mem_name_n_id ){
$user = User::newFromID( $mem_name_n_id['id'] );
$info_to_tplt['user_name'] = $user->getRealName();
}
|
|
|
|
|
|
|
| 8:09:22 PM - Tuesday 26th, May 2009 |
|
Your gonna have to do a "tricky" find and replace...
Search the URL for the hyper link "display word" (which would the the users name) and replace that with the nick name or what ever.... dont do a full find and replace on the whole URL cause the urser name needs to be in the href attribute, you just want ot change the display name.
This is off the top of my head and untested so there probly sytenx errors.
function fnMyHook( &$info_to_tplt, $mem_name_n_id ){
$user = User::newFromID( $mem_name_n_id['id'] );
$userRealName = $user->getRealName()
$info_to_tplt['user_name'] = str_replace('">' . $mem_name_n_id['name'] . '</a>', $userRealName, $info_to_tplt['user_name']);
}
_
|
|
|
|
|
|
Clicked A Few Times
Wiki Edits: 3
Threads 11
Posts 15
|
|
| 1:31:31 PM - Sunday 26th, July 2009 |
|
Just for the record: How to link the user name to the real user profile:
Manually created links:
$wgHooks['awcsforum_post_render_display'][] = 'getUserNameForForum';
function getUserNameForForum( &$info_to_tplt, $mem_name_n_id ){
global $wgUser;
$user = User::newFromID( $mem_name_n_id['id'] );
$info_to_tplt['user_name'] = $wgUser->getName();
return true;
}
In skin templates (which already use $info[user_name]):
<a href="...yourwiki/User:$info[user_name]">$info[user_name]</a>
Don't use the memprofile and globally link to the real user profile (where ever $info[user_name] is used):
$wgHooks['awcsforum_post_render_display'][] = 'getUserNameForForum';
function getUserNameForForum( &$info_to_tplt, $mem_name_n_id ){
global $wgUser;
$user = User::newFromID( $mem_name_n_id['id'] );
$info_to_tplt['user_name'] = $wgUser->getSkin()->userLink( $user->getId(), $user->getName() );
return true;
}
Since that removes the hover menu on forum post user names, you can safely remove the mem$info[mem_drop_num] div from the "post_table" skin template. Use e.g. $info[user_name] ($info[m_pm]) to create a PM link next to the user name.
|
|
Edited On 3:07:50 PM - Sunday 26th, July 2009 by Subfader
|
|
|
AWC's:
2.5.8 MediaWiki - Stand Alone Forum Extension Forum theme style by: AWC
|