Answers.Body: <p>There is the current situation with CiviMobile app and WordPress:</p>
  
  <ul>
  <li>New CiviMobileAPI extension(<a href="https://civicrm.org/extensions/civimobileapi" rel="nofollow noreferrer">https://civicrm.org/extensions/civimobileapi</a>) is platform independent and works for all CMS Drupal/Joomla/WP.    </li>
  <li>But, there is an issue in standard CiviCRM API for WP. This issue prevents our extension to use API properly.  </li>
  <li>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 <a href="https://github.com/civicrm/civicrm-core/pull/12813#issuecomment-428152827" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/12813#issuecomment-428152827</a></li>
  </ul>
  
  <p>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.</p>
  
  <p>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).</p>
  
  <p>Thank you,
   Sergiy</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-08T05:39:13.800Z
Answers.Text: 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.
Answers.UserDisplayName: Dylan Knoll
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-02T12:10:24.513Z
Answers.LastActivityDate: 2018-11-02T12:10:24.513Z
Answers.UserDisplayName: Sergiy Korniyenko
Answers.Body: <p>the patch worked to enable CiviMobile, however we've just discovered it created a problem for CiviMail when using Mosaico template builder extension.
  See <a href="https://civicrm.stackexchange.com/questions/27203/civimail-error-sorry-an-error-occurred-and-your-information-was-not-saved">CiviMail error: &quot;Sorry an error occurred and your information was not saved&quot;</a>
  I resolved it simply by restoring REST.php.</p>
  
  <p>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.</p>
  
  <ul>
  <li>if CiviMobile is calling REST.api, use 'stripslashes' statement else use normal </li>
  <li>if CiviMail is calling REST.api, use normal else use 'stripslashes' statement</li>
  </ul>
  
  <p>Thanks for your help.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-22T07:49:31.930Z
Answers.Text: 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
Answers.UserDisplayName: MickC
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-23T02:26:20.837Z
Answers.LastActivityDate: 2019-05-23T02:26:20.837Z
Answers.UserDisplayName: MickC
Answers.Body: <p>There is a quick patch for WordPress:</p>
  
  <p><strong>I. Overview:</strong></p>
  
  <p>In order to make the API working properly for WordPress you need to change only one file “<em>wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php</em>”.
  We prepared command line script to automate this change. </p>
  
  <p><strong>II. Patch:</strong></p>
  
  <ol>
  <li><p>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.</p></li>
  <li><p>Run patch:</p></li>
  </ol>
  
  <p><strong>If you use MacOS or Linux System</strong>, just run this command from the project root folder:</p>
  
  <pre><code>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'';
  </code></pre>
  
  <p><strong>If you use Windows system</strong>, you shall manually change a part of the text in wp-<em>content/plugins/civicrm/civicrm/CRM/Utils/REST.php</em>
  Please find:</p>
  
  <pre><code>*$params = json_decode($requestParams['json'], TRUE);*
  </code></pre>
  
  <p>And change it to:</p>
  
  <pre><code>*$params = json_decode(stripslashes($requestParams['json']), TRUE);*
  </code></pre>
  
  <p><strong>III. Rollback:</strong>
  In case something went wrong, please restore file</p>
  
  <p><em>wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php</em> from</p>
  
  <p><em>wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php.bak</em> or from your own copy</p>
  
  <p>This should work.
  Please let me know if any question.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-09T15:57:46.313Z
Answers.LastActivityDate: 2018-11-09T15:57:46.313Z
Answers.UserDisplayName: Sergiy Korniyenko
Answers.Body: <p>We've updated our extension to work with <a href="https://github.com/mecachisenros/civicrm-wp-rest" rel="nofollow noreferrer">https://github.com/mecachisenros/civicrm-wp-rest</a> 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.</p>
  
  <p>Please feel free to write me andriy.stabryn@agiliway.com if you still have any questions.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-22T10:07:08.757Z
Answers.LastActivityDate: 2019-08-22T10:07:08.757Z
Answers.UserDisplayName: Andrew Stabryn
Body: <p>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.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-10T07:59:28.217Z
Comments.Text: 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?
Comments.UserDisplayName: ErikH - CiviCooP
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-13T20:37:26.743Z
Comments.Text: 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.
Comments.UserDisplayName: Jeremy Malcolm
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-17T21:40:34.737Z
Comments.Text: Yeah I think they confirmed it's Drupal-only at the moment.
Comments.UserDisplayName: Andrew West
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-02T15:46:20.193Z
Comments.Text: Make sure you are downloading the correct extension. The one in the Available extensions here (com.webaccessglobal.module.civimobile) is NOT the correct one.
Comments.UserDisplayName: Tony Horrocks
Tags: <mobile>
Title: CiviMobile "unknown error" on Wordpress
ThreadText: # CiviMobile "unknown error" on Wordpress
  
  (Asked by: username_0 on 2018-09-09)
  
  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.
  
  **Tags:** mobile
  
  > **Comments:**
  > **username_1**: 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?  
  > **username_0**: 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.  
  > **username_2**: Yeah I think they confirmed it's Drupal-only at the moment.  
  > **username_3**: Make sure you are downloading the correct extension. The one in the Available extensions here (com.webaccessglobal.module.civimobile) is NOT the correct one.  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_4 on 2018-11-02. Score: 3
  
  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
  
  > **Comments:**
  > **username_5**: 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.  
  
  ---
  
  ### Answer by username_6 on 2019-05-23. Score: 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"](https://civicrm.stackexchange.com/questions/27203/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.
  
  > **Comments:**
  > **username_6**: 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  
  
  ---
  
  ### Answer by username_4 on 2018-11-09. Score: 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:
  
  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[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.
  
  
  ---
  
  ### Answer by username_7 on 2019-08-22. Score: 0
  
  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 andriy.stabryn@agiliway.com if you still have any questions.
  
  
  ---
  
  