vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Widget display to certain usergroups only (https://vborg.vbsupport.ru/showthread.php?t=253093)

Ninos 11-03-2010 02:57 PM

Widget display to certain usergroups only
 
I have searched but I cannot seem to find the mod I am looking for.

At the moment, if a widget is created it is displayed to every usergroup. You cannot change this. I want to be able to restrict the widget to certain usergroups (in my case: [if guest] display widget [if not] do not display widget)

Surely this is a simple thing to do? Isn't there some code I can add somewhere?? Can anyone give me advice/the correct code on how to do this?

All help greatly appreciated! Thanks!

Ninos 11-04-2010 09:48 PM

bump

Lynne 11-04-2010 10:00 PM

Just use your own template (enter it in the configure screen) and put a condition around it so it only shows to guests (or whoever).

Ninos 11-05-2010 09:16 PM

Thanks for your answer Lynne!

Can you help me out with the code however?

I'd like to do the following if possible:
- Let me just briefly explain what the widget is so you understand my intentions. It is a HTML widget that displays an image and text that prompts guests to register.
- I'd like to display it ONLY to the guest usergroup
- When logged in, the content should change to a prompt (again custom text/image in html form) that prompts regular users to upgrade to a paid subscription
- If the user is already in the paid subscription usergroup the widget shouldn't display.

Is that possible? I'm thinking something like:

"if usergroup (guest_usergroup_id) display <CODE>; if usergroup (all_usergoups_except_guest) display <CODE>; if usergroup (subscribed_usergroup_id) hide"

I don't know much about php/the inner workings of vBulletin so I hope that makes sense and something similar can be achieved.

If not possible, I suppose I'd just create 2 SEPERATE widgets:
- The register prompt widget: displays only to guests
- The upgrade account prompt: displays all groups apart from the subcribed group

Thanks for your help so far :)

Lynne 11-06-2010 12:07 AM

I don't know which method would work best. I think you'd have to see which is easier for you to do. I'd probably go for the two separate widgets each with custom templates and a condition around that template:
Template 1:
HTML Code:

<vb:if condition="$show['guest']">stuff</vb:if>
and Template 2:
HTML Code:

<vb:if condition="$show['member'] AND !is_member_of($bbuserinfo, x)">stuff</vb:if>
I would guess that would work but I've never tried something like that.

sportsfroma2 01-08-2011 03:34 PM

Hi, sorry for the n00bish question, but on a related note- if someone wanted to make a widget appear for all except a certain usergroup, what would be the correct code?

thanks

Lynne 01-08-2011 04:35 PM

Quote:

Originally Posted by sportsfroma2 (Post 2146009)
Hi, sorry for the n00bish question, but on a related note- if someone wanted to make a widget appear for all except a certain usergroup, what would be the correct code?

thanks

vB4 Template Conditionals List

charlesr 07-13-2012 09:00 PM

Just to say I found the info in this thread useful. Cheers.
It wouldn't let me "like" the posts (too old?), so thought it worth posting to say thanks properly.


All times are GMT. The time now is 11:31 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.01628 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
  • (2)bbcode_html_printable
  • (1)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