View Full Version : Using User Profile Fields on a different part of the site
Fuzz22
03-22-2009, 08:44 PM
Is it possible to use User Profile Fields (e.g. field5) on a different part of the site (not the forum) like my homepage. If so, how would I make it work?
Lynne
03-22-2009, 08:51 PM
Yes, you should be able to. I use it in my navbar with the variable $bbuserinfo[fieldx]
TNCclubman
03-22-2009, 08:53 PM
looking for this too...
Lynne, will that also bring the little editing icon next to the field as well?
ragtek
03-22-2009, 08:58 PM
If its not a forumpage(as you wrote*g*) you'll have to grab it yourself from the db(table userfield) or include the global.php from the forum and use it like lynne wrote.
--------------- Added 1237759165 at 1237759165 ---------------
looking for this too...
Lynne, will that also bring the little editing icon next to the field as well?
no, thats happening with js
TNCclubman
03-22-2009, 09:02 PM
thanks lynne, that worked!!!
All I need is to also have the edit button next to it, and when its pressed, the info becomes editable and you can just re-write the entry...like when they do it in their profile!
Fuzz22
03-22-2009, 09:05 PM
Can you help me with grabbing it from the db?
Lynne
03-22-2009, 09:10 PM
If you need to grab it from the db, you'll have to write a plugin. You'll have to be much more specific about where you need to use it if you want help with that.
As for the edit button, steal the code from the template and make sure you include the same files included on the member page and see what happens.
Fuzz22
03-22-2009, 09:36 PM
I wish to use it on a script that I already have and submit field5 into the script which is located on the homepage.
Lynne
03-22-2009, 10:37 PM
That isn't telling us anything. Post your script and tell us which plugin you are using for it and tell us where - which template or line - you wish to use it on the homepage. I assume by homepage you mean the forum index? If not, you need to explain it better.
TNCclubman
03-22-2009, 10:42 PM
<!-- ########## WHATS ON YOUR MIND ######### -->
<a href="/usercp.php"><img src="/image.php?u=$bbuserinfo[userid]" alt="Some avatar" border="0" /></a>
<tr><td class="alt1" nowrap="nowrap" align="left"><b>What's On Your Mind?:</b>
<fieldset>
$bbuserinfo[field12]
</fieldset></td>
</tr>
<!-- ########## /WHATS ON YOUR MIND ######### -->
So far with the code above, I got the users avatar showing up and thanks to Lynnu, the field is showing as well...
Does anyone have an idea of what the javascript is to have the little edit pencil show up?
Lynne
03-22-2009, 11:36 PM
Does anyone have an idea of what the javascript is to have the little edit pencil show up?
Sleuthing 101:
Take a look at the page source and see what is going on. If you did, you'd see something like this:
<dt class="shade" id="profilefield_title_1">Biography</dt>
<dd id="profilefield_value_1">
N/A
<script type="text/javascript">
<!--
vBulletin.register_control("vB_ProfilefieldEditor", "1");
//-->
</script>
</dd>Then, do a search in your files for "register_control" and you'll find it in clientscript/vbulletin_global.js.
Also, since this is shown on the member.php page, it's a good idea to see what scripts get added on that page that don't get added on all the other pages. When looking at the page source, search for any scripts on there and you'll come across a couple scripts that have the word "edit" in them - "vbulletin_quick_edit_generic.js" and "vbulletin_profilefield_edit.js" And, right under where you find those scripts, you'll see some more lines that look useful that have the word "Edit" in them. Grab that too. Do I know if you need all that? No, I don't know, but it's a good place to start.
Fuzz22
03-23-2009, 02:00 AM
That isn't telling us anything. Post your script and tell us which plugin you are using for it and tell us where - which template or line - you wish to use it on the homepage. I assume by homepage you mean the forum index? If not, you need to explain it better.
No, by homepage I mean a completely separate part of the site (not the forum) as I explained in my first post.
I wish to insert field5 (one of my User Profile Fields) into a sentence. I don't have a code yet as I'm not sure where to start. I know that if I was doing it on any forum page, then I'd use "$post[field5]" however this won't work and I'd like to know what I need to add to make that work. Hopefully that's a little more understandable :)
Lynne
03-23-2009, 03:11 AM
Well, what query are you using to get the userinfo? You'll have to add to that query to get the field5 info.
TNCclubman
03-23-2009, 05:16 PM
Ok, got the pencil to show up and it links to the users 'edit details' page. Wanted it to just do an instant inline editing with the javascript... wondering if anyone's figured out exactly what I need in terms of the coding to do that... it kind of sucks that by clicking the icon they leave the page and have to search for that field to change it.
Lynne
03-23-2009, 06:01 PM
You really need to start your own thread about this and post the code you are using and template changes, etc. We really can't help when we have no clue what you have done and where, etc.
Fuzz22
03-24-2009, 05:17 AM
Well, what query are you using to get the userinfo? You'll have to add to that query to get the field5 info.
None as yet, I'd like to know what query I should use.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.