Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
[vB5] User Profile Fields in the postbit templates
Lynne
Join Date: Sep 2004
Posts: 41,180

California/Idaho
by Lynne Lynne is offline 10 Apr 2013
Rating: (2 votes - 5.00 average)

Using your User Profile Fields on your site

This article is written with the assumption that you have already created your own User Profile Fields in the User Profile Field Manager. If you need help with this, you may read about it in the manual here - http://www.vbulletin.com/docs/html/profile

For the Purposes of this article, I will be referring to "fieldx" as the name of your profile field. Your real name will be found in the User Profile Manager in the "Name" column - field1, field2, etc.


First thing to do is figure out which fields you want to add to your postbit. Go to your Admincp > User Profile Fields > User Profile Field Manager and note both the Field Name (field1, field2, etc) and the Category the field is in (see image 1). The Profile Fields are listed under their Category Title on this page. It should either be "(Uncategorized)" or have some other category listed. To then get the Category ID, go to User Profile Field Categories, click to Edit the category you want the ID of, and it will be listed at the top - id x (see image 2). Uncategorized Categories have no Category ID.
Image 1:


Image 2:
So, now that you have a list of field ids and category ids, you can now easily add them to your postbit.

First make sure your hook system is active (it is turned off by default). Go to Admincp > Settings > Products/Hook System > Enable/Disable Hook System > Yes.

Now, go to Admincp > Products & Hooks > Manage Hooks and click the link that says "[Add New Hook]". In that new hook, set the following:
Hook is Active: Yes
Hook Location: conversation_userstats
Title: Show Profile Fields in Postbit
Template Name: conversation_fields
Hook Arguments: conversation=conversation
SAVE
Now go to Admincp > Styles & Templates > Style Manager > Add New Template and on that page, set the following:
Title: conversation_fields
Template:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

For each field you want shown, you will need to add this code under that line:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Replace the X in "FieldX" (three times) with the fieldid and, if your field is in a Category other than Uncategoried, then replace "default" with "categoryY_title" where Y is the category id.

So, for instance, say I have the following I want to add:
Name Category
field5 (uncategoried)
field7 New Cat(id 1)
Then my template would look like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

That's it!

If running 5.1.0, there is a code fix to apply here.

Originally Posted by Zachery
In the templates, after applying the following change to

core/vb/library/content/text.php

Find


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Change it to:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
Attached Images
File Type: png UPF Categories.png (25.5 KB, 1583 views)
File Type: png UPF Manager.png (62.7 KB, 1599 views)
Views: 27825
Reply With Quote
Comments
  #2  
Old 12 Apr 2013, 23:41
abdobasha2004's Avatar
abdobasha2004 abdobasha2004 is offline
 
Join Date: Aug 2008
thanks lynne
great work
__________________
Egypt News website, latest Egyptian news updated instantly.
Reply With Quote
  #3  
Old 13 Apr 2013, 16:18
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
 
Join Date: Jan 2002
Real name: Wayne
Great tutorial thanks.
__________________
Wayne Luke
Get started with your own social network. Purchase and download vBulletin today.
Reply With Quote
  #4  
Old 02 May 2013, 15:12
greygaming greygaming is offline
 
Join Date: May 2013
how would you go about adding the link as an attribute inside of an img tag?

or is it more involved than just chopping up that string and putting it in whatever tags you need?
Reply With Quote
  #5  
Old 02 May 2013, 18:24
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Originally Posted by greygaming View Post
how would you go about adding the link as an attribute inside of an img tag?

or is it more involved than just chopping up that string and putting it in whatever tags you need?
I don't know what you mean at all. Can you give an example? You can change the template up however you want. I was just giving an example to make it look like the other stuff under the avatar, but you may format it/change it however you want.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #6  
Old 04 May 2013, 00:58
greygaming greygaming is offline
 
Join Date: May 2013
I would like to take the text string from the text field and have it inserted in the href attribute of an anchor tag. I would then use the anchor tag to wrap around an icon.

any thoughts?

thanks for the reply
Reply With Quote
  #7  
Old 04 May 2013, 04:16
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Originally Posted by greygaming View Post
I would like to take the text string from the text field and have it inserted in the href attribute of an anchor tag. I would then use the anchor tag to wrap around an icon.

any thoughts?

thanks for the reply
So you aren't talking about using a profile field at all, but the text. That isn't what this tutorial is about.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #8  
Old 04 May 2013, 13:18
greygaming greygaming is offline
 
Join Date: May 2013
okay.

official vbulletin support pointed me here and said it could be done.

thanks anyway

--------------- Added 04 May 2013 at 13:31 ---------------

I am unable to create new articles on this site, and vBulletin support is no help.

Would you have any information or resources that I could read up on this topic by myself?

I'm just getting surprised at this point by the lack of help and resources on modifying vbulletin 5.
Reply With Quote
  #9  
Old 04 May 2013, 19:29
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Originally Posted by greygaming View Post
okay.

official vbulletin support pointed me here and said it could be done.

thanks anyway

--------------- Added 04 May 2013 at 13:31 ---------------

I am unable to create new articles on this site, and vBulletin support is no help.

Would you have any information or resources that I could read up on this topic by myself?

I'm just getting surprised at this point by the lack of help and resources on modifying vbulletin 5.
This article is about using the Profile Fields in the postbit template. If that is what you are talking about, then it isn't apparent to me. Perhaps you can be a lot more specific about what you want and then we could help. Vague questions will not get very specific responses.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #10  
Old 05 May 2013, 18:27
greygaming greygaming is offline
 
Join Date: May 2013
I'm sorry for crappy explanations, I do appreciate you taking the time to read these posts


http://imgur.com/rbTHBpa

The picture above is the postbit I am looking to create.
Each image is tied to a link, each link is just the contents of the corresponding profile field.
What I am asking is how to make the output an image of my choice, and have the contents of the field be the link for the image.
Does that make sense?


Isn't that essentially what this tutorial is about, minus the images?
(note: I don't need help with the styling, I can figure that out)

sorry for any misunderstanding or time wasted, i did not mean to offend
Reply With Quote
  #11  
Old 05 May 2013, 19:34
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
If your profile field is a link - http://something.com/image.png - then just use an image tag:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #12  
Old 05 May 2013, 19:42
greygaming greygaming is offline
 
Join Date: May 2013
gorgeous.


thank you so much for your help

--------------- Added 05 May 2013 at 20:25 ---------------

Now, I'm actually curious if there is a way to do the exact same thing in the profile area.

Instead of the field.value being displayed on the profile page, could it be replaced with an image in the exact same way as in the postbit template?

thanks for placating my curiosity!
Reply With Quote
  #13  
Old 05 May 2013, 23:19
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Originally Posted by greygaming View Post
gorgeous.


thank you so much for your help

--------------- Added 05 May 2013 at 20:25 ---------------

Now, I'm actually curious if there is a way to do the exact same thing in the profile area.

Instead of the field.value being displayed on the profile page, could it be replaced with an image in the exact same way as in the postbit template?

thanks for placating my curiosity!
Sorry I didn't understand at first what you were looking for. I'm glad we were finally able to get it working!

You could probably do something similar on the profile page, but I don't see a hook there so it looks like you would need to edit the widget_profile_sidebar template manually to do it. I haven't looked into it at all, but my guess is the variable names will be different also.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #14  
Old 17 May 2013, 16:46
korny's Avatar
korny korny is offline
 
Join Date: Jan 2004
Real name: Bryan
I am getting this error:

Warning: Illegal string offset 'field5' in [path]/includes/adminfunctions_template.php(4638) : eval()'d code on line 3

Not sure what I am missing in the install.
Reply With Quote
  #15  
Old 17 May 2013, 17:12
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
Originally Posted by korny View Post
I am getting this error:

Warning: Illegal string offset 'field5' in [path]/includes/adminfunctions_template.php(4638) : eval()'d code on line 3

Not sure what I am missing in the install.
And exactly what did you enter into your template? (Use code tags)
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 06:48.

Layout Options | Width: Wide Color: