How to "hide" a visible section? Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
4 posters

    How to "hide" a visible section?

    Cesar
    Cesar
    Forumember


    Posts : 207
    Reputation : 3
    Language : Romanian

    Solved How to "hide" a visible section?

    Post by Cesar March 9th 2014, 5:43 pm

    Hello.
    How can i hide a section but remaining visible to members?I know you don't understand so i will show you an image .  Laughing 
     
    When you are a staff member:
     
    When you are a usual member:

     Thank you.
    JScript
    JScript
    Forumember


    Male Posts : 741
    Reputation : 175
    Language : PT-BR, EN
    Location : Brazil

    Solved Re: How to "hide" a visible section?

    Post by JScript March 9th 2014, 6:28 pm

    Hello!

    We can adapt my code below to what you want, what do you think?
    Code:

        $(function() {
            if (document.getElementById('logout') == null) {
                var sCategory = '4';
                $('.main-content:eq(' + sCategory + ')').addClass('protect');
                var sCSS = '<style>' +
                    '.protect:after {' +
                        'background: none repeat scroll 0px 0px rgba(255, 255, 255, 0.8);' +
                        'bottom: 0px;' +
                        'content: "Somente membros";' +
                        'font-size: 30px;' +
                        'left: 0px;' +
                        'line-height: 240px;' +
                        'position: absolute;' +
                        'right: 0px;' +
                        'text-align: center;' +
                        'top: 0px;' +
                        'z-index: 10;' +
                    '}' +
                    '.protect {' +
                        'position: relative;' +
                    '}' +
                    '</style>';
                document.head.insertAdjacentHTML('beforeEnd', sCSS);
            }
        });

    Result:
    How to "hide" a visible section? TVnljdV

    What do you think?

    JS
    Cesar
    Cesar
    Forumember


    Posts : 207
    Reputation : 3
    Language : Romanian

    Solved Re: How to "hide" a visible section?

    Post by Cesar March 10th 2014, 6:49 pm

    Where to add it? Very Happy
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to "hide" a visible section?

    Post by Ange Tuteur March 11th 2014, 1:00 am

    It should probably go in :

    Administration panel > modules > javascript codes management > create a new script

    placement : in the homepage
    Cesar
    Cesar
    Forumember


    Posts : 207
    Reputation : 3
    Language : Romanian

    Solved Re: How to "hide" a visible section?

    Post by Cesar March 11th 2014, 1:45 pm

    I added there but nothing seems to happen. Must i replace something?
    Cesar
    Cesar
    Forumember


    Posts : 207
    Reputation : 3
    Language : Romanian

    Solved Re: How to "hide" a visible section?

    Post by Cesar March 12th 2014, 1:58 pm

    Bump. blackeye
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to "hide" a visible section?

    Post by Ange Tuteur March 13th 2014, 2:08 am

    What version forum are you using and which category do you want to protect ?

    Also please provide your forumlink.

    Thanks :rose:
    Cesar
    Cesar
    Forumember


    Posts : 207
    Reputation : 3
    Language : Romanian

    Solved Re: How to "hide" a visible section?

    Post by Cesar March 13th 2014, 6:16 am

    I was looking in the code so you must replace "sCategory="4" with number of the category.
    But when i'm logged i can't see the category.. i see it like a usual member (hided)
     Version of forum: punBB
     Link : www.vontechs.board.st
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to "hide" a visible section?

    Post by Ange Tuteur March 13th 2014, 8:07 am

    Are you using the default logout navlink ?
    Cesar
    Cesar
    Forumember


    Posts : 207
    Reputation : 3
    Language : Romanian

    Solved Re: How to "hide" a visible section?

    Post by Cesar March 13th 2014, 12:29 pm

    I think..
     "/login?logout" this is the ending of URL.

     I see if i modify in the script logout with login it's seems to appear , but when i log out isn't hiding that section.
     Maybe is something wrong in the code?
    avatar
    kmack13
    New Member


    Posts : 4
    Reputation : 1
    Language : english

    Solved Re: How to "hide" a visible section?

    Post by kmack13 March 13th 2014, 11:24 pm

    As a suggestion if you don't want want normal members to be able to view something why not just block it completely. As in not letting them know it's there.


    Directions To Do So:
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to "hide" a visible section?

    Post by Ange Tuteur March 14th 2014, 6:49 am

    Okay, does your logout link have the id logout ?

    ex :
    Code:
    <a id="logout" href="/login?logout=1">Log out</a>
    Cesar
    Cesar
    Forumember


    Posts : 207
    Reputation : 3
    Language : Romanian

    Solved Re: How to "hide" a visible section?

    Post by Cesar March 14th 2014, 2:48 pm

    I'm not sure , Ange. When i click on "Log out" button , yeah appears "/login?logout"..
     Kmack , i know how to hide them , but i want this..
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to "hide" a visible section?

    Post by Ange Tuteur March 14th 2014, 9:07 pm

    Could you send me a test account ?
    Cesar
    Cesar
    Forumember


    Posts : 207
    Reputation : 3
    Language : Romanian

    Solved Re: How to "hide" a visible section?

    Post by Cesar March 15th 2014, 2:32 pm

    Sented.  Very Happy
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to "hide" a visible section?

    Post by Ange Tuteur March 15th 2014, 5:58 pm

    See if this works :
    Code:
            $(function() {
                if (!$('#user_bar a[href="/login?logout"]').length) {
                    var sCategory = '3';
                    $('.main-content:eq(' + sCategory + ')').addClass('protect');
                    var sCSS = '<style>' +
                        '.protect:after {' +
                            'background: none repeat scroll 0px 0px rgba(255, 255, 255, 0.8);' +
                            'bottom: 0px;' +
                            'content: "Somente membros";' +
                            'font-size: 30px;' +
                            'left: 0px;' +
                            'line-height: 240px;' +
                            'position: absolute;' +
                            'right: 0px;' +
                            'text-align: center;' +
                            'top: 0px;' +
                            'z-index: 10;' +
                        '}' +
                        '.protect {' +
                            'position: relative;' +
                        '}' +
                        '</style>';
                    document.head.insertAdjacentHTML('beforeEnd', sCSS);
                }
            });
    Cesar
    Cesar
    Forumember


    Posts : 207
    Reputation : 3
    Language : Romanian

    Solved Re: How to "hide" a visible section?

    Post by Cesar March 15th 2014, 7:36 pm

    You're the best.
     Thank you very much!
     This topic is solved.
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: How to "hide" a visible section?

    Post by Ange Tuteur March 15th 2014, 8:17 pm

    You're welcome :rose:

    Topic solved and archived