View Full Version : Call 'fieldx' as a link?
KevinL
02-19-2013, 04:14 PM
I am trying to call a user field as a link in a custom page.
The user adds their custom link in the user field and it is used to link back to the site using the code below...
<textarea cols="16" name="textarea" onclick="this.focus();this.select()"
rows="1" style="height: 200px; overflow: hidden; width: 256px;"><a
href=" [Needs to be profile field] "><img border="0" src="logo.png" /></a></textarea>
Any ideas?
Which template is that in? Does each user see their own link, or is it in a user's profile or post or something like that?
KevinL
02-19-2013, 04:32 PM
Thanks for the reply :)
I am creating my own template/page.
Yes each user would edit their settings and change the profile field to the correct URL. Similar to this page:
http://betweennapsontheporch.net/how-to-make-a-blog-button-with-grab-box-code-underneath-for-your-sidebar/
The link back would change based on the URL entered in their settings.
OK, so you want all users to see the link of whatever user is being displayed? How are you getting the other user information? Are you caling fetch_userinfo() or something like that?
The data will be in the userfield table, but you don't have to read it from the database yourself unless you're getting all your info directly from the db.
KevinL
02-19-2013, 04:44 PM
No. I want each user [that edits the field in settings] to see their [own] link.
SO they will copy the code that is the box and paste it on their site and it will link back to their url.
OK, in that case try this:
<textarea cols="16" name="textarea" onclick="this.focus();this.select()"
rows="1" style="height: 200px; overflow: hidden; width: 256px;"><a
href="{vb:var bbuserinfo.fieldX}"><img border="0" src="logo.png" </img></a></textarea>
where you'd replace 'X' with the actual id of your profile field.
That assumes that the above code is being put in a template. If it's not then you might want to use $vbulletin->userinfo['fieldX'] as part of the html string.
KevinL
02-19-2013, 05:08 PM
That works perfect. I forgot the 'vb:var'
Thank you!!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.