[code]s do not be visible for guests 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.
+2
brandon_g
DeathLess
6 posters

    [code]s do not be visible for guests

    DeathLess
    DeathLess
    Forumember


    Male Posts : 59
    Reputation : 1
    Language : ForuMotion Hungarian Translator
    Location : At Your Girlfriend's House

    Solved [code]s do not be visible for guests

    Post by DeathLess Fri 18 Aug 2017 - 11:37

    Hey!
    Is possible to codes do not be visible for guests, only for members?
    Ex.: At the place of the codes guests will see "Sorry, codes are visible for members only, please login or signup to view it".
    Is this possible?


    Last edited by DeathLess on Wed 30 Aug 2017 - 11:54; edited 1 time in total
    brandon_g
    brandon_g
    Manager
    Manager


    Male Posts : 10113
    Reputation : 923
    Language : English
    Location : USA

    Solved Re: [code]s do not be visible for guests

    Post by brandon_g Fri 18 Aug 2017 - 12:32

    Hello,

    There is no option for this in the acp, however, you could use the hide code for code in posts and this will hide it for anyone who didnt reply to the topic (except for staff who can see so long as they have moderation rights to the section), so long as guests can"t post this method could do something similar to what your looking to do.

    -Brandon



    [code]s do not be visible for guests Brando10
    Remember to mark your topic [code]s do not be visible for guests Solved15 when a solution is found.
    General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

    [code]s do not be visible for guests Scre1476
    Team Leader
    Review Section Rules | Request A Review | Sticker Points
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: [code]s do not be visible for guests

    Post by Draxion Fri 18 Aug 2017 - 17:52

    HI, yes it's very much possible with using JavaScript to restrict some guests from viewing code. Even I use the same method on my site to prevent guests from using the codes members only can use.

    It only depends on what codes you are wanting to hide from guests. May I ask what you are trying to hide?
    DeathLess
    DeathLess
    Forumember


    Male Posts : 59
    Reputation : 1
    Language : ForuMotion Hungarian Translator
    Location : At Your Girlfriend's House

    Solved Re: [code]s do not be visible for guests

    Post by DeathLess Tue 22 Aug 2017 - 19:16

    I simply want to hide codes for the guests. Because we use codes for urls, or javascript codes, etc..
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: [code]s do not be visible for guests

    Post by Draxion Tue 22 Aug 2017 - 19:22

    You can use this method to determine if someone is logged in or not.
    Code:
    _userdata["session_logged_in"] == 0

    0 means they aren't logged in.
    1 means they are.
    DeathLess
    DeathLess
    Forumember


    Male Posts : 59
    Reputation : 1
    Language : ForuMotion Hungarian Translator
    Location : At Your Girlfriend's House

    Solved Re: [code]s do not be visible for guests

    Post by DeathLess Wed 23 Aug 2017 - 14:42

    Draxion wrote:You can use this method to determine if someone is logged in or not.
    Code:
    _userdata["session_logged_in"] == 0

    0 means they aren't logged in.
    1 means they are.
    And where could I paste this code?
    omarpop23
    omarpop23
    Forumember


    Male Posts : 182
    Reputation : 3
    Language : Arabic
    Location : Egypt

    Solved Re: [code]s do not be visible for guests

    Post by omarpop23 Wed 23 Aug 2017 - 16:56

    give it a try
    Code:
    $(function() {
      if (_userdata["session_logged_in"] == 0) {
        $("dl.codebox").html(' please <a href="/login">login</a> or <a href="/register">register</a> to view it');
      }
    });

    Rusalt:
    [code]s do not be visible for guests Untitl11


    Last edited by omarpop23 on Thu 24 Aug 2017 - 3:00; edited 2 times in total
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

    Solved Re: [code]s do not be visible for guests

    Post by _Twisted_Mods_ Wed 23 Aug 2017 - 17:02

    run this javascript in post

    Code:
    $(function(){
    if(_userdata["session_logged_in"]==0){$(".codebox").remove();}
    });
    DeathLess
    DeathLess
    Forumember


    Male Posts : 59
    Reputation : 1
    Language : ForuMotion Hungarian Translator
    Location : At Your Girlfriend's House

    Solved Re: [code]s do not be visible for guests

    Post by DeathLess Wed 30 Aug 2017 - 9:04

    omarpop23 wrote:give it a try
    Code:
    $(function() {
      if (_userdata["session_logged_in"] == 0) {
        $("dl.codebox").html(' please <a href="/login">login</a> or <a href="/register">register</a> to view it');
      }
    });

    Rusalt:
    [code]s do not be visible for guests Untitl11
    This is EXACTLY what I want!
    Thanks!
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19358
    Reputation : 2006
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: [code]s do not be visible for guests

    Post by Ape Wed 30 Aug 2017 - 11:33

    ~Hello @DeathLess can i consider this problem now solved ?

    if yes please click the mark solved button found above this thread.

    Thank you.

    APE



    [code]s do not be visible for guests Left1212[code]s do not be visible for guests Center11[code]s do not be visible for guests Right112
    [code]s do not be visible for guests Ape_b110
    [code]s do not be visible for guests Ape1010
    DeathLess
    DeathLess
    Forumember


    Male Posts : 59
    Reputation : 1
    Language : ForuMotion Hungarian Translator
    Location : At Your Girlfriend's House

    Solved Re: [code]s do not be visible for guests

    Post by DeathLess Wed 30 Aug 2017 - 11:54

    APE wrote:~Hello @DeathLess can i consider this problem now solved ?

    if yes please click the mark solved button found above this thread.

    Thank you.

    APE
    Yes, marked solved.
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: [code]s do not be visible for guests

    Post by Draxion Wed 30 Aug 2017 - 17:17

    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules