Getting this error using Shortcode

Here is the error:

Warning : call_user_func_array() expects parameter 1 to be a valid callback, function ’ current_user_can’ not found or invalid function name in /home2/csi/public_html/wp-content/plugins/s2member/src/includes/classes/sc-if-conds-in.inc.php on line 181

I’m using WPBakery Page Builder, and I want a row to be only be visible to a certain set of Users. To do this, I set up the row, then entered the Text area of the editor and put in the [s2If current_user_can(access_s2member_level1)] with the closing tag after the row closed.

Not sure why that wouldn’t work, as I have used Shortcodes on past projects. If there is another way to do this, I certainly will give it a try.

ADDENDUM: What Page Builder did was create two extra rows with with Text Blocks, one with the opening [s2If current_user_can(access_s2member_level1)] before my content and one [/s2If] after the content.

Ok…I went into the regular WYIWYG of the WordPress Page (Classic Mode) and entered the shortcode. It worked…well…I’m not getting the error.

1 Like

The next step was testing it after going back to the Backend Mode, which uses the Page Builder tools. It kept on working, even though it showed the shortcode tags in their own “rows”.

Start in Classic Mode. Continue in Backend Mode. Should work.

Maybe not working as smoothly as I thought.

I’m not familiar with that editor. It’d be better to find how to prevent the shortcode from being split into separate rows, I’d guess that makes it more likely to break.

I look forward to your update with what you found to work.

:slight_smile:

Right now the main workarounds are wait until after the Page is set to add in Shortcode via the Classic Editor or do it every time you update the page. Basically at that point, anytime you update the Page, Page Builder will box the shortcode into its own syntax.