Announcement

Collapse
No announcement yet.

Check usergroup within widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Check usergroup within widget

    How would I go about checking a user's usergroup within a widget?

    Trying to:

    if this usergroup, then show this.
    else, then show this.

  • #2
    Did you just try using is_member_of like you normally would (only with widget syntax)?

    PHP Code:
    if (is_member_of(vB::$vbulletin->userinfoxyz))
    {
    stuff
    }
    else
    {
    other stuff


    Please don't PM or VM me for support - I only help out in the threads.
    vBulletin Manual & vBulletin 4.0 Code Documentation (API)
    Want help modifying your vbulletin forum? Head on over to vbulletin.org
    If I post CSS and you don't know where it goes, throw it into the additional.css template.

    W3Schools <- awesome site for html/css help

    Comment


    • #3
      Does x, y, z represent the usergroups that I want to check for?

      edit: yes it does
      reference: http://members.vbulletin.com/api/vBu...tions.php.html

      Comment


      • #4
        Hmm, what widget type should I put the code in? It does not seem to be working for a 'Static HTML' widget.

        My code:
        PHP Code:
        <div class="gxglive_chat">
                <?php
                
        if (is_member_of(vB::$vbulletin->userinfo1) { ?>
                <div class="standard_error">
                    <h2 class="blockhead">Please Login to Chat</h2>
                    <div class="blockbody formcontrols">
                        <div class="blockrow restore">
                            <h3>Sign-in Above to Enter Chatroom!</h3>
                            <p>Please login above and you will be sent to your chatroom.</p>
                            <h3>Not a GenXGlow Member? <a href="http://www.genxglow.com/register.php">Please Register...</a></h3>
                            <p>You must be a GenXGlow member to participate in our chatroom. If you would like to chat, <a href="http://www.genxglow.com/register.php">you will need to register</a>! Creating an account only takes 40 seconds!
                        </div>
                    </div>
                </div>
                <?php } else { ?>
                    <iframe style="border: 0px" width="100%" height="600" src="/flashchat/flashchat.php?username=_int_&room=9"></iframe>
                <?php ?>
            </div>
        edit: 'PHP Direct Execution' widget type did not work with the above code either.

        Comment

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