We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Webpage viewing restrictions... revisited
Topic Started: Nov 10 2011, 11:10 PM (627 Views)
Trinity76
Member Avatar
Member
[ *  * ]
Board Address: (Private)
Board Software: (ZetaBoards)
Description: I requested this feature back in April and Cory was kind enough to create a code for me. But after the last upgrade (which fixed the portal disable bug) the code no longer works.

Symptom: Groups with permission to view webpages are sent back to the index page instead.

Code:
 
<script type='text/javascript'>
if (location.href.match(/pages/)) {
uname = $('#top_info strong a').html();
$.get(main_url+'members/?search_type=start&name='+uname+'&group=0&sort=name&order=a', function (data) {
ugroup = $('.row1 td:eq(1)',data).html();
var groupaccess=new Array("Members","Admins");
var pageaccess=0;
for (i=0;i<groupaccess.length;i++)
{
if(ugroup==groupaccess[i]){pageaccess=1;};
};
if(pageaccess==0){location.href=main_url+"/login/"}
});
}
</script>
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
Wow, what a way to bruise my ego :cry: just out of spite i wont tell you about this
Edited by Quozzo, Nov 11 2011, 04:44 AM.
Offline Profile Goto Top
 
Trinity76
Member Avatar
Member
[ *  * ]
Not exactly what I was looking for since I have close to 100 pages, but at least it works! I'm also using the code below as the first line of "defense." Anyway, thanks for your help, Quozzo. I appreciate it.


Code:
 
<script type='text/javascript'>
if($('#top_info:contains(Guest)').length){
$('a[href*="/pages/"]').attr('href','#').attr('onClick','guestview()')
function guestview(){
alert('You must be logged in to view webpages');
};
};
</script>
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
What do you mean its not what you were looking for? its an updated version of the previous code i created (the one you were using) which performs to your specification, if you could be more specific in what you wanted then i can make the required modifications.
Offline Profile Goto Top
 
Trinity76
Member Avatar
Member
[ *  * ]
This code works great:

Spoiler: click to toggle

As does this code for each individual webpage:

Spoiler: click to toggle

The code for all webpages, however, will send everyone back to the index page, regardless if they're group is listed or not:

Spoiler: click to toggle

Since I have close to 100 pages I wanted a code that would control them as one, thus avoiding the task of having to paste a code in every single page. But like I said, what I have works overall. So I'm satisfied. Hope that makes sense.
Edited by Trinity76, Nov 13 2011, 02:42 PM.
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
Oh i see, something like this:
Code: Above the Board
 
<script type='text/javascript'>
//Webpage Group Access by Quozzo
if(/pages/.test(location.href)){
var groupaccess=["Admins","Members"];
$.ajax({url:$('#top_info strong a').attr('href'),async:false,success:function(d){ugroup=$('.user_info dt:contains(Group)',d).next().html();if(!groupaccess.toString().match(ugroup)){location.replace(main_url+"/index/")}}});
};
</script>
Edited by Quozzo, Nov 13 2011, 08:37 PM.
Offline Profile Goto Top
 
Trinity76
Member Avatar
Member
[ *  * ]
Just tested it out and it works perfectly! Thank you, Quozzo.
Offline Profile Goto Top
 
lightfire
Member Avatar
littlegraycloud
[ *  *  *  *  *  * ]
Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic