vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Show code in theme based on profile option? (https://vborg.vbsupport.ru/showthread.php?t=272454)

Bomyne 10-21-2011 01:15 AM

Show code in theme based on profile option?
 
I'm trying to make something on my siite disabled based on a profile option? I hard coded the item into the theme.

Also, is there a way to do this via which usergroup they are in?

kh99 10-22-2011 12:16 AM

I'm not sure what you mean by "hardcoded". If you're using templates, you should be able to put the code for the stuff you want disabled in an "if" tag, like:

Code:

<vb:if condition="$bbuserinfo[fieldX] == 'something'">
// code for feature
</vb:if>


or to do it by usergroup

Code:

<vb:if condition="!is_member_of($bbuserinfo, X)">
// code for feature
</vb:if>


Of course you need to change the X's and 'something' to the appropriate values.

Bomyne 10-24-2011 05:15 AM

Thanks. It works perfectly.

On a variation on the second code you gave, is there a way to add that to the postbit template to show a special image or title if the user is in this usergroup?

kh99 10-24-2011 10:31 AM

Quote:

Originally Posted by Bomyne (Post 2260813)
... is there a way to add that to the postbit template to show a special image or title if the user is in this usergroup?


Yes, just edit the postbit or postbit_legacy template and add something like:

Code:

<vb:if condition="is_member_of($bbuserinfo, X)">
// code for image
</vb:if>


By the way, you can include more than one usergroup if you want, by listing the ids, like:

Code:

<vb:if condition="is_member_of($bbuserinfo, 5, 6, 7)">
...


Bomyne 10-25-2011 01:35 AM

Quote:

Originally Posted by kh99 (Post 2260888)
Yes, just edit the postbit or postbit_legacy template and add something like:

Code:

<vb:if condition="is_member_of($bbuserinfo, X)">
// code for image
</vb:if>


By the way, you can include more than one usergroup if you want, by listing the ids, like:

Code:

<vb:if condition="is_member_of($bbuserinfo, 5, 6, 7)">
...


Does that work based on the viewer or the poster?

Basically what i've done is set up a supporter system. Those that donate have the ads disabled (Which is thanks to the second code block in the first post) now i want to add a badge to that users posts to aknowdge they are a supporter. The subscription system adds them to group 12.

kh99 10-25-2011 01:56 AM

Oh right, that would be the viewer. I should have realized if you wanted it in the postbit you probably wanted the poster. In that case just replace $bbuserinfo with $post.

Code:

<vb:if condition="is_member_of($post, X)">
// code for image
</vb:if>


Bomyne 10-25-2011 03:49 AM

Thanks! Works great.


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