11
iHackCode
Re: Display new field in newbb

Quote:

robin_hood wrote:
Hello want to add a new field in the user stats in newbb. To be more clear i added a gender field using profile module and i want to display the member gender in newbb under
Joined:
2008/8/27 21:58

Any idea please?

you will have to modify the getInfo method in the user class. of the file.

\modules\newbb\class\user.php
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

12
ghia
Re: Display new field in newbb
  • 2009/5/28 8:04

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Try with
$profile $profile_handler->get($topic_post.poster.uid);

13
zite83
Re: Display new field in newbb
  • 2009/5/28 22:52

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


After playing with this some time, this is what I have come up with. You do need to alter / modify the user.php class file.
STEP 1 locate getInfo in user.php file
function getInfo()
    {
        global 
$xoopsModuleConfig$myts;
        
$userinfo=array();
        
$user =& $this->user;


STEP 2 add these two lines of code to line 229
$profile_handler xoops_getmodulehandler('profile''profile');
$profile $profile_handler->get($user->getVar("uid"));


so it ends up looking like this
function getInfo()
    {
        global 
$xoopsModuleConfig$myts;
        
$userinfo=array();
        
$user =& $this->user;
        
$profile_handler xoops_getmodulehandler('profile''profile');
        
$profile $profile_handler->get($user->getVar("uid"));


STEP 3 Which should be line 242 add this line of code
$userinfo["myfield"] = $profile->getVar('myfield');


STEP 4

in newbb_thread.html under the modules templates add this anywhere you want myfield to be displayed

<{$topic_post.poster.myfield}>


All you now have to do is repeat steps 3 and 4 and that should do what you want. Also remember to update your template files after you make the changes. I hope this helps, I don't really know how to program all that well, but playing with what I have read in this topic this is what I have come up with Tested it with XOOPS 2.3 and cbb 3.08


14
robin_hood
Re: Display new field in newbb
  • 2009/5/30 22:45

  • robin_hood

  • Just popping in

  • Posts: 51

  • Since: 2008/12/6


Works!!! Thank you all

15
pablo103
Re: Display new field in newbb
  • 2009/5/31 2:38

  • pablo103

  • Not too shy to talk

  • Posts: 181

  • Since: 2008/2/3 1


Superb!

16
etcetera
Re: Display new field in newbb
  • 2009/7/1 13:47

  • etcetera

  • Just popping in

  • Posts: 23

  • Since: 2009/6/13


This is excellent! Thank you very much, zite83.


Question: would anyone mind taking this idea and applying it for use on /modules/profile/userinfo.php ?

I ask because I know absolutely no PHP, and am entirely incapable of doing it myself. lol I would like the same outcome - I'd like to be able to call each variable individually, so that I can embed it in my own html.

17
etcetera
Re: Display new field in newbb
  • 2009/7/6 10:50

  • etcetera

  • Just popping in

  • Posts: 23

  • Since: 2009/6/13


bump?

Login

Who's Online

145 user(s) are online (103 user(s) are browsing Support Forums)


Members: 0


Guests: 145


more...

Donat-O-Meter

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

Latest GitHub Commits