Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2016, 05:31 AM
Raina Raina is offline
 
Join Date: Feb 2014
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Add Image to the Right of the Username

I would like to place an image to the right of the username and online status. Please refer to the attached image.

I understand I need to modify the postbit template but I cant seem to get it in the right place.

Using vbulletin 4.2.3.

Can someone help?

Edit: Sorry should have posted this in the design and styles forum.
Attached Images
File Type: jpg Capture.jpg (11.6 KB, 0 views)
Reply With Quote
  #2  
Old 08-04-2016, 12:01 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Rather than hack your template, create a plugin hooked at "postbit_display_complete" and use something like this for the Plugin PHP Code :

PHP Code:
$template_hook['postbit_userinfo_left'] .= 'put image element here'
Reply With Quote
2 благодарности(ей) от:
blind-eddie, Raina
  #3  
Old 08-04-2016, 07:19 PM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
You must 'Like' someone else's post before liking any more by MarkFL.
I'm trying here! +1 via my comment then!
Reply With Quote
Благодарность от:
Raina
  #4  
Old 08-04-2016, 11:49 PM
Raina Raina is offline
 
Join Date: Feb 2014
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Mark, can I build on the problem a little. I was hoping to actually display an image based on the users secondary group. This is what I originally had:

Code:
<vb:if condition="is_member_of($post,14)">
<img src="https://s32.postimg.org/5dc09irbp/mh_MJw6_U.png" />
</vb:if>
<vb:if condition="is_member_of($post,32)">
<img src="https://s32.postimg.org/h8jobvrud/gold.png" />
</vb:if>
How can I add that into the template hook?
Reply With Quote
  #5  
Old 08-05-2016, 12:07 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually, your best bet here is to use vBulletin's "User Ranks" feature. With it, you can associate images or HTML with specific usergroups and it will be displayed in the location you specified.

However, if you would rather use a plugin, then you could use the code:

PHP Code:
$imagesrc '';

if (
is_member_of($post, array(14)))
{
    
$imagesrc '5dc09irbp/mh_MJw6_U.png';
}
elseif (
is_member_of($post, array(32)))
{
    
$imagesrc 'h8jobvrud/gold.png';
}

if (
$imagesrc)
{
    
$image '<img src="https://s32.postimg.org/' $imagesrc '" />';
    
$template_hook['postbit_userinfo_left'] .= $image;

Reply With Quote
  #6  
Old 08-05-2016, 12:15 AM
Raina Raina is offline
 
Join Date: Feb 2014
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the code. Unfortunately it displays the image underneath the users title. I was hoping to display to the right of the username and title. Is that possible?

See the image for details.
Attached Images
File Type: png Badge2.PNG (31.5 KB, 0 views)
Reply With Quote
  #7  
Old 08-05-2016, 01:55 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, create a plugin hooked at "parse_templates" with the code:

PHP Code:
if (THIS_SCRIPT === 'showthread')
{
    
$template_hook['headinclude_css'] .= '<style>.postbit_badge {position: relative; left: 100px; top: -30px}</style>';

You can adjust the left and top values to your liking.

You could add what's inside the "style" tags to the plugin I posted in your other thread about preventing the join date from wrapping.

And then change the code I posted above to:

PHP Code:
$imagesrc '';

if (
is_member_of($post, array(14)))
{
    
$imagesrc '5dc09irbp/mh_MJw6_U.png';
}
elseif (
is_member_of($post, array(32)))
{
    
$imagesrc 'h8jobvrud/gold.png';
}

if (
$imagesrc)
{
    
$image '<img class="postbit_badge" src="https://s32.postimg.org/' $imagesrc '" />';
    
$template_hook['postbit_userinfo_left'] .= $image;

Reply With Quote
  #8  
Old 08-05-2016, 02:14 AM
Raina Raina is offline
 
Join Date: Feb 2014
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That worked perfectly - thanks very much.
Reply With Quote
Благодарность от:
TheLastSuperman
  #9  
Old 08-05-2016, 02:27 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Raina View Post
That worked perfectly - thanks very much.
Glad to help.
Reply With Quote
Благодарность от:
TheLastSuperman
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:31 PM.


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.04356 seconds
  • Memory Usage 2,283KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (5)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (2)postbit_attachment
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete