vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Show icons for specific usergroup (threadstarter) in threadbit? (https://vborg.vbsupport.ru/showthread.php?t=324039)

kpmedia 12-18-2016 03:51 AM

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?


..

MarkFL 12-18-2016 04:37 AM

You want to use the $thread array instead of the $memberinfo array in the "threadbit" template.

kpmedia 12-18-2016 04:49 AM

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>


MarkFL 12-18-2016 05:40 AM

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. :)

kpmedia 12-18-2016 06:17 AM

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. :confused:

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

..

MarkFL 12-18-2016 06:30 AM

Do you have the HTML for displaying the image inside the if-then construct?

kpmedia 12-18-2016 06:40 AM

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="" />

..

MarkFL 12-18-2016 06:54 AM

The second block of code you posted is using vB 3.x syntax. Which version of vB are you using?

kpmedia 12-18-2016 07:03 AM

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.

..

MarkFL 12-18-2016 07:10 AM

Quote:

Originally Posted by kpmedia (Post 2579581)
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}


All times are GMT. The time now is 08:21 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.02481 seconds
  • Memory Usage 1,746KB
  • 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
  • (8)bbcode_code_printable
  • (2)bbcode_html_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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