Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
7 - 2 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
   

Re: data from custom user fields on forums
by trabis on 2009/5/15 12:44:05

OK, I did not look into cbb because I do not have it installed, but here is one example on how to do it for system/templates/blocks/system_block_topusers.html

Here goes the entire template:
le="color: #000000"><?php <table cellspacing="1" class="outer"> <{foreach item=user from=$block.users}> <tr class="<{cycle values="even,odd"}>" valign="middle"> <td><{$user.rank}></td> <td align="center"> <{if $user.avatar != ""}> <img src="<{$user.avatar}>" alt="" width="32" /><br /> <{/if}> <a href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>" title="<{$user.name}>"><{$user.name}></a> <br /> <{php}> global $xoopsTpl; $myField = ''; $profile_handler =& xoops_getmodulehandler('profile', 'profile'); $profile = $profile_handler->get($xoopsTpl->_tpl_vars['user']['id']); if (is_object($profile)) { $myField = $profile->getVar('myfield'); } $xoopsTpl->assign('myField', $myField); <{/php}> <{$myField}> </td> <td align="center"><{$user.posts}></td> </tr> <{/foreach}> </table>


I think we can change this to get all profile variables instead on doing it one by one, maybe by using getVars and append instead of assign.
Ideally, we could hack core to provide profile info instead of user info for $xoopsUser, this way we would not need to call profile handler and do this tricks.
Re: data from custom user fields on forums
by mboyden on 2009/5/15 12:27:28

THAT is a totally different issue, and is unlikely available in the templates. You really need to write out some specific requirements. It sounds now like you want to pull multiple profiles, not just the profile of the current user.

The current user is relatively easy based on the previous code posted. All users from the system is yet another functional requirement and likely would be tough to do in the templates, if at all. Likely you would have to hack the module to make that part of the signature info passed into the templates and then modify the templates to display it.

If this is a super-private idea, then it's time to hire a programmer, otherwise you should share as many functional details as possible or this thread's going to hit 100 posts.
Re: data from custom user fields on forums
by 3lr0n on 2009/5/15 5:55:38

Hi Trabis,

but this code show the field of the lgged user isnt it?

I need to show some user fields to everybody of every user in the posts.. I mean like the field from in the left column of the forums, Behind the avatar there is the location, that is show to all visitors.. thats what i need but with some custom fields

thks
Re: data from custom user fields on forums
by pablo103 on 2009/5/14 22:37:14

Where shoud I put this code in order to diplay custom profile fields in newbb (CBB 3.08) module?
Re: data from custom user fields on forums
by trabis on 2009/5/14 21:38:02

This works for me:
le="color: #000000"><?php <{php}> global $xoopsTpl, $xoopsUser; $myField = ''; if (is_object($xoopsUser)) { $profile_handler = xoops_getmodulehandler('profile', 'profile'); $profile = $profile_handler->get($xoopsUser->getVar('uid')); $myField = $profile->getVar('myfield'); } $xoopsTpl->assign('myField', $myField); <{/php}> <{$myField}>

Who's Online

1196 user(s) are online (328 user(s) are browsing Support Forums)


Members: 0


Guests: 1196


more...

Donat-O-Meter

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

Latest GitHub Commits