vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   If conditional help (https://vborg.vbsupport.ru/showthread.php?t=89714)

Jolten 08-29-2004 12:56 AM

If conditional help
 
Hi,

I'm tryign to write an if conditional in the Member info template which will display information to a user if it's thier profile page and to all admins.

I can work out the user conditional with this:

<if condition="$bbuserinfo[userid] == $userinfo[userid]">
Stuff
</if>

But I can't figure out how to add the condistion that if the browser is an admin they see the information as well.

I know I can use
<if condition="$bbuserinfo[usergroup] == 6">
Stuff
</if>

To display to admins.
But how do I get both conditionals to work for the same information. Currently admins get shut out becasue they don't meet the first condition or users get shut out because they don't meet the second condition.

Any help would be greatly appreciate.

Thanks.

defi 08-29-2004 04:08 AM

Try...

Code:

<if condition="!is_member_of($bbuserinfo, 2) AND !is_member_of($bbuserinfo, 6) ">
  <!-- Content :) -->
  <!-- /Content -->
  </if>

replace the italicized numbers with the usergroup id('s)

Jolten 08-29-2004 04:57 AM

Thanks for the suggestions Jonathan.
Sorry, that won't work.

(yes I caught the typo in "condition" too)

What I want is to display information to $bbuserinfo[userid] == $userinfo[userid] and $bbuserinfo[usergroup] == 6 only.

The statement you've written appears like it would only show information if a user was a member of usergroup 2 and usergroup 6. I don't have any admins that are also in the registered users usergroup. In addition I have users that aren't in usergroup 2 and I need the information to only display to the single user, not all members of a usergroup. <if condition="$bbuserinfo[userid] == $userinfo[userid]"> works for the single users I just need to add the ability for admins to see this too.

Since my super admins are users 1 and 2 I can set this:
<if condition="($bbuserinfo[userid] == $userinfo[userid]) or ($bbuserinfo[userid] < 3)">
And it works. I just can't seem to set the admin usergroup and make it work.

At any rate, it's not working.

Anyone with any other suggestions?

defi 08-29-2004 05:50 AM

What typo? I see no typo!? :p (Thanks for the catch)

You need to adjust the numbers I gave you and it'll work. You can add more also to that by just adding more AND's... I don't see why this wouldn't work.

Anyways, you should ask this over at vb.org

Jolten 08-29-2004 05:56 AM

It doesn't work Jonathan. And again... I don't want to call usergroups other than the admin usergroup. I want to use a single userid and the admin usergroup. In any case it would need to be OR instead of AND because no one is going to be a member of both usergroups.

I've got it patched with <if condition="($bbuserinfo[userid] == $userinfo[userid]) or ($bbuserinfo[userid] < 3)"> for now. But if anyone knows how to replace $bbuserinfo[userid] < 3 with $bbuserinfo[usergroup] == 6, I'd appreciate it.

House_of_Crazed 08-29-2004 07:15 AM

That should work, actually.

Let me go and look in my code and see if I can supply you with the necessary code.

HoC

House_of_Crazed 08-29-2004 07:23 AM

Yep, why are you using is_member_of ??

Try this

Code:

<if condition="$bbuserinfo['usergroupid'] == '6'"> your code here </if>
HoC

defi 08-29-2004 02:06 PM

Alright well it worked for my needs at my boards, so okay. You're still better off at vb.org

Jolten 08-29-2004 05:26 PM

It's a template mod. It doesn't belong at vb.org.

And yeah $bbuserinfo[usergroup]== 6 does work by itself. But
<if condition="($bbuserinfo[userid] == $userinfo[userid]) or ($bbuserinfo[usergroup] == 6)">Stuff</if> won't work when they are in the same conditional.

Jolten 09-04-2004 06:32 PM

I got it sorted. I had a couple characters missing.

<if condition="($bbuserinfo[userid] == $userinfo[userid]) || ($bbuserinfo[usergroupid] == 6)">Stuff</if>

Works


All times are GMT. The time now is 05:00 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.01254 seconds
  • Memory Usage 1,735KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete