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)

voglermc 11-04-2010 02:02 PM

Code:

<a href="album.php?{vb:raw session.sessionurl}u={vb:raw post.userid}" title="View {vb:raw post.username}'s Album" rel="nofollow">View {vb:raw post.username}'s Album</a>

Lynne 11-04-2010 02:29 PM

Then you should post in the main forums about it, not in some random article about the profile fields.

Black Tiger 11-30-2010 07:32 PM

Looks very interesting. You told me this was possible to make compatible for v3.8.x by changing some html code.

Could you or somebody else tell me what exactly to change? I can read a bit of php, but don't know what to do with it, so I would really need a "look for this and replace with that" solution. It has no hurry though.;)

Thanks in advance!

Lynne 11-30-2010 09:03 PM

Did you see this for 3.8? How To Add Custom Profile Field Information To The Postbit

The only thing I think she doesn't cover is doing it all via pluginand it isn't much different at all for 3.8.

Plugin 1
? hook location - init_startup
? Title - Add User Profile Fields to Postbit Templates - 1
? Plugin is Active - Yes
? Plugin PHP Code -
Code:

if (THIS_SCRIPT == 'showthread') $phrasegroups[] = 'cprofilefield';
Plugin 2
? hook location - showthread_postbit_create
? Title - Add User Profile Fields to Postbit Templates - 2
? Plugin is Active - Yes
? Plugin PHP Code -

Code:

if (THIS_SCRIPT == 'showthread') {
    $profilefieldx =  $vbulletin->db->query_first("SELECT profilefieldid, data, type  FROM " . TABLE_PREFIX . "profilefield WHERE profilefieldid = x");
    $post['profilefieldx'] = $profilefieldx;
}

Plugin 3
? hook location - postbit_display_complete
? Title - Add User Profile Fields to Postbit Templates - 3
? Plugin is Active - Yes
? Plugin PHP Code -
Code:

// for single-line fields - using fieldy
if ($post['fieldy']) {
    $template_hook['postbit_userinfo_right_after_posts'] .= '<div>' .$vbphrase[fieldy_title]. ': ' .$post[fieldy]. '</div>';
 }

// for multiple-selection fields - using filedx
if ($post['fieldx'])
{
    $fieldarrayx = $post['profilefieldx'];
    fetch_profilefield_display($fieldarrayx, $post['fieldx']);
    $template_hook['postbit_userinfo_right_after_posts'] .= '<div>' .$vbphrase[fieldx_title]. ': ' .$fieldarrayx['value']. '</div>';
}


Black Tiger 11-30-2010 09:16 PM

Yep I have seen that, but she left out the Multiple Selection Menus (like in my post about the comma at vbulletin.com yesterday) and that is just what we needed. That part seems covered now in plugin 3 if I understand everything correctly.

Thank you very much for your time explaining it, we are going to try it.

Lynne 11-30-2010 10:06 PM

You need to do plugin 1, 2, and 3, not just 3.

Black Tiger 11-30-2010 10:20 PM

Yep, I understood, but thank you for making sure, because I see in my reply I was not clear about me understanding that we needed all 3.;)

Bundle 12-12-2010 03:17 PM

Is there a way to make this only display if the user has filled in the profile field? e.g. if I tried to make a custom profile field about favourite food, is there a way to stop "Favourite Food: " appearing if the field is blank?

Cheers.

Lynne 12-12-2010 06:55 PM

The if condition around it should make it so it doesn't show if it doesn't exist.

sulasno 01-08-2011 11:15 PM

thanks for the link to this article

definitely a keeper


All times are GMT. The time now is 10:29 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.01200 seconds
  • Memory Usage 1,741KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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