Members can't see member-only content protected by a shortcode + problems with permissions

Hi, I’ve installed and set up S2 Member Pro for a club that I serve as webmaster for. We are having two issues:

  1. Anyone can join and are assigned level 0. Members who we verify have paid their annual dues are manually moved up to level 1. However, in several pages in which we are using the [s2If current_user_can(access_s2member_level1)] shortcode, the protected content is not visible to our level 1 (and above) members.

  2. Those with level 4, 3, 2, and 1 permissions who log into the site are sometimes not being granted the appropriate access, nor do they have the options they should have in the WP user bar that goes across the top. However looking in Users shows them to have the permissions that were set. There is no problem with access when designating entire pages as restricted; only when using the shortcode.

Happy to answer your questions regarding my setup, or provide additional information you might require to help me get these issues solved. I have no idea whether or not they are related or unrelated and just co-occurring.

The club’s home page is here.

The Welcome page is a 5-second redirect to the Membership Options page.

Current plugins include Yoast SEO, AMP, bbPress, Smush, ShortCode Redirect, and Essential Grid. Was running iThemes Security and WP Fastest Cache but suspected that might be an issue (security plugins and caching plugins seem to have been the culprit in other, similar cases I researched here) so I deactivated them, but the problem continues.

Since it seems to be a shortcode concern make sure you’re not using a page builder that might be changing your shortcodes.

Page builders are great, but sometimes if you put shortcodes in non-text elements they might change them a bit for the sake of security. So you have to make sure you’re telling them you mean it by using a text block.

1 Like

Oh, and also don’t copy/paste.

Word likes to change quotes to make them pretty so make sure your quotes look like ’ or " and not curly at all.

1 Like

Hi John.

Could you paste here the s2If shortcodes you’re using?

Are you using Gutenberg? What block type are you putting the shortcode in?

:slight_smile:

Thanks for all the replies! I build pages with a page builder BUT add the S2member shortcodes via the classic HTML editor (not Gutenberg…the old one). What I am hiding are some buttons, which are rendered using shortcodes provided by my theme. Here is an example of one of the buttons, inside an s2member shortcode wrapper.

[s2If current_user_can(access_s2member_level1)][trx_sc_button type="default" new_window="1" align="center" text_align="center" icon_position="left" hide_on_desktop="" hide_on_notebook="" hide_on_tablet="" hide_on_mobile="" title="Membership Renewal Page" link="/membership-renewal"][/s2If]

Is it possible that s2member doesn’t handle shortcodes within its own shortcodes very well? Or do you think something else is going on here?

I think something else is going on. It’s usual to have shortcodes inside the s2If shortcode without an issue.

When outside the s2If, is the trx_sc_button being parsed correctly?

1 Like