vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Display User Profile Fields Info in Thread Post (https://vborg.vbsupport.ru/showthread.php?t=326661)

alfuzzy 08-16-2018 05:46 PM

Display User Profile Fields Info in Thread Post
 
I have 6 user profile fields setup. All 6 show up in the "Edit User Profile" area for each member to fill in if they wish.

I would like at least one of these user profile fields to be displayed along with a members avatar, reputation, post count stats each time they post a reply in a thread.

This information used to be displayed...and now has somehow disappeared. I can't seem to find the Admin control panel setting to allow this user profile info to be displayed each time they post a reply to a thread.

Can someone please point me where this setting is located?

Thank You

snakes1100 08-17-2018 10:43 AM

Add this to your postbit or postbit_legacy template

<vb:if condition="$post['fieldX']"><dt>XXXXXXXXX</dt> <dd>{vb:raw post.fieldX}</dd></vb:if>

Get X from the custom userfield.

alfuzzy 08-17-2018 11:33 AM

Quote:

Originally Posted by snakes1100 (Post 2596015)
Add this to your postbit or postbit_legacy template

<vb:if condition="$post['fieldX']"><dt>XXXXXXXXX</dt> <dd>{vb:raw post.fieldX}</dd></vb:if>

Get X from the custom userfield.

Cool...thanks.

Do I just add that line of code anywhere in the postbit_legacy template...at the end for example?

And this will allow me to be able to display some extra user profile info below a members avatar, reputation, and post counts stats?

Thanks again.:)

iA1 08-17-2018 12:13 PM

Add it after the post count in postbit_legacy template.

Or instead of modifying templates, simply create a new plugin at hook location postbit_display_complete and add the following:

Code:

if ($post['fieldX']) {
$template_hook['postbit_userinfo_right_after_posts'] .= "<dt>PHRASE TO DISPLAY</dt> <dd>" . $post['fieldX'] . "</dd>";
}

Adding a plugin is better than modifying templates because every time you upgrade your forum, you will have to modify the templates once again. Plugins can be easily enabled and disabled.

alfuzzy 08-17-2018 03:40 PM

I wanted to be 100% sure I described what I want to do.

Here's screenshot of the info I want to show up with each thread post a member makes:


https://vborg.vbsupport.ru/external/2018/08/7.png

I want both the red arrow & purple arrow item's in the screenshot above to be displayed here below the "normal" info that is displayed with each members thread post (purple arrow, 2nd screenshot below):


https://vborg.vbsupport.ru/external/2018/08/8.png

Thank you.

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

Quote:

Originally Posted by snakes1100 (Post 2596015)
Add this to your postbit or postbit_legacy template

<vb:if condition="$post['fieldX']"><dt>XXXXXXXXX</dt> <dd>{vb:raw post.fieldX}</dd></vb:if>

Get X from the custom userfield.

Hello Snakes1100. Thanks for the help. Given the info I posted with the screenshots. If I wanted both the:

- "Your Mac's Specs" (red arrow)
- And the info the user enters into the field (purple arrow)

Does the line of code you mentioned to add to the postbit_legacy template still do the trick?

Thanks

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

Quote:

Originally Posted by iA1 (Post 2596017)
Add it after the post count in postbit_legacy template.

Or instead of modifying templates, simply create a new plugin at hook location postbit_display_complete and add the following:

Code:

if ($post['fieldX']) {
$template_hook['postbit_userinfo_right_after_posts'] .= "<dt>PHRASE TO DISPLAY</dt> <dd>" . $post['fieldX'] . "</dd>";
}

Adding a plugin is better than modifying templates because every time you upgrade your forum, you will have to modify the templates once again. Plugins can be easily enabled and disabled.

Hello iA1. Thanks for the help. Same question I asked Snakes1100. Given the info I posted with the screenshots. If I wanted both the:

- "Your Mac's Specs" (red arrow)
- And the info the user enters into the field (purple arrow)

Does the code you mentioned for creating a new plugin still do the trick?

Thanks

iA1 08-17-2018 05:21 PM

Yes, the plugin does exactly that. Just change the X in fieldX to whatever field number you have in user profile fields manager https://www.yourdomain.com/admincp/p....php?do=modify

https://vborg.vbsupport.ru/external/2018/08/9.png

alfuzzy 08-17-2018 07:15 PM

Quote:

Originally Posted by iA1 (Post 2596025)
Yes, the plugin does exactly that. Just change the X in fieldX to whatever field number you have in user profile fields manager

Thanks very much iA1 for the expanded explanation. Adding the part about the "fieldX" I missed in your earlier post.

So just to make sure I understand 100%. If I take the line of code you mentioned earlier to create a new plug-in with:


if ($post['fieldX']) {$template_hook['postbit_userinfo_right_after_posts'] .= "<dt>PHRASE TO DISPLAY</dt> <dd>" . $post['fieldX'] . "</dd>";}



* I need to enter the proper user profile field where the 'fieldX' statement is located?
* What do I enter in the PHRASE TO DISPLAY part of the code? In the 1st screenshot I posted above...would this be the phrase "Your Mac's Specs"?

Thanks again.

iA1 08-17-2018 07:21 PM

Quote:

Originally Posted by alfuzzy (Post 2596030)

* I need to enter the proper user profile field where the 'fieldX' statement is located?
* What do I enter in the PHRASE TO DISPLAY part of the code? In the 1st screenshot I posted above...would this be the phrase "Your Mac's Specs"?

Thanks again.

Yes, for both the questions.

alfuzzy 08-17-2018 07:55 PM

Quote:

Originally Posted by iA1 (Post 2596031)
Yes, for both the questions.

Awesome! Will give this a try shortly. Haven't created a plug-in before. Will post how it goes.:)

Thanks

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

Hey iA1. I believe I did everything correctly...but the user profile info I would like to display is not displaying.

Here's a screenshot of the plugin I created. As you can see it is "active". Only input area I wasn't sure about was the "Execution Order". For some reason it came up with a default setting of "5"...so I didn't change it.

If that wouldn't have caused any issue's...what else might I try? Thanks


https://vborg.vbsupport.ru/external/2018/08/10.png

iA1 08-18-2018 01:43 AM

Clear cache and check again. Which vB version are you using?

If it doesn't work, then edit the template and use the code given by snakes1100. Search for postbit_userinfo_right_after_posts in postbit_legacy template and add the code just above or below that line.


All times are GMT. The time now is 06:24 AM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01130 seconds
  • Memory Usage 1,750KB
  • 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
  • (2)bbcode_code_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
  • (10)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