View Full Version : Pulling info from a profile field
bashy
06-21-2006, 06:20 PM
Hi peeps
I have just created a new profile field and now i would like to pull the information from the said field.....
I would like to add this information into a new page (Logican's web template)
Please can someone advise as to how to do this....
I have tried this
<if condition="$post['field24']"><div>$vbphrase[referral]: $post[field24]</div></if>
Didnt work, i got a parse error
Again i tried this and got another parse error :(
<if condition="$post[field24] != ''"><div class="smallfont">
I have copied these from other hacks that pull infor from profile fields and trying them :)
Also is there away that the profile field information can show which member it pulled the info from please?
Something like this
Bashy-----------------[field24]
member---------------[field24]
nother member--------[field24]
get the idea?
noppid
06-21-2006, 06:50 PM
You nailed it both times. There must be errant characters in your template.
The var is going to contain the custom field info from the posting member.
bashy
06-21-2006, 06:52 PM
Well actually i tried them both in the postbit and thats where i got the errors for the code.....
noppid
06-21-2006, 06:54 PM
We can be sure of one thing here, what you showed us will work.
However, I think your problem is in code in the template we here can't see. Perhaps you are causing a nesting problem?
bashy
06-21-2006, 07:04 PM
Ok lets try a differant way...
Can it be used in a html page or does it have to be a full php page?
Ok...this is what i have, nothing shows apart from
How did you find us :
Heres my code
<table width='100%'><tr>
<td class="panelsurround" align="center" >
<div class="panel">
<div style="width:100%" align="$stylevar[left]">
How did you find us :
<if condition="$bbuserinfo[field29] != ''">$vbphrase[referral]:<div class="smallfont"></if>
</div></div>
</td>
</tr>
</table>
From what i can make out, this code should show the member, their field and the phrase, is this correct code?
EDIT:
Right...The code
<if condition="$post['field29']"><div>$vbphrase[referral]: $post[field29]</div></if>
works in the postbit, but does not work in this code
<table width='100%'><tr>
<td class="panelsurround" align="center" >
<div class="panel">
<div style="width:100%" align="$stylevar[left]">
How did you find us :
<if condition="$bbuserinfo['field29']"><div>$vbphrase[referral] $post[field29]</div></if>
</div></div>
</td>
</tr>
</table>
Its not showing the info in a new web template (Logicans)
Also in the post bit (just for testing the code) it aint pulling the username.
Have i mentioned i want to compile a list of all members and show [fieldX] along with thier name?
noppid
06-21-2006, 07:57 PM
Can you link me to the page or the hack you got the code from? I don't understand what's going on ie. what user id is being used for the custom fields info and where ya get it.
bashy
06-21-2006, 08:05 PM
The code is made up from a template within logicans web templates...
It was just something to use to base this on is all...
See it working here (http://www.bashys-place.com/forums/showthread.php?t=5803) its the How did you find us? in the postbit
Although this will be removed once i sort the list out
that main code i want working in the template is
<if condition="$bbuserinfo['field29']"><div>$vbphrase[referral] $post[field29]</div></if>
like i said it works in the postbit (sort of) it shows the user's profile field. :)
I think for what im wanting the $bbuserinfo is not the right variable as i want
to create a list of ALL members that have filled [fieldx] showing [fieldx] like this
Bashy-----------------[field24]
member---------------[field24]
nother member--------[field24]
gulldarek
06-21-2006, 08:10 PM
You'll have to query all users from db with non-empty specified profile field and iterate through printing the code.
bashy
06-22-2006, 03:02 PM
Dam...that means nothing to me :(
Can someone ellaborate please, Perhaps peterska2 knows a little more?
You'll have to query all users from db with non-empty specified profile field and iterate through printing the code.
peterska2
06-22-2006, 09:06 PM
You will need to include a query on the userfields table to get this to work on other pages (it would work on memberlist, postbit, and memberinfo only otherwise). However, to include the query will require some PHP coding, so I'm not really the person to ask. The HTML that you have is spot on, and that's my field of knowledge, not PHP.
bashy
06-23-2006, 05:22 AM
Ok thanks for taking a look KA much appreciated, i forgot you was more of a template magician ;)
Does anyone with a bit of coding knowledge know what to do here please?
Cause i aint got a clue and this is sommat i really need?
DarkDraco07
11-29-2006, 04:02 AM
did anyone get this to work? i would like to use $post[fieldx] on another page as well
Raptor
07-01-2009, 06:46 AM
I need to get a custom field to show on the main index page
ive tried $bbuserinfo[field5] & $post[field5] - neither of them parse
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.