vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Check Thread Starter Usergroup and Execute Code (https://vborg.vbsupport.ru/showthread.php?t=278572)

Abhik 02-14-2012 05:16 PM

Check Thread Starter Usergroup and Execute Code
 
Hello,
How do I check the thread starter's usergroup and execute code based on that?

I mean, something like this:

Code:

<vb:if condition="is_member_of($threadstarter, 5,6,7,9)">
........
<vb:else />
.............
</vb:if>

Is there any possible way?

Punjabi Munda 02-14-2012 08:17 PM

yes where exactly do you want to do this? The is_member_of should go into your php file and set a boolean to true or false and you can use if statement in your template to behave accordingly

Abhik 02-15-2012 07:20 AM

Well, its in a template, the threadbit template actually.

Lynne 02-15-2012 03:32 PM

The $threads query (used to get information for the threadbit template) does not grab the threadstarter's information (like the usergroup). So, you would actually need to add another query per threadbit per page in order to grab that information.

Abhik 02-16-2012 04:36 PM

Quote:

Originally Posted by Lynne (Post 2299952)
The $threads query (used to get information for the threadbit template) does not grab the threadstarter's information (like the usergroup). So, you would actually need to add another query per threadbit per page in order to grab that information.

Thanks Lynne,
What that query should be? Sorry, but I am totally lost here.

Lynne 02-17-2012 01:19 AM

To be honest, I would not suggest doing that. Is there some other way to do what you want? What is your goal?

Abhik 02-18-2012 10:11 AM

Quote:

Originally Posted by Lynne (Post 2300372)
To be honest, I would not suggest doing that. Is there some other way to do what you want? What is your goal?

Hello Lynne, sorry for replying late.
My goal is to highlight the threadbit in a separate color if the thread started by a member belongs to a specific group.
That's it.

kh99 02-18-2012 10:54 AM

I think the issue is that you normally try not to add queries because they take up time. The user table is already joined in that query to get the info for the last poster, which may be why there's not usergroup coloring for thread starters by default. Anyway, you could just add a query at threadbit_display to look up the info, but then you're adding one query for each thread. The other thing you could do one "big" query similar to the one that's being done (I'm looking in forumdisplay.php), maybe at forumdisplay_query. I don't know which one's better, it probably depends on a lot of factors.

Anyway, if you didn't care at all about adding queries I think you could do this at threadbit_display:

Code:

$starterinfo = fetch_userinfo($thread['postuserid']);
$thread['starter_musername'] = fetch_musername($starterinfo);


Then you could use {vb:raw thread.starter_musername} in the template. That assumes that what you want is to have the username colored by group in the same way that it would be in other places. (I haven't tried the above code).


All times are GMT. The time now is 11:56 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.00968 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
  • (2)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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