4

Does the CiviMobile Android app work with Wordpress based CiviCRM? When I enter my username and password and site URL into the login screen of CiviMobile, it just shows "Unknown error". But the demo account works fine.

  • Thanks for your question Jeremy! It will help peeps here to give you a helpful answer if you tell us what settings you have entered and what version of WP you are using. Also, do you have multi-language switched on in your CiviCRM? – ErikH - CiviCooP Sep 10 '18 at 7:59
  • It's version 4.9.8 and my settings in the mobile app are literally just the URL (base URL of my website), and an admin username and password. There are no settings required for the CiviCRM extension. I don't have multi-language switched on. – Jeremy Malcolm Sep 13 '18 at 20:37
  • Same problem here on wordpress. Don't think it works for now... – DirkVanRoy Sep 17 '18 at 18:59
  • Yeah I think they confirmed it's Drupal-only at the moment. – Andrew West Sep 17 '18 at 21:40
  • Make sure you are downloading the correct extension. The one in the Available extensions here (com.webaccessglobal.module.civimobile) is NOT the correct one. – Tony Horrocks Nov 2 '18 at 15:46
3

There is the current situation with CiviMobile app and WordPress:

As now, we are still working on quick API patch for WP. I hope it will be available in the next few days. I will let you know as soon as it is ready.

As a long-term solution, we need a permanent fix which will be approved by the Core Team and included into standard CiviCRM code (see the issue above).

Thank you, Sergiy

  • I have this same issue, new CiviCRM user and your extension is a killer app for our organisation. Just wondering if there is a temporary fix you know of that I could deploy to get this working before you commit a permanent one? Thanks. – Dylan Knoll Nov 8 '18 at 5:39
1

There is a quick patch for WordPress:

I. Overview:

In order to make the API working properly for WordPress you need to change only one file “wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php”. We prepared command line script to automate this change.

II. Patch:

  1. Before the start, the script will make a backup of REST.php by creating file REST.php.bak. You still may make your own backup copy to be able to restore this file in case of something goes wrong.

  2. Run patch:

If you use MacOS or Linux System, just run this command from the project root folder:

cm_line='=================================';echo'';echo'';echo "$cm_line";cm_ext_path='wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php';start=$(echo $(grep -on 'buildParamList() {' "$cm_ext_path" | sed "s/:buildParamList() {//"););end=$(echo $(grep -on 'ajaxJson() {' "$cm_ext_path" | sed "s/:ajaxJson() {//"););sed -i.bak "$(echo $start),$(echo $end) s#json_decode(\$requestParams\['json'\]#json_decode(stripslashes(\$requestParams\[\'json\'\])#" "$cm_ext_path";if [[ $(grep -c json_decode\(stripslashes "$cm_ext_path") -eq 1 ]] ; then echo -e '\033[1mWordPress API has been patched successfully.\033[0m';echo -e 'Now you may start using \033[1mCiviMobile\033[0m!'; else echo -e '\033[1mSomething went wrong.\033[0m';echo -e 'Please copy the error message, if any, and contact us at \033[1mcivicrm@agiliway.com\033[0m  so we can help you.';fi;echo "$cm_line";echo'';echo'';

If you use Windows system, you shall manually change a part of the text in wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php Please find:

*$params = json_decode($requestParams['json'], TRUE);*

And change it to:

*$params = json_decode(stripslashes($requestParams['json']), TRUE);*

III. Rollback: In case something went wrong, please restore file

wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php from

wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php.bak or from your own copy

This should work. Please let me know if any question.

1

the patch worked to enable CiviMobile, however we've just discovered it created a problem for CiviMail when using Mosaico template builder extension. See CiviMail error: "Sorry an error occurred and your information was not saved" I resolved it simply by restoring REST.php.

I assume the problem is that Mosaico 'needs' the slashes that 'stripslashes' removes. I wonder if there is some condition that could wrap around the statement to switch between the original and 'stripslashes' version of the statement e.g.

  • if CiviMobile is calling REST.api, use 'stripslashes' statement else use normal
  • if CiviMail is calling REST.api, use normal else use 'stripslashes' statement

Thanks for your help.

  • Hi @sergiy-korniyenko, unfortunately my issue persists as above - Mosaico templates will not save with that change to REST.php Is there another way, e.g. wrap a condition around that clause as suggested above? Thanks – MickC yesterday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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