WordPress issueshttps://lab.civicrm.org/dev/wordpress/-/issues2023-11-22T11:10:32Zhttps://lab.civicrm.org/dev/wordpress/-/issues/144Attempting to create a pretty URL on a subpage results in non-pretty URL2023-11-22T11:10:32ZshaneonabikeAttempting to create a pretty URL on a subpage results in non-pretty URLI discovered a strange issue today with regards to pretty CiviCRM Urls via the implemention ```CRM_Utils_System::url``` for Wordpress
## To recreate
1. Create a subpage called ```Profile```
2. In ```functions.php``` create a function l...I discovered a strange issue today with regards to pretty CiviCRM Urls via the implemention ```CRM_Utils_System::url``` for Wordpress
## To recreate
1. Create a subpage called ```Profile```
2. In ```functions.php``` create a function like
```php
civicrm_initialize();
$url = '';
$result = get_user_participation($current_user, $event_id);
if (!empty($result) && isset($result['values'][0]['participant_id'])) {
$pid = $result['values'][0]['participant_id'];
$eligible = CRM_Event_BAO_Participant::getSelfServiceEligibility($pid, '', FALSE)['eligible'];
if ($eligible) {
$checksum = \Civi\Api4\Contact::getChecksum(FALSE)->setContactId($result['values'][0]['contact_id'])->execute()->first()['checksum'];
$url = CRM_Utils_System::url("/civicrm/event/selfsvcupdate", "reset=1&pid=$pid&cs=$checksum", TRUE, FALSE, TRUE);
}
}
return $url;
}
3. Override the ```Profile``` page within your theme by creating ```Profile.php``` (Note: I didn't test if we use a shortcode here)
```
4. Call the function above to output the URL
## Result
The logic in the code determines if we have a [basepage](https://lab.civicrm.org/dev/core/-/blob/master/CRM/Utils/System/WordPress.php?ref_type=heads#L324), and if it doesn't find one well it resorts to creating a non-pretty path.
I don't think that I'm proposing we change this, but it could be good to be able to override this maybe in the function call? To force it to make pretty links regardless, because on some subpages for sure we would want to have nice links.
Ironically, the link generated doesn't work in this case either. When it's a pretty link it's fine but otherwise no dice. It could be a configuration issue with my client I'm not sure.https://lab.civicrm.org/dev/wordpress/-/issues/134Clean URLs system check fails via API or cv2022-11-17T07:25:06ZJonGoldClean URLs system check fails via API or cvAs of CiviCRM 5.55, there is a check if Clean URLs are enabled.
Unfortunately, it does so by checking whether the `get_option()` function exists. This is fine via the web UI where WP boots first, but with `cv` or the API, WP boots afte...As of CiviCRM 5.55, there is a check if Clean URLs are enabled.
Unfortunately, it does so by checking whether the `get_option()` function exists. This is fine via the web UI where WP boots first, but with `cv` or the API, WP boots after CiviCRM. Since `CIVICRM_CLEANURLs` is a constant, once it's set to `0`, it's fixed at `0`.
E.g. in `cv`, `Civi\Cv\Util\BootTrait::_boot_full()` contains the following code!
```php
PharOut::prepare();
$output->writeln('<info>[BootTrait]</info> Call standard cv bootstrap', OutputInterface::VERBOSITY_DEBUG);
\Civi\Cv\Bootstrap::singleton()->boot($this->createBootParams($input, $output));
$output->writeln('<info>[BootTrait]</info> Call core bootstrap', OutputInterface::VERBOSITY_DEBUG);
\CRM_Core_Config::singleton();
$output->writeln('<info>[BootTrait]</info> Call CMS bootstrap', OutputInterface::VERBOSITY_DEBUG);
\CRM_Utils_System::loadBootStrap(array(), FALSE);
```
`\Civi\Cv\Bootstrap::singleton()->boot()` runs and `civicrm.settings.php` is evaluated before WP is booted at `\CRM_Utils_System::loadBootStrap(array(), FALSE)`.
### Next Steps
Maybe `CIVICRM_CLEANURLS` should be part of the `$civicrm_setting` global variable instead of a constant?https://lab.civicrm.org/dev/wordpress/-/issues/133WPML URL Integration for CiviCRM2024-02-19T18:33:21ZshaneonabikeWPML URL Integration for CiviCRM## Overview
When using WPML language plugin in conjunction with CiviCRM the generated translated URLs are incorrect. All the translated URLs point to the CiviCRM page rather than the proper translated CiviCRM event, contribution, or oth...## Overview
When using WPML language plugin in conjunction with CiviCRM the generated translated URLs are incorrect. All the translated URLs point to the CiviCRM page rather than the proper translated CiviCRM event, contribution, or other page.
This isn't ideal and confusing for most users as they attempt to navigate to the translated CiviCRM page.
There is already integration for Polylang, but not integration presently for WPML.
WPML handles URLs in three different ways:
+ Attaching a language parameter to the end of the url ```lang=xyz```
+ Attaching a language in the path of the url ```https://test.dev/fr/civicrm/event/info/?reset=1&id=1```
+ Allowing for different domains for each language ```https://fr.test.dev/civicrm/event/info/?reset=1&id=1```
## Before
Viewing the page ```https://test.dev/civicrm/event/info/?reset=1&id=1```, and clicking on the WPML language link will take you to ```https://test.dev/civicrm/```
## After
The new code (I will attach the PR to this ticket shortly) will provide the proper integration for the defined scenarios above.
## Testing
I have tested this in the following scenarios, but maybe others want to test a bit larger?
+ Multiple domains while viewing (Events page)
+ Language placed in the URL (Events page)
+ Language within the proper path
+ Multisite installation with one site using WPML and CiviCRM Events
I don't believe that the path construction is any different for Contribution and other CiviCRM public pages, but I could be wrong.https://lab.civicrm.org/dev/wordpress/-/issues/131CIviCRM is incompatible with WordPress "Block Themes" because Javascript is b...2024-01-23T17:05:21ZtcmallocCIviCRM is incompatible with WordPress "Block Themes" because Javascript is broken by `wptexturize()`Certain components (in my case civicrm) embed some inline js into form templates, however some part of wordpress or civicrm picks this up and tries to html escape the content, meaning any code snippet using AND (`&&`) will not work.
The...Certain components (in my case civicrm) embed some inline js into form templates, however some part of wordpress or civicrm picks this up and tries to html escape the content, meaning any code snippet using AND (`&&`) will not work.
The specific bug we ran into was with CiviContribute: when allow other amounts is ticked the code
```js
// Putting these functions directly in template so they are available for standalone forms
function useAmountOther() {
var priceset = 'price_2';
for( i=0; i < document.Main.elements.length; i++ ) {
element = document.Main.elements[i];
if ( element.type == 'radio' && element.name == priceset ) {
```
has the last line turned into `if ( element.type == 'radio' && element.name == priceset ) {`, meaning the whole snippet fails to load and so selecting/clearing the other amount field doesn't work properly.
I cannot recreate this on the wordpress demo site, as it uses caldera forms. Our workaround was to embed the JS snippet to the bottom of the CiviCrm page, however this is not ideal.
Wordpress 6.0.2, CiviCRM 5.53.0https://lab.civicrm.org/dev/wordpress/-/issues/120Recurring contribution page on frontend tries to access wp-admin.2023-11-23T07:47:01ZdandrzejewskiRecurring contribution page on frontend tries to access wp-admin.I've got a user dashboard that includes recurring contributions. A recurring contribution has two links, cancel and view. When clicking the "view" link, the user is directed to the following URL:
https://example.org/civi/contact/view/...I've got a user dashboard that includes recurring contributions. A recurring contribution has two links, cancel and view. When clicking the "view" link, the user is directed to the following URL:
https://example.org/civi/contact/view/contributionrecur/?reset=1&id=2&cid=66&context=dashboard
This page contains two pieces, the details on the recurring contribution and the "related contributions" - i.e. the previous iterations of the recurring contribution.
However, the second part of the page only works when users have the "access the civicrm backend and API" permission, and I believe that's because the second half is retrieved using this URL:
https://example.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fcontribute%2Fcontributionrecur-payments&reset=1&id=2&cid=66&snippet=json
If I remove that permission, the user gets an error.
Additionally, and I can open a separate bug for this if it is in fact a bug, there's a "done" button on the contribution detail page. This attempts to take the user back to the civicrm "main" dashboard (on the front-end) rather than the user dashboard where we came from.
I can provide any other details, logs, etc as needed.https://lab.civicrm.org/dev/wordpress/-/issues/92Feature Request, CiviCRM Mailing, Public Page (ie. the page you use to read t...2023-02-09T16:50:04Zjustinfreeman (Agileware)Feature Request, CiviCRM Mailing, Public Page (ie. the page you use to read the email on-line) entirely bypass WordPress pages and are therefore rendered without website title, meta tags which negatively impacts sharing on social networksCurrently the CiviCRM Mailing, Public Page (ie. the page you use to read the email on-line) entirely bypass WordPress pages and are therefore rendered without website title, meta tags which negatively impacts sharing on social networks. ...Currently the CiviCRM Mailing, Public Page (ie. the page you use to read the email on-line) entirely bypass WordPress pages and are therefore rendered without website title, meta tags which negatively impacts sharing on social networks. See for example, https://civicrm.org/civicrm/mailing/view?reset=1&id=1686
If you share this page on a social network, it is expected by end users that you would see:
1. Organisation logo or at least a feature image
2. Short summary
3. Title of the newsletter
What you in fact see is very different. See for example https://developers.facebook.com/tools/debug/ using https://civicrm.org/civicrm/mailing/view?reset=1&id=1686
![screencapture-developers-facebook-tools-debug-2021-02-25-08_59_54](/uploads/d47e952a224080e34ad7d2ff08d99b3f/screencapture-developers-facebook-tools-debug-2021-02-25-08_59_54.png)
This is increasingly becoming a problem as CiviCRM sites re-share newsletters that they have recently sent out to their social networks.
The feature request is to provide a **Setting** which defines the **WordPress Page to be used to display the CiviCRM Mailing, Public Page** (ie. the page you use to read the email on-line). This is the same concept of the CiviCRM base page. On the CiviCRM Mailing page, a new shortcode would be present which is then used to render the public mailing.
The advantage of using a shortcode is that it then gives the website builder the ability to control how the page is presented, what metatags are used on that page and the template to be used for that page.
This is similar to the recent work to improve CiviCRM shortcode handling. See https://github.com/civicrm/civicrm-wordpress/pull/239 and https://lab.civicrm.org/dev/wordpress/-/issues/90
Ping @haystack and @kcristiano
Agileware Ref: CIVICRM-1662https://lab.civicrm.org/dev/wordpress/-/issues/81Synchronising WordPress Users and CiviCRM Contacts2020-11-24T15:11:13ZhaystackSynchronising WordPress Users and CiviCRM ContactsWhilst trying to clean up some logic in the CiviCRM-WordPress plugin I have come across a mismatch in how the CiviCRM-Drupal module and the CiviCRM-WordPress plugin synchronises the CMS User to the corresponding CiviCRM Contact. See [thi...Whilst trying to clean up some logic in the CiviCRM-WordPress plugin I have come across a mismatch in how the CiviCRM-Drupal module and the CiviCRM-WordPress plugin synchronises the CMS User to the corresponding CiviCRM Contact. See [this Mattermost thread](https://chat.civicrm.org/civicrm/pl/u95r1msnwinmdpne3kmjrwd8kh) for preliminary discussion.
There are currently two different types of call to `CRM_Core_BAO_UFMatch::synchronize()` happening:
1. In `CiviCRM_For_WordPress::initialize()` (set up the session)
2. In `CiviCRM_For_WordPress::invoke()` and `CiviCRM_For_WordPress_Users::sync_user()` (do a full User->Contact sync)
This is the reason for the behaviour that @totten identified and that I don't think should happen at that point, i.e.:
> If you access a `civicrm/*` page, then it autocreates a Contact.
As per the Mattermost discussion, it seems to me that the types of call should be:
1. In `CiviCRM_For_WordPress::initialize()` and `CiviCRM_For_WordPress::invoke()` (set up the session)
2. In `CiviCRM_For_WordPress_Users::sync_user()` (do a full User->Contact sync)
This pattern reverts the types of calls to their pre-4.6 state. My fault for the change back then :blush:
My proposal is to keep the calls to `CRM_Core_BAO_UFMatch::synchronize()` in both `CiviCRM_For_WordPress::initialize()` and `CiviCRM_For_WordPress::invoke()` but to make the calls indirectly via a new method in the `CiviCRM_For_WordPress_Users` class. The reason for this is that:
1. It is possible that some code calls `civi_wp()->initialize()`, `civicrm_wp_initialize()` or `civicrm_initialize()` before the WordPress User has been properly set up. I've seen this in the wild, though I can't remember where. When this happens, I don't think `CRM_Core_BAO_UFMatch::synchronize()` should be called. The `CiviCRM_For_WordPress_Users` class can keep track of the state of the WordPress User and make sure the call occurs only at the appropriate time.
2. If no calls have succeeded by the time `CiviCRM_For_WordPress::invoke()` runs, then `CRM_Core_BAO_UFMatch::synchronize()` will be called correctly when it's most definitely needed. The `CiviCRM_For_WordPress_Users` class will know if it's been called already.
I don't think this change will have any adverse effects (in fact it should have marginally beneficial effects by only calling `CRM_Core_BAO_UFMatch::synchronize()` when needed) but if anyone knows of code that expects Contacts to be created a `civicrm/*` page then shout here.haystackhaystackhttps://lab.civicrm.org/dev/wordpress/-/issues/74IPN/webhook URLs should not be localized2020-09-04T10:33:07Zmattwiremjw@mjwconsult.co.ukIPN/webhook URLs should not be localizedOn a site with polylang enabled Stripe displays an error that the webhook path is not setup correctly because it returns the first, default locale URL.
Example: https://sitename.org/en/civicrm/payment/ipn/1/
But the non-localized https...On a site with polylang enabled Stripe displays an error that the webhook path is not setup correctly because it returns the first, default locale URL.
Example: https://sitename.org/en/civicrm/payment/ipn/1/
But the non-localized https://sitename.org/civicrm/payment/ipn/1/ also works as well as other locales.
Calls to `CRM_Utils_System::url()` generate a localized URL and there doesn't seem to be a way to ask for a specific locale (or default) - see https://lab.civicrm.org/extensions/mjwshared/-/blob/master/CRM/Mjwshared/WebhookTrait.php#L27
Not sure what the solution is here - @haystack @kcristiano - it causes Stripe to display errors about webhook configuration when it doesn't need to. Updating the webhook works too but is not actually necessary.https://lab.civicrm.org/dev/wordpress/-/issues/69Add support for Capability Manager2020-08-03T18:42:42ZAndrew WestAdd support for Capability ManagerAs mentioned in [#68](https://lab.civicrm.org/dev/wordpress/-/issues/68) we're a bit nervous of the WordPress Access Control page. instead we use [PublishPress Capabilities](https://wordpress.org/plugins/capability-manager-enhanced/), wh...As mentioned in [#68](https://lab.civicrm.org/dev/wordpress/-/issues/68) we're a bit nervous of the WordPress Access Control page. instead we use [PublishPress Capabilities](https://wordpress.org/plugins/capability-manager-enhanced/), which used to be Capability Manager (and something before that, I think). It's got about 90k installations. It shows all the WP capabilities for a given role, but one role at a time - so avoiding issues with max_input_vars.
By default the Civi capabilities are mixed in with 'Additional Capabilities', which makes it hard to tell them apart from capabilities added by other plugins:
![image](/uploads/d1651bd8856939ffbd3a50983423d5f2/image.png)
So we added a filter which separates it out:
![image](/uploads/619922931af42cee6d163375252f4be7/image.png)
It's a few lines:
```
function add_civicrm_category_to_capability_manager($capabilities) {
civicrm_initialize();
$permissions = array_keys(CRM_ACL_Form_WordPress_Permissions::getPermissionArray());
sort($permissions);
capabilities['CiviCRM'] = $permissions;
return capabilities;
}
add_filter('cme_plugin_capabilities','add_civicrm_category_to_capability_manager',10,1);
```
Is this too specific to add to Core?https://lab.civicrm.org/dev/wordpress/-/issues/68Add a warning to WordPress Access Control if max_input_vars is too low2020-08-13T00:11:07ZAndrew WestAdd a warning to WordPress Access Control if max_input_vars is too lowI haven't trusted the WordPress Access Control page since I saved a change and all hell broke loose with permissions. I think this was because max_input_vars was too low in our PHP settings. This had the effect of assigning spectacular a...I haven't trusted the WordPress Access Control page since I saved a change and all hell broke loose with permissions. I think this was because max_input_vars was too low in our PHP settings. This had the effect of assigning spectacular access to roles that shouldn't have had it.
We have 23 roles and 95 permissions, so there are in theory at least 2185 variables on the page. The default for max_input_vars is 1000. I'm not sure whether empty checkboxes are submitted as variables, though.
Is this worth warning people about? It's a security risk if you don't notice.
I've written a quick check for it. Does this seem sensible? I can submit a PR, but just wanted to run it past people here.
```
//check that we aren't above max_input_vars
$maxInputVars = ini_get('max_input_vars');
$varsOnThisPage = count($permissionsArray) * count($wp_roles->role_names);
if ($varsOnThisPage > $maxInputVars) {
CRM_Core_Session::setStatus("Submitting this page may have unexpected consequences for role permissions. " .
"You should increase the max_input_vars parameter in your PHP settings. " .
"There are $varsOnThisPage options on this page, but your max_input_parameter is $maxInputVars.", 'Warning', 'alert');
}
```
(I know this particular page is in Core rather than this plugin, but the WP repo seemed like a sensible place to ask)https://lab.civicrm.org/dev/wordpress/-/issues/45Apply for listing in WordPress directory2023-12-11T12:27:09Zjoshjosh@civicrm.orgApply for listing in WordPress directoryIssue to track progress and outstanding issues related to listing CiviCRM in WP directory.Issue to track progress and outstanding issues related to listing CiviCRM in WP directory.https://lab.civicrm.org/dev/wordpress/-/issues/3Create CiviCRM Block for new Gutenberg Editor2023-12-07T22:18:11ZkcristianoCreate CiviCRM Block for new Gutenberg EditorWP is introducing a new editor in v 5.0 - https://github.com/WordPress/gutenberg
As of this post: https://make.wordpress.org/core/2018/07/06/whats-new-in-gutenberg-6th-july/ Gutenberg has been declared to be at the MVP stage and a me...WP is introducing a new editor in v 5.0 - https://github.com/WordPress/gutenberg
As of this post: https://make.wordpress.org/core/2018/07/06/whats-new-in-gutenberg-6th-july/ Gutenberg has been declared to be at the MVP stage and a merge proposal will be submitted "soon". The current target date is "august", but that can move.
Based on the above, it would be a good time to explore what will be needed to convert our CiviCRM shortcode button to a Gutenberg block.