vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to tell if a post is by a member of a certain usergroup (https://vborg.vbsupport.ru/showthread.php?t=243074)

BirdOPrey5 05-21-2010 09:23 PM

How to tell if a post is by a member of a certain usergroup
 
I know the below code tells the forum to run code if the current user is a member of a certain usergroup:
if(is_member_of($vbulletin->userinfo, 5, 6, 7))
//stuff goes here if true

My question is, is there similar code to decide to run the if statement based on the usergroup of the current poster. Basically I'm in the postbit template and want a conditional to do something if the poster is in a certain usergroup(s). Maybe something like:

if(is_member_of($vbulletin->posterinfo, 5, 6, 7))
//stuff goes here if true

borbole 05-21-2010 09:28 PM

Try this:

PHP Code:

if(is_member_of($vbulletin->post567)) 
{
//your code here to excute if true



BirdOPrey5 05-21-2010 09:47 PM

Quote:

Originally Posted by borbole (Post 2041641)
Try this:

PHP Code:

if(is_member_of($vbulletin->post567)) 
{
//your code here to excute if true



Doesn't seem to be working, it's never coming back true no matter the groups I use.

and just to be clear, what I'm really using is
Code:

<if condition="(is_member_of($vbulletin->post, 2, 6, 20, 21))">
I forgot the 'condition=' in the example...

borbole 05-21-2010 09:56 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2041649)
Doesn't seem to be working, it's never coming back true no matter the groups I use.

and just to be clear, what I'm really using is
Code:

<if condition="(is_member_of($vbulletin->post, 2, 6, 20, 21))">
I forgot the 'condition=' in the example...


Ah, you want it to use in a template. From your op, I thought you needed the rraw php code.

Anyway, try this:

HTML Code:

<if condition="is_member_of($post, 2, 6, 20, 21 )">
<!--your code here-->
</if>

That should do the trick.

BirdOPrey5 05-21-2010 10:27 PM

*Perfect* Much thanks!
May I ask did you read about these functions somewhere or just something you picked up along the way? I've made a number of php apps but clueless when it comes to vB.

Lynne 05-21-2010 10:36 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2041672)
*Perfect* Much thanks!
May I ask did you read about these functions somewhere or just something you picked up along the way? I've made a number of php apps but clueless when it comes to vB.

vBulletin API

BirdOPrey5 05-22-2010 12:48 AM

Quote:

Originally Posted by Lynne (Post 2041677)

Thanks... is the 3.8 documentation still available?

borbole 05-22-2010 12:29 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2041672)
*Perfect* Much thanks!
May I ask did you read about these functions somewhere or just something you picked up along the way? I've made a number of php apps but clueless when it comes to vB.

You are welcome. Glad to have been of help :)

Personally, I did a lot of research here by searching the forums and studying the vb files/templates. And pretty soon everything fell in place and became crystal clear. These forums are a gold mine of information. One can learn a lot.

Lynne 05-22-2010 12:48 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2041707)
Thanks... is the 3.8 documentation still available?

A lot of it hasn't changed. And, you can always just look the function up in the files if you are wondering if it's changed.


All times are GMT. The time now is 11:46 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.01670 seconds
  • Memory Usage 1,736KB
  • 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
  • (1)bbcode_html_printable
  • (2)bbcode_php_printable
  • (6)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