vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Design and Graphics Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=168)
-   -   Help Please with Conditionals (https://vborg.vbsupport.ru/showthread.php?t=222041)

MikeWarner 08-29-2009 02:11 PM

Help Please with Conditionals
 
1 Attachment(s)
Hi - I'm trying to highlight the thread title cell of threads posted within a specific forum posted by a specific usergroup (also within search results).

The conditional basically needs to say - <if thread is posted in forumid=1 and thread starter is usergroup=2>Do This</if>

I have attached an image showing to sort of highlight I'm after - anyone know which templates I need to edit (for search results and in forum thread list).

Many many thanks for any help you can give me.

Lynne 08-29-2009 02:44 PM

Probably something like:
HTML Code:

<if condition="$thread['forumid'] == xx AND is_member_of($thread['postuserid'], yy)">
stuff
<else />
other stuff
</if>

I'm not really sure if you can do $thread['postuserid'] in the is_member_of function - you can look it up in the API (in Quick Links).

MikeWarner 08-29-2009 04:24 PM

Hi - thanks for replying. This is what I've added in threadbit template:
PHP Code:

<if condition="$thread['forumid'] == 87 AND is_member_of($thread['postuserid'], 6)">
<
td class="alt1" id="td_threadtitle_$thread[realthreadid]title="$thread[preview]style="BACKGROUND-COLOR: yellow">$thread[title_editable]>

<else />
<
td class="alt1" id="td_threadtitle_$thread[realthreadid]title="$thread[preview]">
</if> 

It isn't working - it does nothing. I tried doing the highlight with no conditional and it worked, so it must be the conditional part. Please help. Thanks. :)

Lynne 08-29-2009 05:17 PM

Did you look at the API for is_member_of?
Quote:

is_member_of (line 384)
Works out if a user is a member of the specified usergroup(s)
This function can be overloaded to test multiple usergroups: is_member_of($user, 1, 3, 4, 6...)
boolean is_member_of (array $userinfo, integer $usergroupid, [boolean $cache = true])
  • array $userinfo: User info array - must contain userid, usergroupid and membergroupids fields
  • integer $usergroupid: Usergroup ID to test
  • boolean $cache: Pull result from cache

So, as seen, it needs more info passed to it. You may have to do a join on the thread query to get the usergroupid of the user also.

MikeWarner 08-29-2009 05:42 PM

Hi Lynne - thanks again, but that stuff is a foreign language to me. :(


All times are GMT. The time now is 10:22 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.01097 seconds
  • Memory Usage 1,726KB
  • 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_html_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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