/** * Deletes refereces to a resource * To be used by other plugins * * @param string $plugin_name - name of the plugin calling this method * @param int $resource - resource identifier (optional if not specified all resources from this plugin will be deleted) * @param string $permission - permission of the resource (optional if not specified resources with all permissions this plugin will be deleted) * @return boolean True if the item has been deleted, false otherwise **/ function ugDeleteResource($plugin_name, $resource = "", $permission = "") { global $table_prefix, $wpdb; $table = $table_prefix . "ug_GroupsGeneric"; if (!isset($plugin_name)) { return false; } $arg = ""; if ($resource != "") { $arg .= "AND id_resource='{$resource}' "; } if ($permission != "") { $arg .= "AND permission='{$permission}' "; } if (userGroups::tableExists($table)) { $delete = "DELETE FROM {$table} WHERE plugin_name='{$plugin_name}' {$arg};"; $results = $wpdb->query($delete); return $results != ''; } else { return false; } }