1
WarDick
Edit Posters Name in News Stories
  • 2003/11/13 15:56

  • WarDick

  • Just can't stay away

  • Posts: 890

  • Since: 2003/9/13


Can you edit the posters name in News Stories?

2
WarDick
Re: Edit Posters Name in News Stories
  • 2003/11/13 22:49

  • WarDick

  • Just can't stay away

  • Posts: 890

  • Since: 2003/9/13


What I really want to do is display real name instead of nickname.

3
mrgym
Re: Edit Posters Name in News Stories
  • 2003/11/16 19:39

  • mrgym

  • Just popping in

  • Posts: 28

  • Since: 2002/4/26


Well, if you are SURE that using the real name isn't a privacy issue, then I can supply a quick bit of code.

I don't see an easy way to display the name rather than the uname. The newstory class is based on xoopsstory (in the class directory) which gets the uname from kernel/user.php.

If you would like to display the user's name, insert these two bits:

1. news/index.php line 78;
$story['poster'] = $sarray[$i]->getName($sarray[$i]->uid);

2. news/class/class.newsstory.php paste in this new function;
function getName($uid){
$db =& Database::getInstance();
$sql = "select name from {$db->prefix}_users where uid=$uid";
$result = $db->query($sql);
list($name) = $db->fetchRow($result);
return($name);
}

Of course, you will probably need to insert the call to getName in article.php. Look for the same substitution - uname will be replaced by getName. I will leave this for you as a XOOPS hacking adventure.

Login

Who's Online

248 user(s) are online (146 user(s) are browsing Support Forums)


Members: 0


Guests: 248


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits