2014-07-16, 02:51
Tutorial: Category Protect |
Simple IPB protection for non-registered users. Guests can't open a protected category.
--> Tutorials, tips and tricks <--
Category Protect
Category Protect
1º - Javascript:
Placement: In home page
- Code:
[panda=js] $(function() {
if (document.getElementById('logout') == null) {
var sCategory = 'POSITION OF THE CATEGORY';
$('.main-content:eq(' + sCategory + ')').addClass('protect');
}
});
nanako wrote:[link="/t520-javascript-category-protect#3152"]I'm not sure but I think category number starts with 0 so if you have 2 categories and want to protect the SECOND CATEGORY it must be [ic]var sCategory = '1';[/ic].
2º - CSS:
- Code:
[panda=css].protect:after {
background: none repeat scroll 0px 0px rgba(255, 255, 255, 0.7);
bottom: 0px;
content: "Members Only";
font-size: 30px;
left: 0px;
line-height: 300px;
position: absolute;
right: 0px;
text-align: center;
top: 0px;
z-index: 10;
}
.protect {
position: relative;
}
3º - Preview:
© PunBB Design
If you have any questions related to this topic create a topic with the following title: Category Protect |