The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Popup if members have 0 posts

View previous topic View next topic Go down

Solved Popup if members have 0 posts

Post by Niko on 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 workConfusedLaughing

can you help me?

Niko
Hyperactive

Male Posts : 2298
Reputation : 97
Language : English, French, Italian, Spanish, Latin

Back to top Go down

Solved Re: Popup if members have 0 posts

Post by Ange Tuteur on 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
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Popup if members have 0 posts

Post by Niko on 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
Hyperactive

Male Posts : 2298
Reputation : 97
Language : English, French, Italian, Spanish, Latin

Back to top Go down

Solved Re: Popup if members have 0 posts

Post by Ange Tuteur on 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
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Popup if members have 0 posts

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

Solved Mr. Green

Thanks Smile

Niko
Hyperactive

Male Posts : 2298
Reputation : 97
Language : English, French, Italian, Spanish, Latin

Back to top Go down

Solved Re: Popup if members have 0 posts

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

You're welcome :rose:

Topic solved and archived

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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