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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-18-2016, 03:51 AM
kpmedia's Avatar
kpmedia kpmedia is offline
 
Join Date: Jan 2008
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Show icons for specific usergroup (threadstarter) in threadbit?

On the thread listing page (threadbit), in vB3 and vB4, I find the icons to the left of the thread title to be useless. To make that space useful, I'd like to show icons only for threads started by members of certain "priority" usergroups. Their threads get icons, normal members will not.

The easiest way is to wrap this code (which shows one of the icons)
Code:
<img src="$stylevar[imgdir_statusicon]/thread$thread[statusicon].gif" id="thread_statusicon_$thread[realthreadid]" alt="<if condition="$show['threadcount']"><phrase 1="$thread[dot_count]" 2="$thread[dot_lastpost]">$vbphrase[have_x_posts_in_thread_last_y]</phrase></if>" border="" />
in an conditional if statement. But that's my dilemma -- what should it be?

I've tried writing several statements, but none have worked, or even come close. All those did was blank out the icon column, and showed nothing.
Example of NOT working:
Code:
<vb:if condition="is_member_of($vbulletin->thread[postuserid], 6, 33)">
</vb:if>
I came across this: http://stackoverflow.com/questions/3...-on-usergroup#

Quote:
$vbulletin->userinfo and $bbuserinfo grab the user viewing the page. What you want is to grab the user whose post you are iterating over. If you look at the context of your code, all of the vBulletin variables stem from $memberinfo. That's the current poster, and the variable we want. Try: <vb:if condition="is_member_of($memberinfo, 14)">
That makes sense, however it also does not work. My first test was to show threads started by an admin.

Code:
<vb:if condition="is_member_of($memberinfo, 6)">
</vb:if>
What am I missing?


..
Reply With Quote
  #2  
Old 12-18-2016, 04:37 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You want to use the $thread array instead of the $memberinfo array in the "threadbit" template.
Reply With Quote
  #3  
Old 12-18-2016, 04:49 AM
kpmedia's Avatar
kpmedia kpmedia is offline
 
Join Date: Jan 2008
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What would the correct conditional/syntax be?

I just tried this, with no success:
Code:
<vb:if condition="is_member_of($vbulletin->thread[postuserid], 6, 33)">
</vb:if>
and
Code:
<vb:if condition="is_member_of($thread, 6, 33)">
</vb:if>
Reply With Quote
  #4  
Old 12-18-2016, 05:40 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this:

PHP Code:
<vb:if condition="is_member_of($thread, array(6, 33))">
</
vb:if> 

The is_member_of() function expects an array for its second parameter.
Reply With Quote
  #5  
Old 12-18-2016, 06:17 AM
kpmedia's Avatar
kpmedia kpmedia is offline
 
Join Date: Jan 2008
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That doesn't seem to work. The icon column is still blank.

EDIT: This is working (showing something), but also not:

Code:
<vb:if condition="is_member_of($thread[postuserid], array(6,33))">
It's showing the icons for some threads, but it's not the right threads.
- all stickies
- started by moderators
- random normal members

At a glance, it appears to be adding the icon for any thread where the priority members have participated -- not just threads that they've started.

Plus stickies.

But I've found threads started by, and later replied to, by the priority group, which are not receiving icons.

Same for threads not replied to by priority, mods or admins -- just normal thread starter + normal repliers -- yet are receiving icons.

I don't get what's going on here.

EDIT2: If I removed 6 (leaving only 33 in the array), it shows nothing at all again.

..
Reply With Quote
  #6  
Old 12-18-2016, 06:30 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you have the HTML for displaying the image inside the if-then construct?
Reply With Quote
  #7  
Old 12-18-2016, 06:40 AM
kpmedia's Avatar
kpmedia kpmedia is offline
 
Join Date: Jan 2008
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I edited my above post several times. You may want to re-read it, if I added anything pertient.

Code:
<td id="td_threadstatusicon_7670" class="alt1" style="cursor: pointer;">
    <a rel="vB::AJAX"></a>
    <img id="thread_statusicon_7670" border="" alt="" src="http://www.x.com/forum/styles/hr/statusicon/thread.gif"></img>
</td>
This is the HTML for an icon shown on a thread, but should not. Started by normal member, replied to by same member. No admin (6), no priority (33), no mod, nobody else.

I'm not sure what the HTML is supposed to reveal.

EDIT: This is from vBulletin admin side:

Code:
<img src="$stylevar[imgdir_statusicon]/thread$thread[statusicon].gif" 
id="thread_statusicon_$thread[realthreadid]" 
alt="<if condition="$show['threadcount']">
<phrase 1="$thread[dot_count]" 
2="$thread[dot_lastpost]">$vbphrase[have_x_posts_in_thread_last_y]
</phrase></if>" border="" />
..
Reply With Quote
  #8  
Old 12-18-2016, 06:54 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The second block of code you posted is using vB 3.x syntax. Which version of vB are you using?
Reply With Quote
  #9  
Old 12-18-2016, 07:03 AM
kpmedia's Avatar
kpmedia kpmedia is offline
 
Join Date: Jan 2008
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I need to do this on both vB3 and vB4 forums. I can change live code on a vB3 install, while the vB4 has the be done on a development server. The conditional statements barely change between 3 and 4.

The vB4 is essentially using the default plain theme.

..
Reply With Quote
  #10  
Old 12-18-2016, 07:10 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 kpmedia View Post
I need to do this on both vB3 and vB4 forums. I can change live code on a vB3 install, while the vB4 has the be done on a development server. The conditional statements barely change between 3 and 4.
The method for using values stored in variables within templates is different. For example...

vB 3.x:

HTML Code:
$thread[title]
vB 4.x:

HTML Code:
{vb:raw thread.title}
Reply With Quote
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 06:50 PM.


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.04332 seconds
  • Memory Usage 2,285KB
  • Queries Executed 12 (?)
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
  • (8)bbcode_code
  • (2)bbcode_html
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete