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 - CiviCooPSep 10, 2018 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 MalcolmSep 13, 2018 at 20:37
-
Same problem here on wordpress. Don't think it works for now...– user4147Sep 17, 2018 at 18:59
-
Yeah I think they confirmed it's Drupal-only at the moment.– Andrew WestSep 17, 2018 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 HorrocksNov 2, 2018 at 15:46
4 Answers
There is the current situation with CiviMobile app and WordPress:
- New CiviMobileAPI extension(https://civicrm.org/extensions/civimobileapi) is platform independent and works for all CMS Drupal/Joomla/WP.
- But, there is an issue in standard CiviCRM API for WP. This issue prevents our extension to use API properly.
- We proposed a quick fix for this problem. Our fix was rejected by the Core Team. And they started wider discussion in few threads. Please start reading here https://github.com/civicrm/civicrm-core/pull/12813#issuecomment-428152827
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
-
1I 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. Nov 8, 2018 at 5:39
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:
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.
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[[email protected]\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.
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– MickCJul 22, 2019 at 7:49
We've updated our extension to work with https://github.com/mecachisenros/civicrm-wp-rest WP plugin. So, now if you are using WP you have to install this plugin and everything should work correctly for you. And don't forget to update our CiviMobileAPI extension to the last version.
Please feel free to write me [email protected] if you still have any questions.