Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sort activities by nnumber of likes

  • I’m looking for it. The problem is hard. In function get from Class BP_Activity_Activity, sort is hard-coded:

    $total_activities = $wpdb->get_var( $wpdb->prepare( “SELECT count(a.id) FROM {$bp->activity->table_name} a {$where_sql} ORDER BY a.date_recorded {$sort}” ) );

    so that cannot override that sort by time. Plus, likes data are stored in a wp_bp_activity_meta tag, which as I look into phpmyadmin are non-column mapped in sql:

    i.e.:
    6 93 liked_count a:1:{i:1;s:10:”user_likes”;}

    which is not sortable at all. So the only (efficient) way is to build up a new like database, triggered on each bp_like_add_user_like, and bp_like_remove_user_like. But still, there is no filter available to trigger anything here. I’m afraid that the only way to achieve this behaviour is by hacking plugin’s code or propose to add a filter to the main code and write a new plugin/widget which uses it.

    Any suggestion?

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.