Sorting broken after upgrading Pligg

Submitted by tomo on January 6, 2011 - 7:36am

If, after upgrading from an old version of Pligg to 1.1.2, you notice that the front page is sorted completely backwards and you can't change the sorting even by fiddling with the sort-query code in index.php, it may be because of the new Groups feature. A new groups table has been added and all queries join this table but the Pligg upgrader only creates the table and sets the new link_group_id to 0 for all rows in links. The solution is to populate the groups table. An easy way is to head to groups/submit/ and create a generic catchall group. Then in your database, change the group_id for the newly created row in groups to 0 (if it's 1).

If the Pligg group submitter is broken (as Pligg is prone to be buggy) then just:
INSERT INTO groups (group_id) VALUES (1);

Now those queries like:

SELECT link_id FROM links LEFT JOIN groups ON links.link_group_id = groups.group_id WHERE link_status='published' AND (groups.group_privacy!='private' OR ISNULL(groups.group_privacy) OR groups.group_id IN(1)) GROUP BY link_id ORDER BY link_published_date DESC, link_date DESC LIMIT 0,10

will work again!

© 2010-2014 Saigonist.