ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the correct way to add a new action to the current list of actions?

Is there a specific EE method to add a new action? Or is it just direct database manipulation(that is, add it via SQL)?

share|improve this question
up vote 5 down vote accepted

Usually it's done on the install method of your addon. Best practice is to take advantage of ActiveRecord and a db->insert:

$data = array(
    'class' => $this->class,
    'method' => $method

ee()->db->insert('actions', $data);

You don't need to specify an ACTion ID as this is auto incremented.

You can find a bit more information in the docs for Module Installation.

share|improve this answer
since v2.6 uses new super global: ee()->db->insert('actions', $data); – Peter Lewis Jun 10 '14 at 14:44
Could you submit your updated code as another answer for clarity? – Andrew from Rye Jun 10 '14 at 14:51
Whoops, thanks Peter, well spotted. :) Andrew, Peter has already outlined the updated way of using EE's super global method but I've updated my answer to reflect that. – Ian Jun 10 '14 at 19:11
Ah, I guess inserting the action to the database directly is the par of course. – arvinsim Jun 11 '14 at 3:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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