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.
The forum of the forums
+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 August 18th 2017, 11:37 am

    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 August 30th 2017, 11:54 am; 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 August 18th 2017, 12:32 pm

    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 August 18th 2017, 5:52 pm

    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 August 22nd 2017, 7:16 pm

    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 August 22nd 2017, 7:22 pm

    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 August 23rd 2017, 2:42 pm

    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 August 23rd 2017, 4:56 pm

    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 August 24th 2017, 3:00 am; 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_ August 23rd 2017, 5:02 pm

    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 August 30th 2017, 9:04 am

    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 : 19432
    Reputation : 2010
    Language : fluent in dork / mumbojumbo & English haha

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

    Post by Ape August 30th 2017, 11:33 am

    ~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 August 30th 2017, 11:54 am

    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 August 30th 2017, 5:17 pm

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

      Current date/time is November 11th 2024, 7:05 pm