vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Add Image to the Right of the Username (https://vborg.vbsupport.ru/showthread.php?t=323171)

Raina 08-04-2016 05:31 AM

Add Image to the Right of the Username
 
1 Attachment(s)
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.

MarkFL 08-04-2016 12:01 PM

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'


TheLastSuperman 08-04-2016 07:19 PM

Quote:

You must 'Like' someone else's post before liking any more by MarkFL.
I'm trying here! +1 via my comment then!

Raina 08-04-2016 11:49 PM

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?

MarkFL 08-05-2016 12:07 AM

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;



Raina 08-05-2016 12:15 AM

1 Attachment(s)
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.

MarkFL 08-05-2016 01:55 AM

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;



Raina 08-05-2016 02:14 AM

That worked perfectly - thanks very much. :)

MarkFL 08-05-2016 02:27 AM

Quote:

Originally Posted by Raina (Post 2574379)
That worked perfectly - thanks very much. :)

Glad to help. :D


All times are GMT. The time now is 08:15 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.01240 seconds
  • Memory Usage 1,740KB
  • 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
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete