latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

JavaScript/CSS not loading with do_shortcode

Home Forums Community Forum JavaScript/CSS not loading with do_shortcode

This topic contains 2 replies, has 2 voices. Last updated by  Jeff Starr 3 years, 1 month ago.

Topic Author Topic
Posted: Friday Nov 15th, 2013 at 9:28 pm #61161
Jeff Starr
Username: JeffStarr

When included as shortcodes in post/page content, s2member Pro forms load the required s2 JS/CSS just fine. For example, this works as expected, JS/CSS is loaded fine and everything is great:

[s2Member-Pro-PayPal-Form ...]

Until recently, including s2 Pro forms also worked great when included directly in theme template files, via the do_shortcode tag, for example:

echo do_shortcode('[s2Member-Pro-PayPal-Form ...]');

Unfortunately, this no longer works properly, as the required JS/CSS files are not included on the page.

I assume this is a bug and not a feature. Hopefully someone knows a workaround or solution.

Updated post to add: s2member Pro version = 131109

Updated to ask why this forum topic only appears in the topic list when I am logged in?

Is anybody else seeing this post?

Help..?

  • This topic was modified 3 years, 1 month ago by  Jeff Starr.
  • This topic was modified 3 years, 1 month ago by  Jeff Starr.

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Monday Nov 18th, 2013 at 6:01 pm #61208
Dan Criel
Username: dancriel

I had the same problem. I added the following 2 lines before my do_shortcode() call and the CSS/JS was restored.

wp_enqueue_style ("ws-plugin--s2member", "?ws_plugin__s2member_css=1&qcABC=1", array (), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
wp_enqueue_script ("ws-plugin--s2member", "?ws_plugin__s2member_js_w_globals=" . urlencode (WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5) . "&qcABC=1", array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum (), TRUE);
Posted: Tuesday Nov 19th, 2013 at 4:47 pm #61232
Jeff Starr
Username: JeffStarr

Thank you Dan that’s very helpful. To reciprocate, here is the response and workaround that the s2 team shared via their new private support system:

====

A recent update to s2Member changed the way s2Member loads the CSS/JS so that it’s more efficient. Unfortunately, in a few cases, such as when the Pro-Forms are called with the do_shortcode() function, this causes problems.

If you call do_shortcode() from a Post/Page that’s not a problem. The problem comes in whenever do_shortcode() is called from a custom PHP include file or WordPress template file.

s2Member has no way to auto-detect and lazy load under this scenario (at least, not yet). For now you can revert to the old behavior like this:

Inside the following file, /wp-content/mu-plugins/s2-hacks.php, add:

<?php add_filter('ws_plugin__s2member_lazy_load_css_js', '__return_true'); ?>

====

I’m using this at one of my sites and it seems to be working great, so another potential solution.

Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.