Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redirect Banned Users From Homepage
#1
Assuming:
1. Your homepage is index.php
2. Your banned usergroup id is 7 (default).

Now open your index page template:
ACP > Templates & Styles > Templates > {your_theme} Templates > Index Page Templates > Index

Find the code:
<body>

Replace with:
<body onload="bannedredirect()">

Now add just above it:
<script type="text/javascript">
function bannedredirect()
{
    if({$mybb->user['usergroup']} == 7)
    {
        window.location="{$mybb->settings['bburl']}/misc.php?page=banned";
    }
}
</script>

Now design your Banned Message Page using "Page Manager" with URI Parameter banned

You can use the trick to redirect other usergroups also to other pages as you like.
[Image: logo.svg.svg]
Reply
#2
Well they'd have to be logged in for this to work. They could still log out and just view the main page.

Also, this won't work if they disable Javascript. Or if they just block this particular script.

However a simple plugin could remedy the second issue, and somewhat remedy the first.

You could just use a plugin to redirect (with PHP) anyone who is logged in and is in the usergroup, OR who has an IP matching an IP of a banned user.

Of course, the last one isn't exactly ALWAYS going to work, because of dynamic IPs. But it's a solution for the case of a logged out user.
Reply
#3
This user has been denied support. This user has been denied support.
This only works if using js as member mentioned above.

Best is to use header(location: somepage.php) .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)