Answers.Body: <p>In <a href="https://docs.civicrm.org/civirules/en/latest/create-your-own-action/" rel="nofollow noreferrer">Create your own action</a> you find a description for extending CiviRules with a custom action. The example action <em>SoftDelete</em> has the class <code>CRM_CivirulesActions_Contact_SoftDelete</code> should be placed in the file
   <code>../ext/org.civicoop.civirules/CRM/CivirulesActions/Contact/SoftDelete.php</code></p>
  
  <p>It is also possible to add a custom action to your own extension. An example of such an extension can be found at <a href="https://github.com/CiviCooP/org.civicoop.wpcivirules" rel="nofollow noreferrer">https://github.com/CiviCooP/org.civicoop.wpcivirules</a> . (But be aware old versions of CiviRules worked with managed entities (<code>*.mgd.php</code>) files. This still works but the latest version works with direct sql statements).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-31T05:36:25.167Z
Answers.Text: It sounds like I am on the right path, but unfortunately it's still not working. I've placed my custom action (AddMembership.php) in the CivirulesActions folder and I'm still getting the same error message. The example in the create your own action doesn't seem too difficult so I'm not sure where I'm going wrong. Here is a link to my action. [link] https://gist.github.com/jimmy-tdr/6818c315ce44f7dda79778751a4be1be
Answers.UserDisplayName: Jimmy Penlesky
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-27T06:32:42.827Z
Answers.LastActivityDate: 2018-07-27T06:32:42.827Z
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.Body: <p>The class name relates directly to the path where that class should be found. Placing the file containing your class directly into <code>CRM/CivirulesActions</code> won't work.</p>
  <p>Your class name in the gist you posted is <code>CRM_CivirulesActions_EA_Membership_Add</code>, which means Civi expects to find the class in this location:</p>
  <pre><code>CRM/CivirulesActions/EA/Membership/Add.php
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-17T13:27:22.970Z
Answers.Text: I assume your second proposal is not necessary, as in this page (https://docs.civicrm.org/civirules/en/latest/create-your-own-action/) the name of the action in the database is contact_soft_delete but the class name is CRM_CivirulesActions_Contact_SoftDelete which indicates the php class file is stored in CRM/CivirulesActions/Contact/SoftDelete.php (not contact_soft_delete.php)
Answers.UserDisplayName: emma
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-01T04:29:39.607Z
Answers.Text: You're right, I've edited the answer accordingly (and removed some words for clarity).
Answers.UserDisplayName: Jude Hungerford
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-05T05:07:48.570Z
Answers.LastActivityDate: 2024-02-01T04:32:02.733Z
Answers.LastEditDate: 2024-02-01T04:32:02.733Z
Answers.UserDisplayName: Jude Hungerford
Body: <p>I'm running into some trouble adding my own CiviRule action. I've been able to add the action to the civirule_action table and confirmed it's showing up in the list of actions in the UI. Whenever I try to save the action in a rule I get the error, "Not a valid action, action class is missing".</p>
  
  <p>I'm not sure if I have placed my php class file in the right location or if something else needs to be done. I'm running Wordpress 4.9.7, CiviCRM 5.2.2, and CiviRules 2.1. The php file is placed in /wp-content/plugins/files/civicrm/org.civicoop.civirules/CRM/CivirulesActions/</p>
  
  <p>What could I be missing?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-27T06:13:34.200Z
Comments.Text: To be sure. I think the path is ... files/civicrm/ext/org.civicoop.civirules/CRM/CivirulesActions/
Comments.UserDisplayName: Kainuk - CiviCooP
Tags: <civirules>
Title: Trouble adding custom CiviRule action
ThreadText: # Trouble adding custom CiviRule action
  
  (Asked by: username_0 on 2018-07-25)
  
  I'm running into some trouble adding my own CiviRule action. I've been able to add the action to the civirule\_action table and confirmed it's showing up in the list of actions in the UI. Whenever I try to save the action in a rule I get the error, "Not a valid action, action class is missing".
  
  I'm not sure if I have placed my php class file in the right location or if something else needs to be done. I'm running Wordpress 4.9.7, CiviCRM 5.2.2, and CiviRules 2.1. The php file is placed in /wp-content/plugins/files/civicrm/org.username_1.civirules/CRM/CivirulesActions/
  
  What could I be missing?
  
  **Tags:** civirules
  
  > **Comments:**
  > **username_1**: To be sure. I think the path is ... files/civicrm/ext/org.username_1.civirules/CRM/CivirulesActions/  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-07-27. Score: 1
  
  In [Create your own action](https://docs.civicrm.org/civirules/en/latest/create-your-own-action/) you find a description for extending CiviRules with a custom action. The example action *SoftDelete* has the class `CRM_CivirulesActions_Contact_SoftDelete` should be placed in the file
  `../ext/org.username_1.civirules/CRM/CivirulesActions/Contact/SoftDelete.php`
  
  It is also possible to add a custom action to your own extension. An example of such an extension can be found at <https://github.com/username_1/org.username_1.wpcivirules> . (But be aware old versions of CiviRules worked with managed entities (`*.mgd.php`) files. This still works but the latest version works with direct sql statements).
  
  > **Comments:**
  > **username_0**: It sounds like I am on the right path, but unfortunately it's still not working. I've placed my custom action (AddMembership.php) in the CivirulesActions folder and I'm still getting the same error message. The example in the create your own action doesn't seem too difficult so I'm not sure where I'm going wrong. Here is a link to my action. [link] https://gist.github.com/username_0-tdr/6818c315ce44f7dda79778751a4be1be  
  
  ---
  
  ### Answer by username_2 on 2018-10-05. Score: 0
  
  The class name relates directly to the path where that class should be found. Placing the file containing your class directly into `CRM/CivirulesActions` won't work.
  
  Your class name in the gist you posted is `CRM_CivirulesActions_EA_Membership_Add`, which means Civi expects to find the class in this location:
  
  ```
  CRM/CivirulesActions/EA/Membership/Add.php
  
  ```
  
  > **Comments:**
  > **username_3**: I assume your second proposal is not necessary, as in this page (https://docs.civicrm.org/civirules/en/latest/create-your-own-action/) the name of the action in the database is contact_soft_delete but the class name is CRM_CivirulesActions_Contact_SoftDelete which indicates the php class file is stored in CRM/CivirulesActions/Contact/SoftDelete.php (not contact_soft_delete.php)  
  > **username_2**: You're right, I've edited the answer accordingly (and removed some words for clarity).  
  
  ---
  
  