The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How can I create ban hammer javascript?

3 posters

Page 1 of 2 1, 2  Next

Go down

Solved How can I create ban hammer javascript?

Post by Van-Helsing July 28th 2015, 12:34 pm

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.


Last edited by Black-Shadow on August 30th 2015, 5:55 pm; edited 1 time in total
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing July 29th 2015, 1:05 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing July 30th 2015, 2:03 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing July 31st 2015, 2:05 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 1st 2015, 2:31 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 2nd 2015, 4:30 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 4th 2015, 1:01 am

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 5th 2015, 1:12 am

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 6th 2015, 2:42 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 7th 2015, 9:49 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 9th 2015, 1:25 am

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 10th 2015, 2:44 am

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 11th 2015, 9:37 am

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 12th 2015, 11:42 am

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 13th 2015, 12:41 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 14th 2015, 3:46 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 15th 2015, 5:13 pm

bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 16th 2015, 8:09 pm

Bump.
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 18th 2015, 10:41 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 20th 2015, 5:32 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 21st 2015, 5:51 pm

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 26th 2015, 10:26 am

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Beyonder August 28th 2015, 1:44 am

Wow you been bumping this each day......also you should tag a Coding staff.
Beyonder
Beyonder
Forumember

Male Posts : 726
Reputation : 29
Language : English
Location : Beyond Realm

http://fictionalomniverse.forumotion.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Ange Tuteur August 28th 2015, 1:44 pm

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 :
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.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 28th 2015, 5:54 pm

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"
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Ange Tuteur August 28th 2015, 6:09 pm

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.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 30th 2015, 4:50 pm

Hello @Ange Tuteur,
Must I change the window.location.pathname = redir_url; with href = redir_url; ?
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Ange Tuteur August 30th 2015, 5:01 pm

Black-Shadow wrote:Hello @Ange Tuteur,
Must I change the window.location.pathname = redir_url; with href = redir_url; ?
Just replace pathname by href.

So it looks like this :
Code:
window.location.href = redir_url;
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Van-Helsing August 30th 2015, 5:05 pm

@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;
      }
    });
  }
});
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I create ban hammer javascript?

Post by Ange Tuteur August 30th 2015, 5:15 pm

Turn cookie to false. I'm assuming a cookie has already be set in your browser.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum