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
  • Pages:
  • 1
  • 2
[ C ] Restrict auto tools fix
Topic Started: Jul 14 2012, 09:10 AM (1,150 Views)
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
Board Address: here
Board Software: Zetaboards
Description: Cory had made me this code to restrict certain global mods from using certain autotools. Well I just got around to doing this but it does not work. It restricts all autotools selected for all global mods. I'm asking if it could be fixed

http://resources.zetaboards.com/topic/5150018/1/
Offline Profile Goto Top
 
Replies:
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
Does not seem to work
Code: HTML
 
<script type="text/javascript">
function removeOption(groupName, optionName) {
if (!$('dl.user_info dt:contains(Group:) + dd').html() === groupName) $('select[name="mem_amod"] option:contains(' + optionName + ')').remove();
}

removeOption('Global Moderator', 'Move: RP Moderator');
</script>
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
My bad, try this instead:
Code:
 
<script type="text/javascript">
function removeOption(groupName, optionName) {
if ($('dl.user_info dt:contains(Group:) + dd').html() != groupName) $('select[name="mem_amod"] option:contains(' + optionName + ')').remove();
}

removeOption('Global Moderator', 'Move: RP Moderator');
</script>
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
Cory
Jul 19 2012, 06:12 PM
My bad, try this instead:
Code:
 
<script type="text/javascript">
function removeOption(groupName, optionName) {
if ($('dl.user_info dt:contains(Group:) + dd').html() != groupName) $('select[name="mem_amod"] option:contains(' + optionName + ')').remove();
}

removeOption('Global Moderator', 'Move: RP Moderator');
</script>
If you have more than one group, it will remove it for everyone not in the first group and then everyone not in the second, which is everyone as no-one is in two groups.
Offline Profile Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
Quozzo
Jul 20 2012, 02:50 AM
Cory
Jul 19 2012, 06:12 PM
My bad, try this instead:
Code:
 
<script type="text/javascript">
function removeOption(groupName, optionName) {
if ($('dl.user_info dt:contains(Group:) + dd').html() != groupName) $('select[name="mem_amod"] option:contains(' + optionName + ')').remove();
}

removeOption('Global Moderator', 'Move: RP Moderator');
</script>
If you have more than one group, it will remove it for everyone not in the first group and then everyone not in the second, which is everyone as no-one is in two groups.
Yeah thats about right, not working
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Let me see if I understand you clearly this time. You are wanting to restrict member autotool usage by group, but you want specific members in that group to use the member autotools you restrict for that group?
Offline Profile Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
Cory
Jul 20 2012, 10:02 AM
Let me see if I understand you clearly this time. You are wanting to restrict member autotool usage by group, but you want specific members in that group to use the member autotools you restrict for that group?
Not exactly

Okay think it as leaders and teams. Team 1 has leader and Team 2 has a leader. Team 1 works in helping users and Team 2 are normal forum moderators. Say I was leader of team 2 and you of team 1. The administrators dont want the Team 2 leader able to use "Hire into team 1" autotool. So the code should be able to restrict the leader from using certain autotools. So team leader one can use "Hire into team 1" and Team 2 leader can use "hire into team 2" but not be able to use the other one. Do you see what I mean?
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Not really, that sounds like it should be done by User ID to me. I think I am going to let someone else take on this request because I (or possibly you) am getting terribly confused, sorry.
Offline Profile Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
Cory
Jul 20 2012, 08:28 PM
Not really, that sounds like it should be done by User ID to me. I think I am going to let someone else take on this request because I (or possibly you) am getting terribly confused, sorry.
Okay, I got no problem with doing it with User ID. Thanks for your help
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
Give this a twirl
Code:
 
<script type="text/javascript">
function removeOption(groupId, optionName) {
if ($.zb.stat.gid == groupId) $('select[name="mem_amod"] option:contains(' + optionName + ')').remove();
}

removeOption(GROUP_ID, 'OPTION_TEXT');
</script>
You can get the group ID from the ACP
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
OK, with Quozzo's creation I think I finally understand what you want. My group name version was flawed because it only removed the member autotool when you accessed a users profile that was in that group, and Quozzo's version removes the member autotool based on what group the user viewing the profile is in. Sorry for the misunderstanding on my behalf, I was apparently confused at what my own code did.
Offline Profile Goto Top
 
Ferby
Member Avatar
Developer
[ *  *  *  *  * ]
Cory
Jul 21 2012, 03:38 PM
OK, with Quozzo's creation I think I finally understand what you want. My group name version was flawed because it only removed the member autotool when you accessed a users profile that was in that group, and Quozzo's version removes the member autotool based on what group the user viewing the profile is in. Sorry for the misunderstanding on my behalf, I was apparently confused at what my own code did.
Well aint that a mind fart ;)

Works perfectly Quozzo. Thanks for the help both of you
Offline Profile Goto Top
 
Ardy
Member Avatar
.
[ *  *  *  *  * ]
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
  • Pages:
  • 1
  • 2