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
3 posters

    Code visible only under conditions

    Niko
    Niko
    Helper
    Helper


    Male Posts : 3283
    Reputation : 254
    Language : English, Italian, French
    Location : Italy

    Solved Code visible only under conditions

    Post by Niko March 10th 2014, 11:10 am

    Hello guys,

    another issue..
    what's wrong? the CODE HERE appears, but always! and not only if the member is logged in and if the post number is equal to 1

    (and only on the home page)

    Code:
    $(window).load(function() {
     Â   if (typeof _userdata === "undefined") return;
     Â   if (_userdata["user_posts"] == '1' ||  _userdata["session_logged_in"] == '1') {
     Â      $('#fa_toolbar').before('CODE HERE');
     Â   }
     Â           });

    can you help me?
    I want to view the code only if posts=1 and if you are logged in

    thanks guys  Mr. Green


    Last edited by Niko! on March 10th 2014, 11:41 am; edited 1 time in total
    Rhino.Freak
    Rhino.Freak
    Helper
    Helper


    Male Posts : 1248
    Reputation : 104
    Language : English
    Location : Mumbai, India

    Solved Re: Code visible only under conditions

    Post by Rhino.Freak March 10th 2014, 11:29 am

    Im not sure, but I believe that || is OR, you must make it && .. but thats a guess.
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3283
    Reputation : 254
    Language : English, Italian, French
    Location : Italy

    Solved Re: Code visible only under conditions

    Post by Niko March 10th 2014, 11:38 am

    Nope  Confused Crying or Very sad Crying or Very sad

    solved  Mr. Green 
    Rhino.Freak
    Rhino.Freak
    Helper
    Helper


    Male Posts : 1248
    Reputation : 104
    Language : English
    Location : Mumbai, India

    Solved Re: Code visible only under conditions

    Post by Rhino.Freak March 10th 2014, 11:42 am

    Can you post what was the problem?
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3283
    Reputation : 254
    Language : English, Italian, French
    Location : Italy

    Solved Re: Code visible only under conditions

    Post by Niko March 10th 2014, 11:44 am

    Rhino.Freak wrote:Can you post what was the problem?

    using && instead of ||  Mr. Green 
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Code visible only under conditions

    Post by SLGray March 10th 2014, 2:32 pm

    Problem solved & topic archived.



    Code visible only under conditions Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.

      Current date/time is November 11th 2024, 1:15 pm