vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 5 Connect Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=249)
-   -   [vB5] User Profile Fields in the postbit templates (https://vborg.vbsupport.ru/showthread.php?t=297041)

Lynne 01-23-2014 05:58 PM

I would suggest reading the thread and trying the suggestions users have posted already regarding that error.

nchoose 02-24-2014 01:55 AM

Lynne, Here is my code:

{vb:data userInfo, user, fetchProfileInfo, {vb:raw conversation.userid}}
<vb:if condition="$userInfo['field6']"><li><label>{vb:phrase field6_title}:</label> <span>{vb:raw userInfo.customFields.default.field6_title.val}</span></li></vb:if>

It is working perfectly to show TEXT put in the field. I would like to put a URL in the field and have the word Feedback linked to that URL. Can you help. This seems like I should be able to do it easy peasy... and my mind is drawing a blank. TY TY

--------------- Added [DATE]1393213800[/DATE] at [TIME]1393213800[/TIME] ---------------

LYNNE! You ROCK! Ok, I figured it out! I was also able to add a second value after the link! *YAY* *YAY*
PHP Code:

 {vb:data userInfouserfetchProfileInfo, {vb:raw conversation.userid}}
<
vb:if condition="$userInfo['field6']"><li><label><a href={vb:raw userInfo.customFields.default.field6_title.val}>{vb:phrase field6_title}</a>:</label> <span>{vb:raw userInfo.customFields.default.field7_title.val}</span></li></vb:if> 

http://whatsyourdeal.com/grocery-cou...Capture118.jpg

we will have to manually update these values, but until there is a mod, this will work. Muddling through!

Thanks again LYNNE for your help!

Lynne 02-24-2014 03:18 AM

I'm glad you got it working. :)

Spangle 04-20-2014 10:06 AM

Tried this on a 5.0.5 and it broke the board !

"There is a serious error and the page cannot be rendered"


Deleted hook

Disabled hook system, board still not functioning

Lynne 04-20-2014 03:35 PM

Not sure exactly what you did, but this is only a hook and it seems strange that it would cause that sort of error. You can go into debug mode and see what the real error is. Also, don't forget to Clear System Cache after doing something.

Spangle 04-20-2014 07:18 PM

Quote:

Originally Posted by Lynne (Post 2493947)
Not sure exactly what you did, but this is only a hook and it seems strange that it would cause that sort of error. You can go into debug mode and see what the real error is. Also, don't forget to Clear System Cache after doing something.

I couldn't do anything, not even get into the ACP, every URL was met with the same error, the only way out was to upgrade to 5.1.0.

I tried the same in 5.1.0, and the same thing happened, eventually gave up on it, is there an easier way to add these fields to the postbit ?

Lynne 04-21-2014 04:20 PM

Why don't you post screen shots of *exactly* what you did.

Spangle 04-21-2014 05:32 PM

I'm confident I followed your instructions correctly, I'm hesitant to go through the process again, in case I "break" the forum again.

You would think there would be an easier way to incorporate fields into postbit.

Spangle 04-23-2014 12:05 PM

BTW this link:

http://www.vbulletin.com/docs/html/profile


gives a "Page not found" response

--------------- Added [DATE]1398260380[/DATE] at [TIME]1398260380[/TIME] ---------------

Attempted this again, followed the instructions to the letter.

Exactly the same result.

There is a serious error and the page cannot be rendered

Would advise that users of 5.0.5 and 5.1.0 do not use this until a fix is posted.

Lynne 04-23-2014 03:46 PM

Please see this thread - http://www.vbulletin.com/forum/forum...profile-fields

Spangle 07-31-2014 09:00 AM

I'm using 5.1.3 A6 and I still cannot get this to display the profile fields, here is the code I am using in the template conversation_fields

Code:

{vb:data userInfo, user, fetchProfileInfo, {vb:raw conversation.userid}}

<vb:if condition="$userInfo['field5']"><li><label>{vb:phrase field5_title}:</label> <span>{vb:raw userInfo.customFields.default.field5_title.val}</span></li></vb:if>

<vb:if condition="$userInfo['field2']"><li><label>{vb:phrase field2_title}:</label> <span>{vb:raw userInfo.customFields.default.field2_title.val}</span></li></vb:if>


Lynne 07-31-2014 04:28 PM

I just put your code into the template on my site and it works just fine.

If you are still getting the This is a Serious Error message on your page, then go into debug mode and see what the real error is.

To enable debug mode edit the /config.php file and change:

Code:

$config['debug'] = false;
To:
Code:

$config['debug'] = true;
Then edit the /core/includes/config.php file and change:

Code:

// $config['Misc']['debug'] = true;
To:
Code:

$config['Misc']['debug'] = true;
To set that up for only your IP address (replace xxx.xxx.xxx.xxx with your IP), put these lines around the code:

Code:

if($_SERVER['REMOTE_ADDR'] == "xxx.xxx.xxx.xxx") {
CODE HERE
}


DisasterDotCom 08-10-2014 02:16 AM

How would I display a piece of information in the postbit only if the user VIEWING the page is logged in and in the supermoderator or admin user group?

--------------- Added [DATE]1407644438[/DATE] at [TIME]1407644438[/TIME] ---------------

Actually, I think I got it... but this could probably be cleaned up... I'm also not 100% sure membergroupids is an array? This is vb5.1.2

<vb:if condition="in_array($bbuserinfo[usergroupid], array(5,6,16))">
<vb:if condition="in_array($userInfo['membergroupids'], array(14,15))">
<span style="color:red;font-weight:bold;">Display Stuff Here</span><br>
</vb:if>
</vb:if>

--------------- Added [DATE]1407645650[/DATE] at [TIME]1407645650[/TIME] ---------------

And one more update... userinfo['membergroupids'] shows up as a string when I do a debugvardump. How do I check to see if it contains the group ID? vBulletin doesn't allow you to search in a string according to http://bit.ly/1uBdO1U

Lynne 08-10-2014 03:54 PM

I believe is_member_of is the function your would want to use.

<vb:if condition="is_member_of($bbuserinfo, 5, 6, 16)">
<vb:if condition="is_member_of($userInfo, 14, 15)">

DesignMVD 09-03-2014 03:11 AM

1 Attachment(s)
Thanks for the tutorial!

I show my result :)

vvlo 09-04-2014 04:32 AM

hi
I can not find Admincp > Styles & Templates > Style Manager > Add New Template
Instead There is : Add New style
And there is no place to add code

Lynne 09-04-2014 05:04 PM

Add New Template is a dropdown next to the style. The default dropdown will say Style Variable Editor, so just click on that to see the other options.

vvlo 09-04-2014 06:05 PM

Quote:

Originally Posted by Lynne (Post 2513774)
Add New Template is a dropdown next to the style. The default dropdown will say Style Variable Editor, so just click on that to see the other options.

i use vBulletin Default Theme, and not see this option in dropdown.:(

dropdown option :edit setting
add child style
download
delete style

I added a child style and did change it and the problem was solved.
Thank you.

raynestorm 03-16-2015 08:51 PM

Hello--
I am following this tutorial and have created a new category called "Custom" and added a new field called "industry". "Industry" has several check boxes for the user to check. The "Custom" category has ID = 1 and the industry field is field=5. I created and added this code to a template called "conversation_fields":
PHP Code:

{vb:data userInfouserfetchProfileInfo, {vb:raw conversation.userid}}
<
vb:if condition="$userInfo['field5']"><li><label>{vb:phrase field5_title}:</label> <span>{vb:raw userInfo.customFields.category1_title.field5_title.val}</span></li></vb:if> 

The word "Industry: " displays in my postpit but the values (picked by checkbox) do not display. How can I get the value of the field "Industry" to also be displayed?

Thanks.

Lynne 03-17-2015 06:16 PM

That looks like it should work. Can I get a screen shot of your profile field 5?

raynestorm 03-17-2015 06:58 PM

1 Attachment(s)
Attached are the screen shots.
Thanks.

Lynne 03-18-2015 09:09 PM

For the option, you cut off the screen right where it says Display Page - do you have it set to Edit Profile? I think it needs to be for this to work.

raynestorm 03-18-2015 10:01 PM

Quote:

Originally Posted by Lynne (Post 2540846)
For the option, you cut off the screen right where it says Display Page - do you have it set to Edit Profile? I think it needs to be for this to work.

You are right! It does have to be set to Edit Profile. I had set it to "Other", but I can't remember why, exactly. Display Page only controls where the field contents is displayed?

Thanks for the help!

arshadeomran 04-27-2015 03:47 PM

Quote:

Originally Posted by Lynne (Post 2415422)
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:
https://vborg.vbsupport.ru/attachmen...1&d=1365552264

Image 2:
https://vborg.vbsupport.ru/attachmen...1&d=1365552264
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:
Code:

{vb:data userInfo, user, fetchProfileInfo, {vb:raw conversation.userid}}
For each field you want shown, you will need to add this code under that line:
Code:

<vb:if condition="$userInfo['fieldX']"><li><label>{vb:phrase fieldX_title}:</label> <span>{vb:raw userInfo.customFields.default.fieldX_title.val}</span></li></vb:if>
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:
Code:

{vb:data userInfo, user, fetchProfileInfo, {vb:raw conversation.userid}}

<vb:if condition="$userInfo['field5']"><li><label>{vb:phrase field5_title}:</label> <span>{vb:raw userInfo.customFields.default.field5_title.val}</span></li></vb:if>

<vb:if condition="$userInfo['field7']"><li><label>{vb:phrase field7_title}:</label> <span>{vb:raw userInfo.customFields.category1_title.field7_title.val}</span}</li></vb:if>

That's it!

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

Hi Lynne,
I want to place the new fields of postbit below number of post.
How can I do it?
Thanks

Lynne 04-27-2015 04:53 PM

Quote:

Originally Posted by arshadeomran (Post 2544311)
Hi Lynne,
I want to place the new fields of postbit below number of post.
How can I do it?
Thanks

There isn't a hook there, so you would need to add the code directly to the template.

arshadeomran 04-28-2015 06:43 AM

Quote:

Originally Posted by Lynne (Post 2544313)
There isn't a hook there, so you would need to add the code directly to the template.

I have used the codes that you wrote in first post. I want only change position of field in postbit so that "number of post" must be the latest field not second field.
Thank you.

heredia21 07-05-2015 04:59 PM

Does this no longer working on 5.1.8 Alpha 6? All of a sudden the extra profile fields stopped showing.


All times are GMT. The time now is 07:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01422 seconds
  • Memory Usage 1,825KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (2)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (27)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete