diff --git a/CRM/Civirules/Form/Rule.php b/CRM/Civirules/Form/Rule.php
index c70b861ab89618a89c7fb3ace238e3f045f3e654..d0219cee32e00d9b068a5cc0e8926f0e9be4decf 100755
--- a/CRM/Civirules/Form/Rule.php
+++ b/CRM/Civirules/Form/Rule.php
@@ -104,7 +104,7 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
     /*
      * if add mode, set user context to form in edit mode to add conditions and actions
      */
-    if ($this->_action == CRM_Core_Action::ADD) {
+    if ($this->_action == CRM_Core_Action::ADD || $this->_action == CRM_Core_Action::UPDATE) {
       $editUrl = CRM_Utils_System::url('civicrm/civirule/form/rule', 'action=update&id='.$this->ruleId, TRUE);
       $session->pushUserContext($editUrl);
     }
@@ -290,12 +290,10 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
       'rule_id' => $this->ruleId);
     $ruleConditions = CRM_Civirules_BAO_RuleCondition::getValues($conditionParams);
     foreach ($ruleConditions as $ruleConditionId => $ruleCondition) {
-      $ruleConditions[$ruleConditionId]['name'] =
-        CRM_Civirules_BAO_Condition::getConditionLabelWithId($ruleCondition['condition_id']);
-      $ruleConditions[$ruleConditionId]['actions'] = $this->setRuleConditionActions($ruleConditionId);
-
       $conditionClass = CRM_Civirules_BAO_Condition::getConditionObjectById($ruleCondition['condition_id']);
       $conditionClass->setRuleConditionData($ruleCondition);
+      $ruleConditions[$ruleConditionId]['name'] = CRM_Civirules_BAO_Condition::getConditionLabelWithId($ruleCondition['condition_id']);
+      $ruleConditions[$ruleConditionId]['actions'] = $this->setRuleConditionActions($ruleConditionId, $conditionClass);
       $ruleConditions[$ruleConditionId]['formattedConditionParams'] = $conditionClass->userFriendlyConditionParams();
     }
     return $ruleConditions;
@@ -313,12 +311,11 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
       'rule_id' => $this->ruleId);
     $ruleActions = CRM_Civirules_BAO_RuleAction::getValues($actionParams);
     foreach ($ruleActions as $ruleActionId => $ruleAction) {
-      $ruleActions[$ruleActionId]['label'] =
-        CRM_Civirules_BAO_Action::getActionLabelWithId($ruleAction['action_id']);
-      $ruleActions[$ruleActionId]['actions'] = $this->setRuleActionActions($ruleActionId);
-
       $actionClass = CRM_Civirules_BAO_Action::getActionObjectById($ruleAction['action_id']);
       $actionClass->setRuleActionData($ruleAction);
+
+      $ruleActions[$ruleActionId]['label'] = CRM_Civirules_BAO_Action::getActionLabelWithId($ruleAction['action_id']);
+      $ruleActions[$ruleActionId]['actions'] = $this->setRuleActionActions($ruleActionId, $actionClass);
       $ruleActions[$ruleActionId]['formattedConditionParams'] = $actionClass->userFriendlyConditionParams();
 
       $ruleActions[$ruleActionId]['formattedDelay'] = '';
@@ -334,11 +331,18 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
    * Function to set the actions for each rule condition
    *
    * @param int $ruleConditionId
+   * @param CRM_Civirules_Condition $condition
    * @return array
    * @access protected
    */
-  protected function setRuleConditionActions($ruleConditionId) {
+  protected function setRuleConditionActions($ruleConditionId, CRM_Civirules_Condition $condition) {
     $conditionActions = array();
+
+    $editUrl = $condition->getExtraDataInputUrl($ruleConditionId);
+    if (!empty($editUrl)) {
+      $conditionActions[] = '<a class="action-item" title="Edit" href="'.$editUrl.'">'.ts('Edit').'</a>';
+    }
+
     $removeUrl = CRM_Utils_System::url('civicrm/civirule/form/rule_condition', 'reset=1&action=delete&rid='
       .$this->ruleId.'&id='.$ruleConditionId);
     $conditionActions[] = '<a class="action-item" title="Remove" href="'.$removeUrl.'">Remove</a>';
@@ -349,11 +353,18 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
    * Function to set the actions for each rule action
    *
    * @param int $ruleActionId
+   * @param CRM_Civirules_Action $action
    * @return array
    * @access protected
    */
-  protected function setRuleActionActions($ruleActionId) {
+  protected function setRuleActionActions($ruleActionId, CRM_Civirules_Action $action) {
     $actionActions = array();
+
+    $editUrl = $action->getExtraDataInputUrl($ruleActionId);
+    if (!empty($editUrl)) {
+      $actionActions[] = '<a class="action-item" title="Edit" href="'.$editUrl.'">'.ts('Edit').'</a>';
+    }
+
     $removeUrl = CRM_Utils_System::url('civicrm/civirule/form/rule_action', 'reset=1&action=delete&rid='
       .$this->ruleId.'&id='.$ruleActionId);
     $actionActions[] = '<a class="action-item" title="Remove" href="'.$removeUrl.'">Remove</a>';
@@ -380,7 +391,7 @@ class CRM_Civirules_Form_Rule extends CRM_Core_Form {
     }
     $ruleParams['label'] = $formValues['rule_label'];
     $ruleParams['name'] = CRM_Civirules_Utils::buildNameFromLabel($formValues['rule_label']);
-    $ruleParams['is_active'] = $formValues['rule_is_active'];
+    $ruleParams['is_active'] = $formValues['rule_is_active'] ? 1 : 0;
     $savedRule = CRM_Civirules_BAO_Rule::add($ruleParams);
     $this->ruleId = $savedRule['id'];
   }
diff --git a/CRM/CivirulesActions/Form/Form.php b/CRM/CivirulesActions/Form/Form.php
index 860438c6be6219231427caf3303b2ad98215cbe3..965380642fe8c50dd0916774a9787ce217ee72f7 100644
--- a/CRM/CivirulesActions/Form/Form.php
+++ b/CRM/CivirulesActions/Form/Form.php
@@ -56,6 +56,11 @@ class CRM_CivirulesActions_Form_Form extends CRM_Core_Form
     $this->eventClass = CRM_Civirules_BAO_Event::getPostEventObjectByClassName($this->event->class_name, true);
     $this->eventClass->setEventId($this->event->id);
 
+    //set user context
+    $session = CRM_Core_Session::singleton();
+    $editUrl = CRM_Utils_System::url('civicrm/civirule/form/rule', 'action=update&id='.$this->rule->id, TRUE);
+    $session->pushUserContext($editUrl);
+
     parent::preProcess();
 
     $this->setFormTitle();
diff --git a/CRM/CivirulesConditions/Contribution/TotalContributedAmount.php b/CRM/CivirulesConditions/Contribution/TotalContributedAmount.php
index 503ddfd70b94021c08af06afcca0c8ca139135f5..95d028a6bbd4e27bf708aa0ab2925102587ad875 100644
--- a/CRM/CivirulesConditions/Contribution/TotalContributedAmount.php
+++ b/CRM/CivirulesConditions/Contribution/TotalContributedAmount.php
@@ -28,7 +28,7 @@ class CRM_CivirulesConditions_Contribution_TotalContributedAmount extends CRM_Ci
     if ($periodEndDate) {
       $sql .= " AND DATE(`receive_date`) <= '".$periodEndDate->format('Y-m-d')."'";
     }
-    
+
     $total_amount = (float) CRM_Core_DAO::singleValueQuery($sql, $params);
     return $total_amount;
   }
diff --git a/CRM/CivirulesConditions/Form/Form.php b/CRM/CivirulesConditions/Form/Form.php
index 87e303b11111fc411fff2aed5359cdc8450155d1..7f2a463a91b332455002958d450b3e50f45cbc75 100644
--- a/CRM/CivirulesConditions/Form/Form.php
+++ b/CRM/CivirulesConditions/Form/Form.php
@@ -72,6 +72,11 @@ class CRM_CivirulesConditions_Form_Form extends CRM_Core_Form
     parent::preProcess();
 
     $this->setFormTitle();
+
+    //set user context
+    $session = CRM_Core_Session::singleton();
+    $editUrl = CRM_Utils_System::url('civicrm/civirule/form/rule', 'action=update&id='.$this->rule->id, TRUE);
+    $session->pushUserContext($editUrl);
   }
 
   /**
diff --git a/CRM/CivirulesEvent/Form/Form.php b/CRM/CivirulesEvent/Form/Form.php
index 94e2ea604efec7dfe80115b448c5143562355759..e26a1efa18a9a939d04c22333e10f40f1ee326d7 100644
--- a/CRM/CivirulesEvent/Form/Form.php
+++ b/CRM/CivirulesEvent/Form/Form.php
@@ -44,6 +44,11 @@ class CRM_CivirulesEvent_Form_Form extends CRM_Core_Form
     parent::preProcess();
 
     $this->setFormTitle();
+
+    //set user context
+    $session = CRM_Core_Session::singleton();
+    $editUrl = CRM_Utils_System::url('civicrm/civirule/form/rule', 'action=update&id='.$this->rule->id, TRUE);
+    $session->pushUserContext($editUrl);
   }
 
   /**