Register My Account Search Members F.A.Q. Admin  
Support Forums  


Post new topic Post reply
Author Message
Sage

Member
Posts: 1040
Registered: Feb 2004
 
 Posted March 7th, 2010 01:34 AM   IP           Reply with quote Edit Post Delete post
This will hide a specified category unless you specify a specific user to be able to view

Preview:
- Normal User
- Secified User

Custom Templates > Index Page:

first find this and add in the red text
Quote:

<!-- BEGIN catlink -->

<tr id="{catlink.catname}Head">
<td colspan="4" width="100%" class="Heading"><span class="HeadingText"><b>{catlink.catname}</b></span></td>
</tr>


next, find this and add in the blue text:
Quote:

<!-- BEGIN forum -->

<tr id="{catlink.catname}Forum">
<td width="42%" class="FirstAlt">
<table width="100%" border="0" cellspacing="0" cellpadding="4">


now add this to the very bottom of the index template:
Quote:

<script type="text/JavaScript">
<!--
//Display categories for specific members
//Written by Dranew


//Set Categories
var cats = [
['Category 1',['User 1','User 2','User 3','User 4']],
['Category 2',['User1','User2']],
['Category 3',['User1']]
];

//Variables
var iTr = document.getElementsByTagName('tr')

var build = {

//hide cat
hCat:function() {
if(document.cookie.match(/ckusr/) && document.cookie.match(/{boardid}/)) {
var lUs = document.cookie.split("ckusr[{boardid}]")[1];
var lSp = lUs.split("=")[1];
var lUser = lSp.split(";")[0];
if(lUser.match(/(.+?) (.+?)/)) {
lUser = RegExp.$1+RegExp.$2;
} else if(lUser.match(/(.+?) (.+?) (.+?)/)) {
lUser = RegExp.$1+RegExp.$2+RegExp.$3;
} else if(lUser.match(/(.+?) (.+?) (.+?) (.+?)/)) {
lUser = RegExp.$1+RegExp.$2+RegExp.$3+RegExp.$4;
}
}
for(cat=0;cat<cats.length;cat++) {
var cHead = document.getElementById(cats[cat][0]+'Head');
cHead.style.display = "none";
for(row=0;row<iTr.length;row++) {
if(iTr.item(row).id == cats[cat][0]+'Forum') {
iTr.item(row).style.display = "none";
}
}
}
for(cat2=0;cat2<cats.length;cat2++) {
var cUser = cats[cat2][1];
for(cat3=0;cat3<cUser.length;cat3++) {
if(cUser[cat3][cat3] == lUser) {
var cHead = document.getElementById(cats[cat2][0]+'Head');
cHead.style.display = "";
for(row2=0;row2<iTr.length;row2++) {
if(iTr.item(row2).id == cats[cat2][0]+'Forum') {
iTr.item(row2).style.display = "";
}
}
}
}
}
}
}

//Build
build.hCat();

//-->
</script>



To Edit:

//Set Categories
var cats = [
['Category 1',['User 1','User 2','User 3','User 4']],
['Category 2',['User1','User2']],
['Category 3',['User1']]
];

Category # - category to hide
User # - Member's username allowed to view category
'Multiple','members' - seperate each username by a comma

*update 1* fixed so you can set different users per category
*update 2* fixed security issue, but takes more to code.
(Edited by Sage)

- More Scripts and Mods at indexOf('ExCo')
Orpheas

Super Moderator
Posts: 2187
Registered: Sep 2004
 
 Posted March 7th, 2010 10:31 AM   IP           Reply with quote Edit Post Delete post
Thanks Sage, I know a lot of people will love this since we aren't allowed to hide things in the Control Panel.
Excoboard Terms of Service
Weirdchild

Member
Posts: 161
Registered: Aug 2007
 
 Posted March 20th, 2010 11:54 AM   IP           Reply with quote Edit Post Delete post
Works fantastically, Thank you so much Sage
Weirdchild@Forum Junkies
ripped glutes

Member
Posts: 236
Registered: Sep 2006
 
 Posted March 22nd, 2010 06:28 AM   IP           Reply with quote Edit Post Delete post
thats fantastic for making your staff room invisible..but what if you want 2 invisible rooms with 2 different sets of members....?

obviously if i add members to hidden room..and ive got mod room hidden..it will give them access to that too...

www.rippedglutes.net
Orpheas

Super Moderator
Posts: 2187
Registered: Sep 2004
 
 Posted March 22nd, 2010 10:13 AM   IP           Reply with quote Edit Post Delete post
This script isn't setup to say this category with this many people. This is setup to hide multiple categories.

[Edit] Script has been edited, read bellow.
(Edited by Orpheas)

Excoboard Terms of Service
Sage

Member
Posts: 1040
Registered: Feb 2004
 
 Posted March 22nd, 2010 12:12 PM   IP           Reply with quote Edit Post Delete post
Updated the script to allow different members per category
- More Scripts and Mods at indexOf('ExCo')
ripped glutes

Member
Posts: 236
Registered: Sep 2006
 
 Posted March 24th, 2010 06:00 AM   IP           Reply with quote Edit Post Delete post
ive created a room...and the people i added can get in no probs apart from 2 members that have a space in their user names..i.e "mrs bloggs"

ive added it as it appears in the forum...and she cant get in...so i went into index and removed the space and she still cant get in..ive checked all the commas etc...and all ok..

can you advise me plz

www.rippedglutes.net
Sage

Member
Posts: 1040
Registered: Feb 2004
 
 Posted March 24th, 2010 09:44 AM   IP           Reply with quote Edit Post Delete post
just updated the script;

when inserting the username, remove the spaces.

var cats = [
['Administration','User 1,mrsbloggs'],
['Category 2','User 1']
];

- More Scripts and Mods at indexOf('ExCo')
ripped glutes

Member
Posts: 236
Registered: Sep 2006
 
 Posted March 24th, 2010 08:06 PM   IP           Reply with quote Edit Post Delete post
thanks so much for that sage...love you soooo much lol

xxxxxx

www.rippedglutes.net
Sage

Member
Posts: 1040
Registered: Feb 2004
 
 Posted March 24th, 2010 08:49 PM   IP           Reply with quote Edit Post Delete post
you are welcome
- More Scripts and Mods at indexOf('ExCo')
Orpheas

Super Moderator
Posts: 2187
Registered: Sep 2004
 
 Posted March 24th, 2010 11:25 PM   IP           Reply with quote Edit Post Delete post
Now if we can get Peter to implement this on the service.
Excoboard Terms of Service
mizwings

Super Moderator
Posts: 2009
Registered: Feb 2006
 
 Posted March 25th, 2010 07:01 AM   IP           Reply with quote Edit Post Delete post
Very cool thanks Sage
ripped glutes

Member
Posts: 236
Registered: Sep 2006
 
 Posted March 25th, 2010 08:08 PM   IP           Reply with quote Edit Post Delete post
i edited as you said above and it made the section visible to everyone again...and allowed anyone that was a registered member to view and post...so ive deleted it for now..until i can put script in again..i must have went wrong somewhere..


www.rippedglutes.net
ripped glutes

Member
Posts: 236
Registered: Sep 2006
 
 Posted March 25th, 2010 08:50 PM   IP           Reply with quote Edit Post Delete post
ive got this...

//Set Categories
var cats = [
['tearoom','avril','Predator','kitty','weeman','DaveM','Neil','rippedglutes'],
['girls only','avril']
];

as part of the script you wrote and now i cant see it myself lol........luckily i havent done it with anactive room..its only a trial room.

maybe ive read your edit bit wrong..as im not that good with this kind of stuff ha ha



www.rippedglutes.net
Sage

Member
Posts: 1040
Registered: Feb 2004
 
 Posted March 25th, 2010 09:04 PM   IP           Reply with quote Edit Post Delete post
//Set Categories
var cats = [
['tearoom','avril,Predator,kitty,weeman,DaveM,Neil,rippedglutes'],
['girls only','avril']
];

try that, only separate the usernames by a comma.

- More Scripts and Mods at indexOf('ExCo')
ripped glutes

Member
Posts: 236
Registered: Sep 2006
 
 Posted March 25th, 2010 09:16 PM   IP           Reply with quote Edit Post Delete post
nope still not working for me ha ha

['Tearoom','avril,Predator,kitty,weeman,DaveM,Neil,rippedglutes,]

it was working fine the first script you had posted apart from the members with a space couldnt get in...


www.rippedglutes.net
ripped glutes

Member
Posts: 236
Registered: Sep 2006
 
 Posted March 25th, 2010 09:17 PM   IP           Reply with quote Edit Post Delete post
i copied exactly what you said in original post..and then changed the little edit bit..
www.rippedglutes.net
Orpheas

Super Moderator
Posts: 2187
Registered: Sep 2004
 
 Posted March 25th, 2010 09:41 PM   IP           Reply with quote Edit Post Delete post
Be sure you aren't mistaking category names for forum names. I did the first time and then realized its categories
Excoboard Terms of Service
Sage

Member
Posts: 1040
Registered: Feb 2004
 
 Posted March 25th, 2010 09:45 PM   IP           Reply with quote Edit Post Delete post
['Tearoom','avril,Predator,kitty,weeman,DaveM,Neil,rippedglutes,]

you have a comma after your username, it should end in a '

did you try what i posted exactly, without editing?
Quote:

//Set Categories
var cats = [
['tearoom','avril,Predator,kitty,weeman,DaveM,Neil,rippedglutes'],
['girls only','avril']
];


if that didn't work then it's something wrong with the code

- More Scripts and Mods at indexOf('ExCo')
ripped glutes

Member
Posts: 236
Registered: Sep 2006
 
 Posted March 27th, 2010 07:33 PM   IP           Reply with quote Edit Post Delete post
here is the exact copy of what ive got..........


<script type="text/JavaScript">
<!--
//Display categories for specific members
//Written by Dranew


//Set Categories
var cats = [
['Private','avril,Predator,kitty,weeman,DaveM,Neil,mrknackie,rippedglutes'],
['girls only','avril']
];
//Variables
var iTr = document.getElementsByTagName('tr')

var build = {

//hide cat
hCat:function() {
if(document.cookie.match(/ckusr/) && document.cookie.match(/{boardid}/)) {
var lUs = document.cookie.split("ckusr[{boardid}]")[1];
var lSp = lUs.split("=")[1];
var lUser = lSp.split(";")[0];
if(lUser.match(/(.+?) (.+?)/)) {
lUser = RegExp.$1+RegExp.$2;
} else if(lUser.match(/(.+?) (.+?) (.+?)/)) {
lUser = RegExp.$1+RegExp.$2+RegExp.$3;
} else if(lUser.match(/(.+?) (.+?) (.+?) (.+?)/)) {
lUser = RegExp.$1+RegExp.$2+RegExp.$3+RegExp.$4;
}
}
for(cat=0;cat<cats.length;cat++) {
var cHead = document.getElementById(cats[cat][0]+'Head');
cHead.style.display = "none";
for(row=0;row<iTr.length;row++) {
if(iTr.item(row).id == cats[cat][0]+'Forum') {
iTr.item(row).style.display = "none";
}
}
}
for(cat2=0;cat2<cats.length;cat2++) {
if(cats[cat2][1].match(lUser)) {
var cHead = document.getElementById(cats[cat2][0]+'Head');
cHead.style.display = "";
for(row2=0;row2<iTr.length;row2++) {
if(iTr.item(row2).id == cats[cat2][0]+'Forum') {
iTr.item(row2).style.display = "";
}
}
}
}
}
}

//Build
build.hCat();

//-->
</script>

it still isnt working for me...


www.rippedglutes.net
ripped glutes

Member
Posts: 236
Registered: Sep 2006
 
 Posted March 27th, 2010 07:34 PM   IP           Reply with quote Edit Post Delete post
what ive done is name both the catagory and forum "Private" and both with capital P


www.rippedglutes.net
ripped glutes

Member
Posts: 236
Registered: Sep 2006
 
 Posted March 27th, 2010 07:37 PM   IP           Reply with quote Edit Post Delete post
it was working....until the edit...
www.rippedglutes.net



Posts:
Registered:

 Posted    IP           Reply with quote Edit Post Delete post
Mark all forums read
Logout
All times are EST
Forum jump:

Thread Options: Delete thread / Open/Close thread / Rename thread / Stick thread / Move thread / Merge thread
Post new topic Post reply

< Previous thread | Next thread > | Subscribe to thread |