1
robin_hood
Display new field in newbb
  • 2009/5/24 10:21

  • robin_hood

  • Just popping in

  • Posts: 51

  • Since: 2008/12/6


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?

2
deka87
Re: Display new field in newbb
  • 2009/5/24 19:37

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


just try to copy everything they did to the other fields
Mind anchors

3
ghia
Re: Display new field in newbb
  • 2009/5/26 14:50

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Check this.

4
robin_hood
Re: Display new field in newbb
  • 2009/5/27 9:40

  • robin_hood

  • Just popping in

  • Posts: 51

  • Since: 2008/12/6


I appreciate your replies, Ghia i read that thread and found this code
<{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}>



but i don't know where to put it.

In newbb_thread.html there is
<tr>
      <
td width="20%" class="odd" rowspan="2" valign="top">
      <{if 
$topic_post.poster.uid != 0}>
      <
div class="comUserRankText"><{$topic_post.poster.rank.title}><br /><{$topic_post.poster.rank.image}></div>
      <{if 
$topic_post.poster.avatar}>
      <
img class="comUserImg" src="<{$xoops_upload_url}>/<{$topic_post.poster.avatar}>" alt="" />
      <{/if}>
      <
div class="comUserStat"><span class="comUserStatCaption"><{$smarty.const._MD_JOINED}>:</span><br /><{$topic_post.poster.regdate}></div>

      <{if 
$topic_post.poster.from}>
      <
div class="comUserStat"><span class="comUserStatCaption"><{$smarty.const._MD_FROM}></span> <{$topic_post.poster.from}></div>
      <{/if}>
    <{if 
$topic_post.poster.groups}>
      <
div class="comUserStat"> <span class="comUserStatCaption"><{$smarty.const._MD_GROUP}></span>
      <{foreach 
item=group from=$topic_post.poster.groups}> <br /><{$group}><{/foreach}>
      </
div>
    <{/if}>


I guess that the first code should go somewhere here, is that right?

I am not a coder can you help me please?

5
ghia
Re: Display new field in newbb
  • 2009/5/27 15:34

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


The whole block goes before:
<{if $topic_post.poster.from}>

You have to substitute myfield in the getVar
$myField $profile->getVar('myfield');

to gender or whatever the name is you have:
$myField $profile->getVar('gender');

If more fields are needed, duplicate
...
      
$myField1 '';
      
$myField2 '';
...
        
$myField1 $profile->getVar('gender');
        
$myField2 $profile->getVar('hobby');
      }
      
$xoopsTpl->assign('myField1'$myField1);
      
$xoopsTpl->assign('myField2'$myField2);
<{/
php}>
<{
$myField1}>
<{
$myField2}>

6
robin_hood
Re: Display new field in newbb
  • 2009/5/27 21:10

  • robin_hood

  • Just popping in

  • Posts: 51

  • Since: 2008/12/6


thank you Ghia this works but the field is seen only if i am logged. if iam not logged i can't see this field, any fix please?

7
ghia
Re: Display new field in newbb
  • 2009/5/27 21:22

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Have anonymous users access to the profile module?

8
robin_hood
Re: Display new field in newbb
  • 2009/5/27 21:26

  • robin_hood

  • Just popping in

  • Posts: 51

  • Since: 2008/12/6


in profile module permissions i set visibility correctly though.

9
ghia
Re: Display new field in newbb
  • 2009/5/27 21:45

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


No, it is in groups permissions (module access, module and system admin) for all the modules.

10
robin_hood
Re: Display new field in newbb
  • 2009/5/27 21:48

  • robin_hood

  • Just popping in

  • Posts: 51

  • Since: 2008/12/6


Another notice, that code shows the gendre of the user who is connected himself (me) and not the gendre of the real poster(Bob) .

I created two test accounts, one i set my gendre as female and one as a male then i checked the forums (Bob's topic) and see that Bob gendre is Female if i am logged as a female account, and changed to Male if i am logged with the male account.



this is because of this code
profile $profile_handler->get($xoopsUser->getVar('uid'));



something needs to be changed here

Login

Who's Online

180 user(s) are online (130 user(s) are browsing Support Forums)


Members: 0


Guests: 180


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