·
Added a discussion

Is there a block with the profiles with the most followers?

Otherwise someone could tell me the sql query to get the list with the most followers. I have currently created a block with the users with the most visits but I want the same with the followers.

This is the query I do so far: $sql = "SELECT * FROM `bx_persons_data` WHERE `picture` > 0 ORDER BY `views` DESC LIMIT 25";

  • 1093
Comments
    • Hello Antonio  !

      By default. there is no such block. And your query will show the most "viewable" persons.

      • Hi LeonidS 

        Could you help me with the query to get the most followed?

        • You may use the query from the Analytics app (modules/boonex/analytics/classes/BxAnalyticsDb.php):

          $sQuery = "SELECT `sys_profiles`.`content_id` AS `object_id`, `sys_profiles`.`type` , COUNT(`sys_profiles_conn_subscriptions`.`id`) AS `value` FROM `sys_profiles_conn_subscriptions`

          INNER JOIN `sys_profiles` ON `sys_profiles`.`id` = `sys_profiles_conn_subscriptions`.`content` WHERE sys_profiles.type='" . $sModuleName . "' AND `sys_profiles_conn_subscriptions`.`added` >= :datefrom AND `sys_profiles_conn_subscriptions`.`added` <= :dateto GROUP BY `sys_profiles`.`content_id`, `sys_profiles`.`type` ORDER BY COUNT(`sys_profiles_conn_subscriptions`.`id`) DESC LIMIT 0," . intval(getParam('bx_analytics_items_count'));

          Login or Join to comment.