vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   Using your User Profile Fields in your postbit templates (w/ all plugin method) (https://vborg.vbsupport.ru/showthread.php?t=250418)

Lynne 09-25-2012 08:49 PM

You need to use the <a> tag for links - http://www.w3schools.com/tags/tag_a.asp and please use double-quotes in the tag, not single-quotes since the single-quotes are being used in the equation.

omega79 09-26-2012 07:38 AM

i am just very new to all this so i have no idea how to do it ...
isn't there a way you can put a form in the pluginconfiguration where the plugin-user could type in or choose the fieldID ?

but well if needed i will probably finishing my community first and after i went live i can look into this again ...

still having headaches over other things in VBB ... have to learn alot ;)

Lynne 09-26-2012 04:09 PM

I already have it in a form where all you have to do is change the field id. This is an article, not a modification. If you don't know how to do it, then I suggest you try it out on your test site.

omega79 10-02-2012 09:08 AM

okay thank you very much :D
it all looks very complicated if you are new to vbulletin ...
but after some time it gets more simple ...
nice work you done here :D

CentralGarrison 02-26-2013 02:39 PM

I'm sorry if this is inappropriate to ask here, but reading through this guide it looks like the same method could be used to put custom profile fields into the user's signature. Which templates would I need to edit to force a custom field to always be displayed in a user's signature?

EDIT: Nevermind, please disregard. I found what I needed in the postbit_legacy template! Thank you!

Mysterious Ride 04-23-2013 03:13 PM

Quote:

Originally Posted by Lynne (Post 2097602)
Method 2 - Using a template_hook
I have always found it easier to just use the existing $template_hooks in the template and write a plugin to add these. In this case, there is a $template_hook right where we want it, after the user post count:
Code:

{vb:raw template_hook.postbit_userinfo_right_after_posts}
So, we would create a plugin with these specifications:
? hook location - postbit_display_complete
? Title - Add User Profile Fields to Postbit Templates
? Plugin is Active - Yes
? Plugin PHP Code -
Code:

if ($post['fieldx'])
{
    $template_hook['postbit_userinfo_right_after_posts'] .= '<dt>My FieldX</dt> <dd>' .$post[fieldx]. '</dd>';
}

Change "fieldx" to your actual field name and the green field to whatever you want. Again, notice the html I used is similar to the html used for the text above me new field. Whichever template_hook you use, you should look at the template to see what sort of html is being used around the hook so that you may use similar, proper html also.

I tried to read on how to make this a hyperlink from what others asked, but I got confused. This is the method that you posted that I want to use and what's going to be placed into the profile field is a link to profile post that the member posted for a character. What I trying to get it to look like is this:

Join Date:
Posts:
Character Profile

Even if its the whole Character Profile is the hyperlink that will take member directly to the character profile will work. I believe you said that I would have to use the <a> tag, but I'm not sure how to insert it into the code you already have.

Lynne 04-23-2013 03:54 PM

Something like:

PHP Code:

$template_hook['postbit_userinfo_right_after_posts'] .= '<dt>Character</dt> <dd><a href="' .$post[fieldx]. '">Profile</a></dd>';


I haven't tested it, but I think it should work.

Mysterious Ride 04-24-2013 08:20 AM

That didn't work, I got this error at the top of my board. I tried just doing the regular method two you have posted, but the profile field didn't show up under the post count either.

Lynne 04-24-2013 04:20 PM

And what was the error? And what was the *exact* code you entered into the plugin?

Mysterious Ride 04-25-2013 01:01 AM

1 Attachment(s)
Sorry, I tried it again and it worked perfectly. I must have not posted something right. I got the error because I left out the:

if ($post['fieldx'])
{

I thought I added it when I tried a second time, but I didn't get an error message nor did anything show up. But here's the completed code for Method 2 that works perfectly:

Code:

if ($post['fieldx'])
{
$template_hook['postbit_userinfo_right_after_posts'] .= '<dt>My fieldX</dt> <dd><a href="' .$post[fieldx]. '">My Link</a></dd>';
}

The My Link can be anything anyone what's it to be.

I also adjusted the code so that it fits Method 1 and I tested it and it works great to. It still goes in the same place you said.

Code:

<vb:if condition="$post['fieldx']"><dt>My fieldX</dt> <dd><a href="{vb:raw post.fieldx}">My Link</a></dd></vb:if>
I included an attachment to show the end result.


All times are GMT. The time now is 01:01 AM.

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.01245 seconds
  • Memory Usage 1,745KB
  • 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
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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