Skip to:

Sort activities by nnumber of likes

  • ntonirulez


    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( 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:

    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)
  • The topic ‘Sort activities by nnumber of likes’ is closed to new replies.
Skip to toolbar