Community Forum

User info

Welcome, Guest! Please login or register.


You are here » Community Forum » New Forum Features » I think we can use this function


I think we can use this function

Posts 1 to 9 of 9

1

I saw this code in a recent topic and i think it will be useful to create custom visibilty setting

Code:
 <script type="text/javascript">
if(GroupID==3&&$('#pun-profile').length)$().pun_mainReady(function(){ var s='Information',s1=$('#pun-title h1>span').text();document.title=s1; var L=' &nbsp;<a href="/">'+s1+'</a> &nbsp;'+s;
$('.crumbs').html(L);
$().pun_aboutReady(function()
{$('#pun-crumbs2>.crumbs').html(L);});
$('#pun-main').html
('<h1><span>'+s+'</span></h1><div class=info>\
<div class=container>You have no permission to view this page.\ </div></div>');
$('style#HideProfile').remove();});
</script>


Please Admin how can we change this code so that it affects elements with specific id and changes what is displayed for users and guest

0

2

we have permission systems arleady
Permission for pages /admin_pages.php  read this -> How to hide certain /pages/pagename that have been created?
Permission for forum /admin_forums.php  read this info:

Edit group permissions for this forum
In this form, you can set the forum specific permissions for the different user groups. If you have not made any changes to this forums group permissions, what you see below is the default based on settings in User groups. Administrators always have full permissions and are thus excluded. Permission settings that differ from the default permissions for the user group are marked red. The "Read forum" permission checkbox will be disabled if the group in question lacks the "Read board" permission. For redirect forums, only the "Read forum" permission is editable.

Last edited by kami (2017-05-11 06:08:55)

0

3

i understand read it already what  i mean is to hide a div in index page

0

4

jonath45
Greetings!
Not a nerd of JavaScript but I'll try to write a code for you on Saturday or Sunday.

0

5

thank you very much C3La-Ns

0

6

You can also show or hide any HTML element anywhere to/from guests and/or logged-in users based on their user-group with CSS.

It's late here and I'm tired, but I can give you some examples tomorrow or this weekend if you'd like.

Last edited by Buzzer (2017-05-12 09:35:17)

0

7

ok thanks

0

8

jonath45
CSS is real easy to use to hide stuff from any user group you want. Of course, you do need to be using the Custom Style feature in your forum admin. ;)

The main page container in your forum has a specific ID obviously - #pun - but it also has classes appended to it depending on the status of the user viewing the page. You can easily see those classes when you pop open your browser's developer tools (F12):

http://thumbnails102.imagebam.com/54844/db7f1c548437043.jpg

The image above shows the classes appended to #pun when I'm logged-in as administrator. Those classes are isuser, ismoderator & isadmin as I'm in all 3 of those groups. Logged-out visitors get a class of isguest so you can use that to target stuff you want to show/hide to visitors.

There is also an additional class that specifies the usergroup the user belongs to, in this case gid1. To find the classes for other usergroups on your forum, simply hover your mouse over the "Edit" link for the usergroup in your forum admin, and you'll see the group ID in the URL shown at the bottom-left of your screen. So you can show/hide anything to/from all members in any usergroups too.

http://thumbnails102.imagebam.com/54844/f243cb548438167.jpg

You can use those classes to specify any on-page element you want to hide or show to anyone. For example, I've added a div container - #guestheader - to the top of my forum for banner ads that I only want to show to logged-out visitors, and hide for all logged-in users. This simple CSS does that to set it to hidden by default, but display it for guests:

Code:
/*Ads in header*/
#guestheader {display:none;}
.isguest #guestheader {display:block; color:#fff; text-align:center;}

0

9

thanks will try it

0


You are here » Community Forum » New Forum Features » I think we can use this function