PDA

View Full Version : Using custom fields on member.php


Scanu
09-09-2012, 06:41 PM
Hi to everyone, i'm trying to use custom fields variables in member.php, what hook can i use? And what should be the name of each variable?

I mean in postbit you can use $post['fieldx']
To show the field of the user that is viewing you can use $vbulletin->userinfo['fieldx']
What can i use to show the custom field of the user that i'm viewing on member.php?

--------------- Added 1347303571 at 1347303571 ---------------

No one?

Scanu
09-11-2012, 04:28 PM
Bump :o

qpurser
09-12-2012, 08:10 AM
I didn't use a hook but edited the template directly. Don't know if that is any help for you.
Bare with me as I am not a Pro in coding but here is some code I used to show 2 custom fields in the "About Me" tab under "statistics".
I had to edit the "memberinfo_block_statistics" template and used this code:


<h5 class="subblocksubhead subsubsectionhead">Last 2 Meetings attended:</h5>
<dl class="blockrow stats">
<dt>Meeting 1</dt> <dd>{vb:raw userinfo.field16}</dd>
</dl>
<dl class="blockrow stats">
<dt>Meeting 2</dt> <dd>{vb:raw userinfo.field19}</dd>
</dl>

Look at the attachment to see the result.

Scanu
09-12-2012, 08:54 AM
Thanks very much for your reply qpurser :), actually i'm not sure if this can can really help me since i need to see my code (in another computer), just a little question, doesn't {vb:raw userinfo.fielex} supposed to show the field of the user that is viewing the page instead of the field of the user's profile that you're viewing?, are you sure it works? Thank you again

qpurser
09-12-2012, 09:31 AM
just a little question, doesn't {vb:raw userinfo.fielex} supposed to show the field of the user that is viewing the page instead of the field of the user's profile that you're viewing?, are you sure it works? Thank you again

I am confused about this question. :)
Not sure if I understood you well but let me explain what I did to verify:

Info from the adminCP:
Test User: Meeting 1 = 2012-09-02 and Meeting 2 = 2011-07-01
Test Member: Meeting 1 = 06-18-2012 and Meeting 2 = 05-19-2010

When I am logged in as "test user":
Looking at my own profile the info from those 2 fields is 2012-09-02 and 2011-07-01
Looking at the profile from Test Member the info is 06-18-2012 and 05-19-2010
Looking at the profile from another user who had nothing in those fields nothing shows up in his profile.

Hope that was the info you were looking for

Scanu
09-12-2012, 09:42 AM
Yes that was, thank you i wi'l try if i can comes up with something using $vbulletin->userinfo['fieldx'] (equivalent of {vb:raw bbuserinfo.fieldx}) as soon as i can

--------------- Added 1347495350 at 1347495350 ---------------

Good news! I figure this out! Thanks anyway for your help i don't know why but it motivates me

Hook: userprofile_create
Variable: $this->userinfo['fieldX'] (and $this->registry->options['ur_option'] to use an option)