is_member_of

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gbrain
    Member
    • Jan 2006
    • 30
    • 5.1.x

    is_member_of

    Hi, within the VB structure you can use the following.

    <if condition="is_member_of($bbuserinfo, 5, 6)">
    button code
    </if>

    But is there a way to call the is_member_of from within a PHP page as a function
    PHP Code:
    <?
    if ($is_member_of($vbulletin->userinfo['membergroupids'], 1)
    {
     echo 
    "test";
    }
    ?>
    thanks

    Gary
  • SNN
    Senior Member
    • Jul 2006
    • 856
    • 4.0.0

    #2
    (Just a note, the more appropriate place is either the HTML/PHP questions, or vBulletin.org)

    Yes, you can use is_member_of() from a PHP page, but it's:
    PHP Code:
    <?php
    if(is_member_of($vbulletin->userinfo56) {
      print 
    "You are in usergroup five or six!";
    }
    ?>

    Comment

    • gbrain
      Member
      • Jan 2006
      • 30
      • 5.1.x

      #3
      Hi, noted.

      But for me that does not work.

      <? if (is_member_of($vbulletin->userinfo, 20)) { ?>

      I currently use so I know I can read the VB variables.

      <? if ($vbulletin->userinfo['membergroupids'] == 20) { ?>

      will do so more digging.


      Thanks anyway.

      G.


      [update] dont know why but it started to work very strange. thanks again.
      Last edited by gbrain; Wed 27 May '09, 4:56am.

      Comment

      • SNN
        Senior Member
        • Jul 2006
        • 856
        • 4.0.0

        #4
        I would guess the problem started when you had a '$' before the function name :P no problems.

        Comment

        • Wayne Luke
          vBulletin Technical Support Lead
          • Aug 2000
          • 74078

          #5
          Your second if conditional would fail if a user had more than one secondary usergroup and doesn't check to see if their primary usergroup is 20. If a user is in multiple secondary usergroups, membergroupids becomes a comma delimited string.

          I know you got is_member_of working, but I wanted to point that at.
          Translations provided by Google.

          Wayne Luke
          The Rabid Badger - a vBulletin Cloud demonstration site.
          vBulletin 5 API

          Comment

          • gbrain
            Member
            • Jan 2006
            • 30
            • 5.1.x

            #6
            Originally posted by Wayne Luke
            Your second if conditional would fail if a user had more than one secondary usergroup and doesn't check to see if their primary usergroup is 20. If a user is in multiple secondary usergroups, membergroupids becomes a comma delimited string.

            I know you got is_member_of working, but I wanted to point that at.
            Hi thanks for the comments and yes it would which is why I was looking to get the is_member working.

            And yes SNN It was the $ and I was using userinfo['membergroupids']

            Cheers again

            G.

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...