System32 wrote:Title: [All versions] Password protected forums
Description: In case you need password protected forums, you can simply do that with small script.
Preview:Go to CP > Modules > Javascript and create new script. Apply it in the Homepage
Paste this code (this is example code):
- Code:
$(document).ready(function() {
var password = "123456";
$('a[href^="/f1-pravila-informacije"]').click(function() {
var user_input = prompt("Enter password");
if(password == user_input) {
return true;
} else {
alert("Incorrect password");
return false;
}
});
});
Variable
contains, well, a password required to enter specific forum. In case you need more passwords for different forums, just create new one like:
- Code:
var password1 = "whatever"
This part:
- Code:
$('a[href^="/f1-pravila-informacije"]')
specify what link are we targeting. If user clicks on this link, he will get a prompt where he will be asked for password. In case he answers wrong, he won't be allowed to pass. In case he is right, he will enter. Because of some type of safety, he must always enter the password.
How to locate the href needed? Find needed forum link, right click on it, and click Inspect. You will be shown something like this:
Copy the href value and put it here:
- Code:
$('a[href^="/f1-pravila-informacije"]')
(Of course, instead of
- Code:
/f1-pravila-informacije |
, not everything.
In case you want to add more forums copy complete click:
- Code:
$('a[href^="/f1-pravila-informacije"]').click(function() {
var user_input = prompt("Enter password");
if(password == user_input) {
return true;
} else {
alert("Incorrect password");
return false;
}
});
But just change the href and if needed password variable name. :D