Jump to content

Pluginmanager Getaction Incorrect Query


Blesta Addons

Recommended Posts

the actual code is

public function getAction($plugin_id, $action) {
  $action = $this->Record->select(array("plugin_id", "action", "uri", "name"))->
   from("plugin_actions")->where("plugin_id", "=", $plugin_id)->
   where("action", "=", $action)->fetch();
  
  if ($action) {
   if ($action->options)
    $action->options = unserialize($action->options);
  }
 
  return $action;
}

this code always return error about indefined options , because is not included inthe query result . also the $action var is used as var and as result var .

 

the correct one  is

public function getAction($plugin_id, $action) {
  $query= $this->Record->select(array("plugin_id", "action", "uri", "name", "options"))->
   from("plugin_actions")->where("plugin_id", "=", $plugin_id)->
   where("action", "=", $action)->fetch();
  
  if ($query) {
   if ($query->options)
    $query->options = unserialize($query->options);
  }
 
  return $query;
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...