XF 2.0 Show Staff Bar to Registered Members also

[xFv]

Well-known member
Hello!
I am working on a project and it requires to have the staff bar show to registered members without the admin and mod links.
I realize this is a permission issue, but I cannot for the life of me figure out a way to achieve this.
If anybody could chime in on this, that would be great!
Thank You..
 
Look at PAGE_CONTAINER template, you can add some extra conditions and elements to show staff bar to normal users
Till this day I am still unable to figure this out.

Here is what I am playing with...
PHP:
<xf:if is="$xf.visitor.user_id">

<xf:if contentcheck="true">
    <div class="p-staffBar">
        <div class="p-staffBar-inner hScroller" data-xf-init="h-scroller">
            <div class="hScroller-scroll">
            <xf:contentcheck>
                <xf:if is="$xf.visitor.is_moderator && $xf.session.unapprovedCounts.total">
                    <a href="{{ link('approval-queue') }}" class="p-staffBar-link badgeContainer badgeContainer--highlighted" data-badge="{$xf.session.unapprovedCounts.total|number}">
                        {{ phrase('approval_queue') }}
                    </a>
                </xf:if>

                <xf:if is="$xf.visitor.is_moderator && !$xf.options.reportIntoForumId && $xf.session.reportCounts.total">
                    <a href="{{ link('reports') }}"
                        class="p-staffBar-link badgeContainer badgeContainer--visible {{ ($xf.session.reportCounts.total && ($xf.session.reportCounts.lastBuilt > $xf.session.reportLastRead) OR $xf.session.reportCounts.assigned) ? ' badgeContainer--highlighted' : '' }}"
                        data-badge="{{ $xf.session.reportCounts.assigned ? $xf.session.reportCounts.assigned|number . ' / ' . $xf.session.reportCounts.total|number : $xf.session.reportCounts.total|number }}"
                        title="{{ $xf.session.reportCounts.lastBuilt ? phrase('last_report_update:') . ' ' . date_time($xf.session.reportCounts.lastBuilt) : '' }}">
                        {{ phrase('reports') }}
                    </a>
                </xf:if>

                <xf:if contentcheck="true">
                    <a class="p-staffBar-link menuTrigger" data-xf-click="menu" data-xf-key="alt+m" role="button" tabindex="0" aria-expanded="false" aria-haspopup="true">{{ phrase('moderator') }}</a>
                    <div class="menu" data-menu="menu" aria-hidden="true">
                        <div class="menu-content">
                            <h4 class="menu-header">{{ phrase('moderator_tools') }}</h4>
                            <xf:contentcheck>
                            <!--[XF:mod_tools_menu:top]-->
                            <xf:if is="$xf.visitor.is_moderator">
                                <a href="{{ link('approval-queue') }}" class="menu-linkRow">{{ phrase('approval_queue') }}</a>
                            </xf:if>
                            <xf:if is="$xf.visitor.is_moderator && !$xf.options.reportIntoForumId">
                                <a href="{{ link('reports') }}" class="menu-linkRow" title="{{ $xf.session.reportCounts.lastBuilt ? phrase('last_report_update:') . ' ' . date_time($xf.session.reportCounts.lastBuilt) : '' }}">{{ phrase('reports') }}</a>
                            </xf:if>
                            <!--[XF:mod_tools_menu:bottom]-->
                            </xf:contentcheck>
                        </div>
                    </div>
                </xf:if>

                <xf:if is="$xf.visitor.is_admin">
                    <a href="{{ base_url('admin.php') }}" class="p-staffBar-link" target="_blank">{{ phrase('admin') }}</a>
                </xf:if>
            </xf:contentcheck>
            </div>
        </div>
    </div>
</xf:if>

</xf:if>

I tried placing the member syntax at the very top like this example, and other loactions also, but cannot figure it out.
 
You must add it after the first <xf:contentcheck> tag
Rich (BB code):
<xf:if contentcheck="true">
    <div class="p-staffBar">
        <div class="p-staffBar-inner hScroller" data-xf-init="h-scroller">
            <div class="hScroller-scroll">
            <xf:contentcheck>
                <xf:if is="$xf.visitor.user_id">
                    Hello :)
                </xf:if>
                <xf:if is="$xf.visitor.is_moderator && $xf.session.unapprovedCounts.total">
                    <a href="{{ link('approval-queue') }}" class="p-staffBar-link badgeContainer badgeContainer--highlighted" data-badge="{$xf.session.unapprovedCounts.total|number}">
                        {{ phrase('approval_queue') }}
                    </a>
                </xf:if>

                <xf:if is="$xf.visitor.is_moderator && !$xf.options.reportIntoForumId && $xf.session.reportCounts.total">
                    <a href="{{ link('reports') }}"
                        class="p-staffBar-link badgeContainer badgeContainer--visible {{ ($xf.session.reportCounts.total && ($xf.session.reportCounts.lastBuilt > $xf.session.reportLastRead) OR $xf.session.reportCounts.assigned) ? ' badgeContainer--highlighted' : '' }}"
                        data-badge="{{ $xf.session.reportCounts.assigned ? $xf.session.reportCounts.assigned|number . ' / ' . $xf.session.reportCounts.total|number : $xf.session.reportCounts.total|number }}"
                        title="{{ $xf.session.reportCounts.lastBuilt ? phrase('last_report_update:') . ' ' . date_time($xf.session.reportCounts.lastBuilt) : '' }}">
                        {{ phrase('reports') }}
                    </a>
                </xf:if>

                <xf:if contentcheck="true">
                    <a class="p-staffBar-link menuTrigger" data-xf-click="menu" data-xf-key="alt+m" role="button" tabindex="0" aria-expanded="false" aria-haspopup="true">{{ phrase('moderator') }}</a>
                    <div class="menu" data-menu="menu" aria-hidden="true">
                        <div class="menu-content">
                            <h4 class="menu-header">{{ phrase('moderator_tools') }}</h4>
                            <xf:contentcheck>
                            <!--[XF:mod_tools_menu:top]-->
                            <xf:if is="$xf.visitor.is_moderator">
                                <a href="{{ link('approval-queue') }}" class="menu-linkRow">{{ phrase('approval_queue') }}</a>
                            </xf:if>
                            <xf:if is="$xf.visitor.is_moderator && !$xf.options.reportIntoForumId">
                                <a href="{{ link('reports') }}" class="menu-linkRow" title="{{ $xf.session.reportCounts.lastBuilt ? phrase('last_report_update:') . ' ' . date_time($xf.session.reportCounts.lastBuilt) : '' }}">{{ phrase('reports') }}</a>
                            </xf:if>
                            <!--[XF:mod_tools_menu:bottom]-->
                            </xf:contentcheck>
                        </div>
                    </div>
                </xf:if>

                <xf:if is="$xf.visitor.is_admin">
                    <a href="{{ base_url('admin.php') }}" class="p-staffBar-link" target="_blank">{{ phrase('admin') }}</a>
                </xf:if>
            </xf:contentcheck>
            </div>
        </div>
    </div>
</xf:if>
1515853124604.webp
 
This is how I was to get it to show finally.
<xf:if is="$xf.visitor.user_id OR !$xf.visitor.user_id]">

Thank You @DL6 for the help on figuring this out.
 
Last edited:
Back
Top Bottom