How can I create ban hammer javascript?
3 posters
Page 1 of 2
Page 1 of 2 • 1, 2
How can I create ban hammer javascript?
Hello,
How can I create a ban hammer javascript? The ban hammer javascript redirects all banned users(usergroup Banned), IPs and e-mails to a custom page.
How can I create a ban hammer javascript? The ban hammer javascript redirects all banned users(usergroup Banned), IPs and e-mails to a custom page.
Last edited by Black-Shadow on August 30th 2015, 5:55 pm; edited 1 time in total
Re: How can I create ban hammer javascript?
Wow you been bumping this each day......also you should tag a Coding staff.
Re: How can I create ban hammer javascript?
I apologize for not getting to this sooner. I have a question you have a usergroup that's for pseudo-banned user's correct ?
If that's the case you should be able to send a request to the group page, although this can be a bit delayed. Create a new script in all the pages with the following content :
group_url : The path to your group
redir_url : The path you'll be redirected to
cookie : Set to true if you only want the user to be redirected once. ( recommended ) Otherwise, set it to false.
If that's the case you should be able to send a request to the group page, although this can be a bit delayed. Create a new script in all the pages with the following content :
- Code:
$(function() {
var group_url = '/g1-administrators',
redir_url = '/h1-my-html-page',
cookie = true;
if (cookie && my_getcookie('faRedirected') == 'true') return;
if (!_userdata.user_level && _userdata.session_logged_in) {
$.get('/groups', function(d) {
if ($('a[href="' + group_url + '"]', d)[0]) {
if (cookie) my_setcookie('faRedirected', 'true');
window.location.pathname = redir_url;
}
});
}
});
group_url : The path to your group
redir_url : The path you'll be redirected to
cookie : Set to true if you only want the user to be redirected once. ( recommended ) Otherwise, set it to false.
Re: How can I create ban hammer javascript?
Hello @Ange Tuteur,
Its seems working, but when I am trying to redirect to external page and it is added to forum link.
Etc. http://www.forumurl.com/www.google.gr and it is displaying a white page with message "Return to index"
Its seems working, but when I am trying to redirect to external page and it is added to forum link.
Etc. http://www.forumurl.com/www.google.gr and it is displaying a white page with message "Return to index"
Re: How can I create ban hammer javascript?
If you want a whole link you need to replace pathname in window.location.pathname by href.
pathname is only for changing the local directory.
pathname is only for changing the local directory.
Re: How can I create ban hammer javascript?
Just replace pathname by href.Black-Shadow wrote:Hello @Ange Tuteur,
Must I change the window.location.pathname = redir_url; with href = redir_url; ?
So it looks like this :
- Code:
window.location.href = redir_url;
Re: How can I create ban hammer javascript?
@Ange Tuteur I have changed the code but its not redirecting
- Code:
$(function() {
var group_url = '/g8-group',
redir_url = 'http://google.gr',
cookie = true;
if (cookie && my_getcookie('faRedirected') == 'true') return;
if (!_userdata.user_level && _userdata.session_logged_in) {
$.get('/groups', function(d) {
if ($('a[href="' + group_url + '"]', d)[0]) {
if (cookie) my_setcookie('faRedirected', 'true');
window.location.href = redir_url;
}
});
}
});
Re: How can I create ban hammer javascript?
Turn cookie to false. I'm assuming a cookie has already be set in your browser.
Page 1 of 2 • 1, 2
Page 1 of 2
Permissions in this forum:
You cannot reply to topics in this forum