Error with discussion manager when creating a category

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
hmesker
Regular
Posts: 29
Joined: Wed Jul 27, 2005 7:34 pm
Contact:

Error with discussion manager when creating a category

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Error with discussion manager when creating a category

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hmesker
Regular
Posts: 29
Joined: Wed Jul 27, 2005 7:34 pm
Contact:

Post by hmesker »

Hi Garvin,

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

Best wishes,

Harmen.
Post Reply