Redirect in header for everyone except admin

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Xyabber
    Senior Member
    • Dec 2004
    • 219

    Redirect in header for everyone except admin

    I need to know how to redirect everybody from my site to a 'under construction' page while I do a massive upgrade. I do not want the 'site closed' message because it will show the new header.

    So I was thinking about a conditional in the header or maybe headerinclude template that would check if not a member OR if member does not equal admin, then redirect using exec_header_redirect possibly.

    Would this work? What code should I use exactly?
    Will I still be able to log in to admin panel if I log out?

    Thanks in advance
  • icarusforde
    Senior Member
    • Feb 2009
    • 1594
    • 3.8.x

    #2
    It should work... similar to redirecting a banned user to one of those banned sites.

    There's a mod over on vB.org that you should be able to edit fairly simply to do what you want it to do - redirect everyone except the admin usergroup to another site. Let me see if i can find it...

    Edit: Found it.

    PHP Code:
    <if condition="$bbuserinfo['usergroupid'] == 8">
    <
    meta HTTP-EQUIV="REFRESH" content="0; url=http://www.theybannedme.com">
    </if> 
    Change the "8" to the usergroup ID's of the users you want to redirect - registered users, mods, supermods, unregistered, etc.

    Then change the URL to the URL of your under construction page.

    Instructions for install > Admin CP->Styles and Templates->Style Manager->Your Skin Style->Edit Templates->header->Paste it in there

    Thread: http://www.vbulletin.org/forum/showthread.php?t=198962

    Comment

    • Xyabber
      Senior Member
      • Dec 2004
      • 219

      #3
      Thanks I really appreciate that.. I will probably do a variation that just is 'if not admin' then redirect. I'll have to look up that code, but thanks again!

      Comment

      • icarusforde
        Senior Member
        • Feb 2009
        • 1594
        • 3.8.x

        #4
        No problems.

        Comment

        • Xyabber
          Senior Member
          • Dec 2004
          • 219

          #5
          Come to think of it, I'll just change your code to user group for administrators with a !=

          Comment

          • icarusforde
            Senior Member
            • Feb 2009
            • 1594
            • 3.8.x

            #6
            Tisnt my code. :P I c/p'd that from the thread that i linked ya too.

            Comment

            • Xyabber
              Senior Member
              • Dec 2004
              • 219

              #7
              Thanks again.. that worked... although it showed page for a second even though set at 0.
              Anyway, it worked pretty well.

              Comment

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