Page 1 of 1

spaces on shortcodes?

PostPosted: August 20th, 2011, 2:08 pm
by s2pidkaspr
Hello,

i'm using s2member on my site. And the php conditionals works fine and so does the shortcodes. But, whenever I put two shortcodes, there is always some big space gap (where the shortcode is there).

For example I write this:

[s2If current_user_can(access_s2member_level1)]
Some content for Members who are logged in with an s2Member Level >= 1.
[/s2If]
[s2If !current_user_can(access_s2member_level1)]
Some public content.
[/s2If]

Those members who are with s2member accounts will NOT see the "Some public content" area. But rather see a big white space as if the shortcode is supposed in there.

While those area for public will NOT see the "Some content for Members" area. But rather see a big white space as if the shortcode is supposed in there.

PHP conditionals is not doing this. If the content is not visible for that user, they won't see a big white space in there. So, i'm wondering, why shortcode is doing this? Anyway to fix this? Thanks

Re: spaces on shortcodes?

PostPosted: August 20th, 2011, 8:58 pm
by Cristián Lávaque
If that's the case, then it'd be a problem with the way WordPress parses the shortcodes. Does it still leave the big empty space if you put the shortcodes one right next to the other?

Code: Select all
[s2If current_user_can(access_s2member_level1)]
Some content for Members who are logged in with an s2Member Level >= 1.
[/s2If][s2If !current_user_can(access_s2member_level1)]
Some public content.
[/s2If]

Re: spaces on shortcodes?

PostPosted: August 21st, 2011, 12:14 am
by s2pidkaspr
Cristián Lávaque wrote:If that's the case, then it'd be a problem with the way WordPress parses the shortcodes. Does it still leave the big empty space if you put the shortcodes one right next to the other?

Code: Select all
[s2If current_user_can(access_s2member_level1)]
Some content for Members who are logged in with an s2Member Level >= 1.
[/s2If][s2If !current_user_can(access_s2member_level1)]
Some public content.
[/s2If]


hmmm...weird...when i do that, only the content for members are triggered, and the public content is showing

[s2If !current_user_can(access_s2member_level1)]
Some public content.
[/s2If]

Just like that on the site. Meaning to say, it doesn't do the coding. But when i put it down just like before:

[s2If current_user_can(access_s2member_level1)]
Some content for Members who are logged in with an s2Member Level >= 1.
[/s2If]
[s2If !current_user_can(access_s2member_level1)]
Some public content.
[/s2If]

Both code works but just like I said, it will have some big spaces in there when it shouldn't be.

Re: spaces on shortcodes?

PostPosted: August 22nd, 2011, 12:27 am
by s2pidkaspr
Hmm. I thought I had new reply here. So any ideas?

Re: spaces on shortcodes?

PostPosted: August 22nd, 2011, 10:36 pm
by Cristián Lávaque
I guess it's a WP shortcode parsing problem, sorry. :|

You can use PHP instead, then.

Re: spaces on shortcodes?

PostPosted: August 22nd, 2011, 11:17 pm
by s2pidkaspr
But I cant use php on that page i'm trying to put shortcodes on. Or is it suggested to use a plugin that allows php on post and use s2member's php code on post's instead of shortcode? Would that be fine? Would it conflict or anything?

Re: spaces on shortcodes?

PostPosted: August 23rd, 2011, 2:36 am
by Cristián Lávaque
That'd be fine. You can use https://wordpress.org/extend/plugins/exec-php/ Just remember to stick to the HTML editor when you use PHP, don't open the Visual editor or it'll mess up your code.

Re: spaces on shortcodes?

PostPosted: August 25th, 2011, 11:45 pm
by s2pidkaspr
Now that works like a charm. Thanks. It doesn't have any spaces now. That plugin really did the trick. Thanks again. ;)

Re: spaces on shortcodes?

PostPosted: August 26th, 2011, 10:37 pm
by Cristián Lávaque
:)