PDA

View Full Version : Display User Profile Fields Info in Thread Post


alfuzzy
08-16-2018, 05:46 PM
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
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:


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 1534527978 at 1534527978 ---------------

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 1534528134 at 1534528134 ---------------

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:


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/profilefield.php?do=modify

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

alfuzzy
08-17-2018, 07:15 PM
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
* 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
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 1534562837 at 1534562837 ---------------

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.

alfuzzy
08-18-2018, 01:51 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.

vBulletin version is 4.2.3.

I cleared the cache...but info still not showing up. Do you think the 'Execution Order" has anything to do with it not working?

If all this doesn't work...are you saying I should skip doing the plug-in method...and try editing the postbit_legacy template?

Thanks

--------------- Added 1534644045 at 1534644045 ---------------

Quick update:

Big Big thanks to "snakes1100" and "iA1" for the help. I ended up modifying the postbit_legacy template...and the additional member info I wanted to display is now visible!

Thanks again!:):)