vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Usergroup based content (https://vborg.vbsupport.ru/showthread.php?t=189709)

G_Gekko 09-01-2008 05:57 AM

Usergroup based content
 
I want show content for a specific usergroup only. How do I do this. would adding
PHP Code:

if ($vbulletin->userinfo['usergroupid'] == '6' )
    {
    echo 
"This is only visible to people in usergroup 6";} 

in the template where I want the info to be shown work?

Marco van Herwaarden 09-01-2008 06:18 AM

You can not use PHP in templates (HTML only).

But you can use a conditional:
HTML Code:

<if condition="is_member_of($bbuserinfo,x)">
 Stuff for members of usergroup x
</if>


G_Gekko 09-01-2008 07:14 AM

So I simply replace the x with the usergroup #?

What if I want an else statement ?

Marco van Herwaarden 09-01-2008 07:18 AM

Yes the x should be replaced by the usergroupid.

You can add a <else />.

Opserty 09-01-2008 08:08 AM

<a href="http://www.vbulletin.com/docs/html/main/template_conditionals" target="_blank">Template Conditionals</a>

G_Gekko 09-01-2008 12:05 PM

Thanks for the link and the help.

One more question. Is it possible to get the content in
PHP Code:

<if condition="is_member_of($bbuserinfo,x)">
 
Stuff for members of usergroup x
</if> 

To be shown to the user only once a day

Opserty 09-01-2008 01:33 PM

Anything is possible, it could be done. But would probably require a lot more work then a template edit, the exact nature of which I'm not sure.

G_Gekko 09-01-2008 02:11 PM

Ok. In that case. Is there a way I can show the content on the index page only by editing the template.

PS thanks to both of you for helping me.

Opserty 09-01-2008 03:02 PM

Have you looked into maybe using the "Notices" feature?

G_Gekko 09-01-2008 03:49 PM

Yes but it doesn´t do what I want.


All times are GMT. The time now is 07:11 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.01128 seconds
  • Memory Usage 1,727KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete