Need help with vBulletin style tags

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Krave
    New Member
    • Aug 2014
    • 4
    • 4.2.x

    [vB4] Need help with vBulletin style tags

    Hello,
    I'm currently 'trying' to create a new theme and I'm starting with the header. Within the header, I've added the login/register link but I don't fully understand these:
    HTML Code:
    <vb:if condition="$show['member']">
    </vb:if>
    
    <vb:if condition="$show['guest']">
    </vb:if>
    I thought it would be as easy as wrapping the profile and the login parts with these tags (as seen in the code below) but I've obviously misunderstood. If someone could take a look at the code below and point me in the right direction, that'd be awesome!

    My code:
    HTML Code:
    <vb:if condition="$show['member']">
        <li class="dropdown active userinfo-carat" style="float: right;">
        <a href="{vb:link member, {vb:raw bbuserinfo}}" style="padding-right: 0px;" class="dropdown-toggle">{vb:raw bbuserinfo.username}</a>
            <ul class="dropdown-menu" style="left: -52px;" role="menu">
            <center>
                <img class="img-circle" src="{vb:raw avatarurl}" alt="{vb:raw bbuserinfo.username}" style="width: 80px; height: 100px; padding-top: 10px; padding-bottom: 10px; margin-left: 40px; margin-right: 40px;" title="{vb:raw bbuserinfo.username}">
            </center>
            <li class="divider"></li>
            <li><a href="{vb:link member, {vb:raw bbuserinfo}}">Profile</a></li>
            <li><a href="usercp.php{vb:raw session.sessionurl_q}">Control Panel</a></li>
            <li><a rel="nofollow" href="login.php?{vb:raw session.sessionurl}do=logout&amp;logouthash={vb:raw bbuserinfo.logouthash}">Logout</a></li>
            </ul>
        </li>
    </vb:if>
    
    <vb:else />
    
    <vb:if condition="$show['guest']">
        <li class="dropdown active" style="float: right;">
        <a href="#" style="padding-right: 0px;" class="dropdown-toggle" data-toggle="dropdown">Login / Register</a>
        <ul class="dropdown-menu" style="left: -10%" role="menu">
        <li><script type="text/javascript" src="clientscript/vbulletin_md5.js?v={vb:raw vboptions.simpleversion}"></script>
        <form style="margin-top: 10px; margin-left: 10px; margin-right: -5px;" class="form-horizontal" id="navbar_loginform" action="login.php?{vb:raw session.sessionurl}do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, {vb:raw show.nopasswordempty})">
                                <div class="form-group">
                                    <div class="col-sm-11">
                                        <input type="text" class="form-control<vb:if condition="!$username"> default-value</vb:if>" id="username" placeholder="username" accesskey="u" name="vb_login_username">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-11">
                                        <input type="password" class="form-control" id="password" placeholder="password" name="vb_login_password">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-11">
                                        <button type="submit" class="btn btn-primary btn-block" name="submit" accesskey="s">Sign in</button>
                                    </div>
                                </div>
        <input type="hidden" name="s" value="{vb:raw session.sessionhash}">
        <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}">
        <input type="hidden" name="cookieuser" value="1">
        <input type="hidden" name="do" value="login">
        <input type="hidden" name="vb_login_md5password">
        <input type="hidden" name="vb_login_md5password_utf">
                            </form>
        <script type="text/javascript">
                    YAHOO.util.Dom.setStyle('navbar_password_hint', "display", "inline");
                    YAHOO.util.Dom.setStyle('navbar_password', "display", "none");
                    vB_XHTML_Ready.subscribe(function()
                    {
                    //
                        YAHOO.util.Event.on('navbar_username', "focus", navbar_username_focus);
                        YAHOO.util.Event.on('navbar_username', "blur", navbar_username_blur);
                        YAHOO.util.Event.on('navbar_password_hint', "focus", navbar_password_hint);
                        YAHOO.util.Event.on('navbar_password', "blur", navbar_password);
                    });
                    
                    function navbar_username_focus(e)
                    {
                    //
                        var textbox = YAHOO.util.Event.getTarget(e);
                        if (textbox.value == '<vb:if condition="$username">{vb:raw username}<vb:else />{vb:rawphrase username}</vb:if>')
                        {
                        //
                            textbox.value='';
                            textbox.style.color='{vb:stylevar input_color}';
                        }
                    }
    
                    function navbar_username_blur(e)
                    {
                    //
                        var textbox = YAHOO.util.Event.getTarget(e);
                        if (textbox.value == '')
                        {
                        //
                            textbox.value='<vb:if condition="$username">{vb:raw username}<vb:else />{vb:rawphrase username}</vb:if>';
                            textbox.style.color='{vb:stylevar shade_color}';
                        }
                    }
                    
                    function navbar_password_hint(e)
                    {
                    //
                        var textbox = YAHOO.util.Event.getTarget(e);
                        
                        YAHOO.util.Dom.setStyle('navbar_password_hint', "display", "none");
                        YAHOO.util.Dom.setStyle('navbar_password', "display", "inline");
                        YAHOO.util.Dom.get('navbar_password').focus();
                    }
    
                    function navbar_password(e)
                    {
                    //
                        var textbox = YAHOO.util.Event.getTarget(e);
                        
                        if (textbox.value == '')
                        {
                            YAHOO.util.Dom.setStyle('navbar_password_hint', "display", "inline");
                            YAHOO.util.Dom.setStyle('navbar_password', "display", "none");
                        }
                    }
                    </script>
                        </li>
                        <li class="divider"></li>
                        <li class="dropdown-header">Can't login?</li>
                        <li><a href="login.php?do=lostpw">Reset Password</a></li>
                        <li class="divider"></li>
                        <li class="dropdown-header">New here?</li>
                        <li><a href="/forums/register.php">Register</a></li>
    
                </ul>
              </li></ul></div>
            </div>
            <!-- Bootstrap core JavaScript
            ================================================== -->
            <!-- Placed at the end of the document so the pages load faster -->
            <script src="/EE/scripts/bootstrap.min.js"></script>
        </div>
    </vb:if>
  • starme
    Senior Member
    • Aug 2011
    • 111
    • 4.1.x

    #2
    These are vbulletin conditionals.

    <vb:if condition="$show['member']">
    INSERT HERE THE CODES YOU WANT TO SHOW ONLY TO LOGGED-IN MEMBERS
    </vb:if>

    <vb:if condition="$show['guest']">
    INSERT HERE THE CODES YOU WANT TO SHOW ONLY TO GUESTS
    </vb:if>

    Comment

    • Krave
      New Member
      • Aug 2014
      • 4
      • 4.2.x

      #3
      Originally posted by starme
      These are vbulletin conditionals.

      <vb:if condition="$show['member']">
      INSERT HERE THE CODES YOU WANT TO SHOW ONLY TO LOGGED-IN MEMBERS
      </vb:if>

      <vb:if condition="$show['guest']">
      INSERT HERE THE CODES YOU WANT TO SHOW ONLY TO GUESTS
      </vb:if>
      Hi,
      I understand this part but my code is not working. I'm wondering if I've used them right or is there more?

      Comment

      • Krave
        New Member
        • Aug 2014
        • 4
        • 4.2.x

        #4
        Sorted my issue, turns out I was using them right, but the code had a syntax error :3 ... oops

        Comment

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