1
3lr0n
data from custom user fields on forums
  • 2009/3/29 11:44

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


Hi,

I dont know if there is a simple way to retrieve data from custom user fields created with user module on XOOPS 2.3.3 and use those on the forum.

I mean, i ve created 1 user field that shows the processor of the pc the user have (the user have to fill it of course as is a text field), i want this data to be show on the forums below the user information, the forum is cbb 3.08.

As Im not a programmer can someone help me on a way to do this?

thks in advance.

Spanish Overclocking Community xoops based site : http://www.overclocking.es

2
trabis
Re: data from custom user fields on forums
  • 2009/3/29 12:04

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


I believe it should be something like this:
$profile_handler xoops_getmodulehandler('profile''profile');
$profile $profile_handler->get($xoopsUser->getVar('uid'));
$processor $profile->getVar('processor');


3
3lr0n
Re: data from custom user fields on forums
  • 2009/4/5 21:11

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


I need to check if the field has data. If it has, i show the processor (the data from the textfield) and if it dont i will show a link to inform the benefits of filled the fields.

So i think is better to add a custom fuction to the code and the assig the result to a smarty variable to show it in the templates files?

What do you think trabis? would be a simple (for you of course) function to write? or its more complicated than i can guess?

ta in advance and sry for my english.
Spanish Overclocking Community xoops based site : http://www.overclocking.es

4
3lr0n
Re: data from custom user fields on forums
  • 2009/4/14 21:49

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


bump!
Spanish Overclocking Community xoops based site : http://www.overclocking.es

5
ghia
Re: data from custom user fields on forums
  • 2009/4/15 8:18

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You can blend in some php code in the templates between the <{php}> and <{/php}> tags.
Check if the $xoopsUser object exists. If not, echo the link. If it does look up the fields and echo them as Trabis pointed out.

6
pablo103
Re: data from custom user fields on forums
  • 2009/4/15 10:52

  • pablo103

  • Not too shy to talk

  • Posts: 181

  • Since: 2008/2/3 1


very useful, did anyone test it? does it work?

7
ghia
Re: data from custom user fields on forums
  • 2009/4/15 12:08

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


See this!

8
3lr0n
Re: data from custom user fields on forums
  • 2009/4/27 21:44

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


I tried putting inside php tags the code in the newbb_thread.html template, but i ve got an non object error.

Would be better to put this fucntion inside the /include/functions.php or viewtopic.php?,

and how to set this to a smarty variable?

any help will be aprreciated :d

thks
Spanish Overclocking Community xoops based site : http://www.overclocking.es

9
3lr0n
Re: data from custom user fields on forums
  • 2009/4/28 15:27

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


bump!
Spanish Overclocking Community xoops based site : http://www.overclocking.es

10
ghia
Re: data from custom user fields on forums
  • 2009/4/28 23:25

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


What did the error message say exactly?

Login

Who's Online

333 user(s) are online (291 user(s) are browsing Support Forums)


Members: 0


Guests: 333


more...

Donat-O-Meter

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

Latest GitHub Commits