Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
W
WordPress
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • WordPress
  • Issues
  • #97

Closed
Open
Created Apr 07, 2021 by AllenShaw@AllenShawDeveloper

User Dashboard shortcode doesn't addCoreResources

When using a shortcode for a profile (and possibly for contribution pages and events), CiviCRM somehow uses Civi::resources()->addCoreResources() to load civicrm js and style files. However, the shortcode for user dashboard ([civicrm component="user-dashboard" hijack="0"]) does not.

BTW, there is documentation for invoking Civi::resources()->addCoreResources() in an extension to load these files, but this method doesn't seem to work in WordPress (see https://civicrm.stackexchange.com/q/2475/907 and bug reports referenced in comments there.)

As a result, the only way I've found to get these files into the wordpress front-end (even on a page that includes User Dashboard by shortcode) is to manually invoke CRM_Core_Resources::singleton()->addScriptFile() and ...->addStyleFile() for each resource, which seem clumsy and prone to breaking in upgrades.

It seems like all civicrm shortcodes should include these core resources on the WP page.

  • My CMS: WordPress 5.5.3
  • My CiviCRM: 5.35.1
Edited Apr 08, 2021 by AllenShaw
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None