activa Posted January 10, 2016 Report Share Posted January 10, 2016 No I don't use the json config file I put it in the module class itself. here is the function: /** * Returns the key used to identify the primary field from the set of module row meta fields. * This value can be any of the module row meta fields. * * @return string The key used to identify the primary field from the set of module row meta fields */ public function moduleRowMetaKey() { return "server_key"; } I don't know if it has existed before in my dev blesta db(and I have changed alot since then) so what do you think it is? as I cannot pin it down to any function besides the one above when trying to edit/add a package with the module. what you have in addModuleRow() ? normally you should have server_key field saved in database . Quote Link to comment Share on other sites More sharing options...
timnboys Posted January 10, 2016 Author Report Share Posted January 10, 2016 what you have in addModuleRow() ? normally you should have server_key field saved in database . /** * Adds the module row on the remote server. Sets Input errors on failure, * preventing the row from being added. * * @param array $vars An array of module info to add * @return array A numerically indexed array of meta fields for the module row containing: * - key The key for this meta field * - value The value for this key * - encrypted Whether or not this field should be encrypted (default 0, not encrypted) */ public function addModuleRow(array &$vars) { $meta_fields = array("oneauthstring","one_xmlrpc","hostname"); $encrypted_fields = array("oneauthstring","one_xmlrpc","hostname"); $this->Input->setRules($this->getRowRules($vars)); // Validate module row if ($this->Input->validates($vars)) { // Build the meta data for this row $meta = array(); foreach ($vars as $key => $value) { if (in_array($key, $meta_fields)) { $meta[] = array( 'key' => $key, 'value' => $value, 'encrypted' => in_array($key, $encrypted_fields) ? 1 : 0 ); } } return $meta; } } I have the above in my addmodulerow function. Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted January 11, 2016 Report Share Posted January 11, 2016 /** * Adds the module row on the remote server. Sets Input errors on failure, * preventing the row from being added. * * @param array $vars An array of module info to add * @return array A numerically indexed array of meta fields for the module row containing: * - key The key for this meta field * - value The value for this key * - encrypted Whether or not this field should be encrypted (default 0, not encrypted) */ public function addModuleRow(array &$vars) { $meta_fields = array("oneauthstring","one_xmlrpc","hostname"); $encrypted_fields = array("oneauthstring","one_xmlrpc","hostname"); $this->Input->setRules($this->getRowRules($vars)); // Validate module row if ($this->Input->validates($vars)) { // Build the meta data for this row $meta = array(); foreach ($vars as $key => $value) { if (in_array($key, $meta_fields)) { $meta[] = array( 'key' => $key, 'value' => $value, 'encrypted' => in_array($key, $encrypted_fields) ? 1 : 0 ); } } return $meta; } } I have the above in my addmodulerow function. try changing public function moduleRowMetaKey() { return "server_key"; } to public function moduleRowMetaKey() { return "hostname"; } Michael and timnboys 2 Quote Link to comment Share on other sites More sharing options...
timnboys Posted January 11, 2016 Author Report Share Posted January 11, 2016 try changing public function moduleRowMetaKey() { return "server_key"; } to public function moduleRowMetaKey() { return "hostname"; } your a genuis! Thanks for that help as with that help I was able to get it working! Michael 1 Quote Link to comment Share on other sites More sharing options...
Tyson Posted January 11, 2016 Report Share Posted January 11, 2016 Just FYI, the method moduleRowMetaKey must return a valid module row meta key used in your module. Your module only defines these values: $meta_fields = array("oneauthstring","one_xmlrpc","hostname"); i.e. "oneauthstring", "one_xmlrpc", and "hostname" Since "server_key" is not one of these values, it is the cause of the error you encountered. Michael 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.