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.

Popup if members have 0 posts

2 posters

Go down

Solved Popup if members have 0 posts

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

Hello guys,

I have a popup build with HTML that I want to appear if the member has no posts (_userdata["user_posts"] = 0)


let's call the HTML code X, I tried this:

Code:
jQuery(window).load(function() {
        if (typeof _userdata === "undefined") return;
    if (_userdata["user_posts"] == '0') {
           jQuery('#fa_toolbar').before('<div id="cover" style="    background: black;    opacity: 0.7;    width: 1350px;    height: 634px;    position: absolute;    top: 0px;    left: -186px;    z-index: 20002;"></div><div id="introduce" style="    z-index: 20002;    background: #fafafa;    border: 1px solid #ccc;    position: absolute;    width: 500px;    height: 186px;    top: 76px;    left: 274px;    border-radius: 5px; padding: 7px;"><br><center><span style="    color: #111!important;  font-family: Lato!important;  font-size: 20px!important;  font-weight: 300!important;  overflow: hidden; ">Have you already posted your member introduction?</span></center><br><br><p>If you haven't already opened a topic to introduce yourself to the community you should do it right now! In this way you will be able to access to all the tutorials, resources and services offered by <b>FMcodes</b>!<br><br><a href="/f10-member-introductions" class="ipsButton_secondary" style="color:#b85f1d!important">Member Introductions</a><br><br></p></div>');
        }
});


but it doesn't work  Confused  Laughing 

can you help me?
Niko
Niko
Helper
Helper

Male Posts : 3106
Reputation : 244
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

Back to top Go down

Solved Re: Popup if members have 0 posts

Post by Ange Tuteur March 10th 2014, 10:16 am

Hello Niko,

Are you using the FA toolbar ? If not these variables will not work.

You can also use :
Code:
(_userdata["user_posts"] < 1)

It will show up if the users posts is less than 1.
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Popup if members have 0 posts

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

yes, I'm using the toolbar; i have added another html code using that variables only for adminsitrators (level = 1)
but that code doesn't work Sad

if I test it on google chrome console it says me
SyntaxError: Unexpected identifier
Niko
Niko
Helper
Helper

Male Posts : 3106
Reputation : 244
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

Back to top Go down

Solved Re: Popup if members have 0 posts

Post by Ange Tuteur March 10th 2014, 10:27 am

Your code had some errors. You ended the string early by writing

'If you haven't already'

since you're writing in single quotes it should be :

'If you haven\'t already'

try this :
Code:
$(window).load(function() {
    if (typeof _userdata === "undefined") return;
    if (_userdata["user_posts"] < 1) {
       $('#fa_toolbar').before('<div id="cover" style="background: black;opacity:0.7;width:1350px;height:634px;position:absolute;top:0px;left:-186px;z-index:20002;"></div><div id="introduce" style="z-index:20002;background:#fafafa;border:1px solid #ccc;position:absolute;width:500px;height:186px;top:76px;left:274px;border-radius:5px;padding:7px;"><br><center><span style="color: #111!important;font-family:Lato !important;font-size:20px !important;font-weight:300!important;overflow:hidden;">Have you already posted your member introduction?</span></center><br><br><p>If you haven\'t already opened a topic to introduce yourself to the community you should do it right now! In this way you will be able to access to all the tutorials, resources and services offered by <b>FMcodes</b>!<br><br><a href="/f10-member-introductions" class="ipsButton_secondary" style="color:#b85f1d!important">Member Introductions</a><br><br></p></div>');
    }
});
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Popup if members have 0 posts

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

Solved Mr. Green

Thanks Smile
Niko
Niko
Helper
Helper

Male Posts : 3106
Reputation : 244
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

Back to top Go down

Solved Re: Popup if members have 0 posts

Post by Ange Tuteur March 10th 2014, 10:50 am

You're welcome :rose:

Topic solved and archived
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum