Page 1 of 1

Error with discussion manager when creating a category

Posted: Thu Jan 26, 2006 2:50 pm
by hmesker
When I create a category in the downloadmanager plugin I get the following error:

Warning: Invalid argument supplied for foreach() in /home/itjingc/public_html/serendipity/plugins/serendipity_event_downloadmanager/serendipity_event_downloadmanager.php on line 1081

I deleted the plugin and reinstalled it, but that does not help. What did I do wrong this time? :?

Regards,

Harmen.

Re: Error with discussion manager when creating a category

Posted: Thu Jan 26, 2006 2:56 pm
by garvinhicking
I didn't develop this plugin, but I think there's a bug. You should be able to ignore the output, because the action should still be carried out.

Inside the plugin file you could replace this code:

Code: Select all

       function renameCats($catnames) {
        global $serendipity;
                serendipity_db_query("LOCK TABLES {$serendipity['dbPrefix']}dma_downloadmanager_categories WRITE");
                foreach ($catnames AS $id => $name) {
                        serendipity_db_query("UPDATE     {$serendipity['dbPrefix']}dma_downloadmanager_categories
                                                                        SET      payload = '".serendipity_db_escape_string($name)."'
                                                                        WHERE    node_id = ".intval($id));
                }
                serendipity_db_query("UNLOCK TABLES");
        }
with this:

Code: Select all

       function renameCats($catnames) {
        global $serendipity;
                if (!is_array($catnames)) return false;
                serendipity_db_query("LOCK TABLES {$serendipity['dbPrefix']}dma_downloadmanager_categories WRITE");
                foreach ($catnames AS $id => $name) {
                        serendipity_db_query("UPDATE     {$serendipity['dbPrefix']}dma_downloadmanager_categories
                                                                        SET      payload = '".serendipity_db_escape_string($name)."'
                                                                        WHERE    node_id = ".intval($id));
                }
                serendipity_db_query("UNLOCK TABLES");
        }
Regards,
Garvin

Posted: Thu Jan 26, 2006 3:21 pm
by hmesker
Hi Garvin,

That helped! No error message anymore! Thank you very much!

Best wishes,

Harmen.