Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Resources
  • Code Requests
  • Completed Requests
  • [Completed] [ZB] more than a member/guest only code
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
[Completed] [ZB] more than a member/guest only code
Tweet Topic Started: Nov 3 2009, 11:37 AM (275 Views)
'Joe Nov 3 2009, 11:37 AM Post #1
Member Avatar


Posts:
29
Group:
Member
Member
#2,897
Joined:
Apr 30, 2009
My apologies if an answer exists already but I spent 30 minutes searching and have yet to find a "clear" answer. The closest thing I found was this http://zbcode.com/topic/2256336/ but the outcome wasn't real clear.

I have some html at the top of my board that I would like to hide from certain groups, not just guests only or I would use the "members only" code. I have tried playing around with my limited knowledge without success.
Offline Profile Goto Top
 
Gorgor Nov 3 2009, 12:08 PM Post #2
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Well to find out what group someone is would require AJAX which will use double ad credits per page view. Is that ok?
Offline Profile Goto Top
 
'Joe Nov 3 2009, 12:21 PM Post #3
Member Avatar


Posts:
29
Group:
Member
Member
#2,897
Joined:
Apr 30, 2009
I'm not to concerned with add credits atm so if that is the route I have to go it would be worth it for me.

Since these same groups have limited access to certain forum sections would it be possible to use that somehow in the equation?
Offline Profile Goto Top
 
Gorgor Nov 3 2009, 12:24 PM Post #4
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
That would work if you only want it to run on topic view, forum view, and index page as I can check if they can see the forum from the drop-down menu. Is that what you want?
Offline Profile Goto Top
 
'Joe Nov 3 2009, 12:34 PM Post #5
Member Avatar


Posts:
29
Group:
Member
Member
#2,897
Joined:
Apr 30, 2009
The info that I am wanting to hide is in the board template "Above the Board" which would need to be hidden on all views.

To clarify it is a PK/War alert for our members so I am guessing you can understand my intent here.
Edited by 'Joe, Nov 3 2009, 12:35 PM.
Offline Profile Goto Top
 
Gorgor Nov 3 2009, 12:39 PM Post #6
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Mhmm... then the only way to do it is through AJAX.

For the stuff you want to hide, add this before:
Code:
 
<div id='hideforgroups' style='display:none'>
and this after:
Code:
 
</div>


Then add this in your board template:
Code:
 
<script>
$(function(){
groups = new Array();
groups[0] = "GROUP 1"
groups[1] = "GROUP 2"

a = $("#top_info strong a").attr("href")
$.get(a, function(data){
x = $(".user_info dt:contains(Group)", data).next().html()
if($.inArray(x, groups) == 0){
$("#hideforgroups").show()
}
})
})
</script>
Edit the GROUP # to the group's name.

To add more, simply add
Code:
 
groups[2] = "GROUP 3"
after the others while increasing the number for each additional one.
Edited by Gorgor, Nov 3 2009, 12:40 PM.
Offline Profile Goto Top
 
'Joe Nov 3 2009, 01:38 PM Post #7
Member Avatar


Posts:
29
Group:
Member
Member
#2,897
Joined:
Apr 30, 2009
Something isn't working for me. This is what I have. It's hidden all of the time to everyone.

Code:
 

<div id='hideforgroups' style='display:none'>
Testing
</div>

In Board Template
Code:
 
<script>
$(function(){
groups = new Array();
groups[0] = "Registered"
groups[1] = "Guest"
groups[2] = "Intro"
a = $("#top_info strong a").attr("href")
$.get(a, function(data){
x = $(".user_info dt:contains(Group)", data).next().html()
if($.inArray(x, groups) == 0){
$("#hideforgroups").show()
}
})
})
</script>
Edited by 'Joe, Nov 3 2009, 01:40 PM.
Offline Profile Goto Top
 
Gorgor Nov 3 2009, 03:04 PM Post #8
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Sorry, I forgot to tell you that the groups you enter into it are the groups you WANT it to be displayed for. It's also case sensative.
Offline Profile Goto Top
 
'Joe Nov 3 2009, 03:12 PM Post #9
Member Avatar


Posts:
29
Group:
Member
Member
#2,897
Joined:
Apr 30, 2009
Works great thank you very much. This is complete!
Offline Profile Goto Top
 
Gorgor Nov 3 2009, 03:21 PM Post #10
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
You're welcome.
See? We can read thoughts too. ;)

Your request has been completed, and we're moving it to the correct forum. We hope it works for you; if it doesn't, feel free to post another request topic in the requests forum. Just remember: read the rules first!

Thanks,
The ZBCode Staff
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Completed Requests · Next Topic »
Locked Topic

Track Topic · E-mail Topic Time: 2:27 PM Jul 11
Hosted for free by ZetaBoards · Privacy Policy