0

If I create a new page and include this shortcode, the Civi User Dashboard displays correctly.

[civicrm component="user-dashboard"]

If I create a new page but nest the same short code inside of an outer shortcode, several JS files do not get loaded. A section titled "<!-- CiviCRM html header -->" (present in non-nested output) does not output.

[members_logged_in]
[civicrm component="user-dashboard"]
[/members_logged_in]
1
  • Huh, I just thought it was the plugin I was using (Groups). Good to know it is all of them. Commented Feb 2, 2021 at 7:09

2 Answers 2

2

https://developer.wordpress.org/reference/functions/get_shortcode_regex/

"get_shortcode_regex" doesn't seem to work when nesting CiviCRM shortcodes. I found 2 hacky workarounds.

1
  • Can you elaborate on your hacky workarounds ?
    – samuelsov
    Commented Feb 11, 2022 at 22:07
1

I ended up using page tags to tell a php script which pages need to force CiviCRM resources to load.

if ( function_exists('has_tag') && function_exists('get_the_id') && has_tag('logged-in-no-cache', get_the_id()) ) {
    add_action( 'wp_enqueue_scripts', array( civi_wp(), 'front_end_page_load' ), 100 );
}

This goes in functions.php.

2
  • @samuelsov here's what I've come up with.
    – dsmith63
    Commented Feb 11, 2022 at 22:53
  • awesome, it's perfect for my needs
    – samuelsov
    Commented Feb 24, 2022 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.