ArcadeDownloadsNewslettersForum Menu
ForumSearchToday's Posts
NavigationWhat AWC Offers
MediaWiki Forum ExtensionProgramsMediaWiki ExtensionsIPB ScriptsFireFox StuffLinks
Wiki Tools
Upload file Special pagesEditHistoryRecent Changes
Login or Create Account

Log in

You must have cookies enabled to log in to Main Site - Local.

 
Log in / create account

# 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

Gets Around
Wiki Edits: 2757
Threads 117
Posts 1214
Quote:kenyu73
http://wiki.anotherwebcom.com/index.php5?title=Forum_todo_list&bt_action=view&bt_i...
I've modifed the code for my purposes by adding the following to post_phase.php.

$user = User::newFromID($this->p_userID); $p_realname = $user->getRealName();

Maybe an option to have something like this... "kenyu73 (Eric)"

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
(static) "User::newFromID" creates a user object record for THAT userID only. It's not the same as "global $wgUser".

Gets Around
Wiki Edits: 2757
Threads 117
Posts 1214
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.

_

Gets Around
Wiki Edits: 2757
Threads 117
Posts 1214
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

_

Gets Around
Wiki Edits: 2757
Threads 117
Posts 1214
download ready in the beta thread

Clicked A Few Times
Wiki Edits: 4
Threads 28
Posts 158
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();
}

Gets Around
Wiki Edits: 2757
Threads 117
Posts 1214
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
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


Forum Image:Icon-double-arrow.gif AWC's Corner Image:Icon-double-arrow.gif AWC's MediaWiki Forum Extension



Whos here now: Members 0 Guests 0 Bots/Crawlers: 1


AWC's: 2.5.8 MediaWiki - Stand Alone Forum Extension
Forum theme style by: AWC