31
3lr0n
Re: data from custom user fields on forums
  • 2009/5/15 5:55

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


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
Spanish Overclocking Community xoops based site : www.overclocking.es

32
mboyden
Re: data from custom user fields on forums
  • 2009/5/15 12:27

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


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.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

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

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


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:
<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.

Login

Who's Online

194 user(s) are online (147 user(s) are browsing Support Forums)


Members: 0


Guests: 194


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