Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2013, 11:12 PM
CoffeeLovesYou CoffeeLovesYou is offline
 
Join Date: Feb 2010
Posts: 176
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default If moderator of forum, etc etc

Hello,
I have a quick question about an if conditional.
I know a forum that has moderators of individual categories. Here's an example.
There's a Music category, and a Television category. Jimmy is a moderator of the Music category, so when he posts in the Music category, his name shows up in a Green color (or any color). Now, there's Bob, who is a moderator of the Television category. When he posts in the Television category, his name also shows up Green (or any other color). Now, if Bob posts in the Music Area, or vice-versa, their name will not show up green because they aren't a moderator of that particular forum.

I am trying this code;
HTML Code:
<if condition="can_moderate($forum['forumid'])">
stuff here
</if>
However, what is happening is.. every person is getting the "stuff here" part! I don't think the can_moderate condition is working. I am trying to use it in my postbit template. There are users who aren't a moderator of the current forum they posted in, and it shows the code i put in the if conditional in their post.
Reply With Quote
  #2  
Old 02-15-2013, 05:37 PM
glennybee glennybee is offline
 
Join Date: Feb 2008
Location: Scotland
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this...

Code:
<if condition="can_moderate($foruminfo['forumid'] !==  X)">
stuff here
</if>
Reply With Quote
  #3  
Old 02-16-2013, 02:48 AM
CoffeeLovesYou CoffeeLovesYou is offline
 
Join Date: Feb 2010
Posts: 176
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, here is the thing. It is much much easier to use an if conditional where I don't have to enter each forum ID. We have over 25 diff forums where there are diff users as moderators of that forum, henceforth that would be a really long code where it is possible to use the if condition I am seeking. But thank you though. If no one can tell me if my if condition is correct and/or why it isn't working in the postbit template, I'll try to use yours.
Reply With Quote
  #4  
Old 02-16-2013, 03:01 AM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you tried "is_moderator?"

Everyone can moderate - their own posts. But not everyone is a moderator.

Perhaps, "is_usergroupID?"
Reply With Quote
  #5  
Old 02-16-2013, 05:53 AM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CoffeeLovesYou View Post
Hello,
I have a quick question about an if conditional.
I know a forum that has moderators of individual categories. Here's an example.
There's a Music category, and a Television category. Jimmy is a moderator of the Music category, so when he posts in the Music category, his name shows up in a Green color (or any color). Now, there's Bob, who is a moderator of the Television category. When he posts in the Television category, his name also shows up Green (or any other color). Now, if Bob posts in the Music Area, or vice-versa, their name will not show up green because they aren't a moderator of that particular forum.

I am trying this code;
HTML Code:
<if condition="can_moderate($forum['forumid'])">
stuff here
</if>
However, what is happening is.. every person is getting the "stuff here" part! I don't think the can_moderate condition is working. I am trying to use it in my postbit template. There are users who aren't a moderator of the current forum they posted in, and it shows the code i put in the if conditional in their post.
This isn't working the way you want because can_moderate displays the information to the person with moderator permissions. You only use this when you want the moderators of that forum to see something you don't want others to see. I don't believe there is an is_moderator conditional or equivalent. The only way I can think to really do this would be to use a combination of user ID and forum ID.
Reply With Quote
  #6  
Old 02-16-2013, 12:41 PM
CoffeeLovesYou CoffeeLovesYou is offline
 
Join Date: Feb 2010
Posts: 176
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

--------------- Added [DATE]1361049497[/DATE] at [TIME]1361049497[/TIME] ---------------

Okay, I kind of figured out why.
My if condition was saying that, if the user moderated the forum and the user is apart of the usergroup IDs I specified, they could see the code. I needed it so if the user moderated the current forum and the user who moderates that forum is a member of the usergroup ID I specified, then they get the code shown in their post and is visible to everyone else.

My friend helped me get to this code;

HTML Code:
<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid]) AND is_member_of($userinfo, 7,47)">
<div class="smallfont"><b><big>{$GLOBALS['foruminfo']['title']}Leader</big></b></div></if> <else />
<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid]) AND is_member_of($userinfo, 5,55)">
<div class="smallfont"><b><big>{$GLOBALS['foruminfo']['title']} Moderator</big></b></div>
</if>
But it isn't working for me, yet it's working for him..
Reply With Quote
  #7  
Old 02-17-2013, 01:19 AM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CoffeeLovesYou View Post
Well, thanks to the help with someone who also has experience with this, this is working;

HTML Code:
<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid])">
Code
</if>
However, I am trying to combine this code with 1 more if condition, and 2 more.

HTML Code:
<if condition="$thread['postuserid'] == $post['userid']"><div class="smallfont"><b><big>Original Poster</big></b></div><else />
<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid]) AND $thread['postuserid'] == $post['userid'] AND is_member_of($bbuserinfo, 7,47)">
<div class="smallfont"><b><big>$GLOBALS[foruminfo][title] Leader & Original Poster</big></b></div><else />
<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid]) AND $thread['postuserid'] == $post['userid']">
<div class="smallfont"><b><big>$GLOBALS[foruminfo][title] Moderator & Original Poster</big></b></div>
</if></if></if>
^^ Does anyone see what is wrong with this?
When I just had..
HTML Code:
<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid])">
Code
</if>
..it was working. Now that I combined it with the if original poster and if member of, it isn't working. Same with the other if condition, now that I combined it with original poster.

--------------- Added [DATE]1361049497[/DATE] at [TIME]1361049497[/TIME] ---------------

Okay, I kind of figured out why.
My if condition was saying that, if the user moderated the forum and the user is apart of the usergroup IDs I specified, they could see the code. I needed it so if the user moderated the current forum and the user who moderates that forum is a member of the usergroup ID I specified, then they get the code shown in their post and is visible to everyone else.

My friend helped me get to this code;

HTML Code:
<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid]) AND is_member_of($userinfo, 7,47)">
<div class="smallfont"><b><big>{$GLOBALS['foruminfo']['title']}Leader</big></b></div></if> <else />
<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid]) AND is_member_of($userinfo, 5,55)">
<div class="smallfont"><b><big>{$GLOBALS['foruminfo']['title']} Moderator</big></b></div>
</if>
But it isn't working for me, yet it's working for him..
Interesting. I had not seen $globals used that way before, surprisingly.

First off, let's narrow down what you're trying to do. Because the first code you posted (which I spent a couple of hours trying to figure out earlier today) isn't doing the same thing that you're trying to do now. In the first post you seem to only want to show code that displayed Thread Starter, Thread Starter & Moderator and Thread Starter & Leader (which I'm assuming was groups 7 and 47). Now you seem to only want to demarcate Moderators from Leaders, with no regard for thread starter. Let's pick one of those and go with it, because the code would be different depending on which you're trying to accomplish.
Reply With Quote
  #8  
Old 02-17-2013, 01:54 AM
CoffeeLovesYou CoffeeLovesYou is offline
 
Join Date: Feb 2010
Posts: 176
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Disregard the old code, and look at the new code I just posted
The old code, I was combining it with the Original Posting modification I had in place. Disregard it.
Here is the CURRENT code I'm trying;
HTML Code:
<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid]) AND is_member_of($userinfo, 96)">
<div class="smallfont"><b><big>{$GLOBALS['foruminfo']['title']} Leader</big></b></div></if> <else />
<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid]) AND is_member_of($userinfo, 95)">
<div class="smallfont"><b><big>{$GLOBALS['foruminfo']['title']} Moderator</big></b></div>
</if>
Here is how the if condition is SUPPOSED to work;

If the user who posted a reply/thread is a moderator of the forum they posted it in AND that user who posted is a member of usergroup ID 96, it shows you the code provided. Else, if the user who posted a reply/thread is a moderator of the forum they posted in AND that user who posted is a member of the usergroup ID 95, it shows you the code provided.
Now, before, I was using 4 usergroup IDs (in my old post), however, my friend said that this was only working with usergroups that aren't set as 'primary' for that person, so I made 2 usergroups (IDs 95 and 96) that I added the users to as one of their additional usergroups, however, it still isn't working, yet it's working for him.
Reply With Quote
  #9  
Old 02-17-2013, 06:05 PM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't think it should matter whether the usergroup is primary or not, but for the postbit templates, you'll want to use is_member_of($post, X), where X is the usergroup ID. Also, the <else /> statement is only used inside an if conditional, so it's not really needed, nor does it do anything here.

HTML Code:
<!-- Has to have moderator permissions AND be a member of Usergroup 96 -->

<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid]) AND is_member_of($post, 96)">
   <div class="new_class_name">{$GLOBALS['foruminfo']['title']} Leader</div>
</if>

<!-- Has to have moderator permissions AND be a member of Usergroup 95 -->

<if condition="can_moderate($GLOBALS[forumid], 0, $post[userid]) AND is_member_of($post, 95)">
<div class="new_class_name">{$GLOBALS['foruminfo']['title']} Moderator</div>
</if>
The only reason you might need an <else /> here, is in the event both of these might be true (the user has mod permissions and belongs to both usergroups). But that would have to be written a bit differently, depending on your needs.

I would also recommend not using <big> tags here. One, because it's not really modern HTML anymore, and two, because the smallfont class and <big> would probably be fighting each other and not really displaying properly. I would suggest putting your own CSS in the Additional CSS options of your skin and use that class name for the div here.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:27 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07237 seconds
  • Memory Usage 2,274KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (9)bbcode_html
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete