No announcement yet.

Redirect in header for everyone except admin

  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

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

    There's a mod over on 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=">
    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



    • #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!


      • #4
        No problems.


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


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


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


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