• I’m looking to add some metrics on Follows to a dashboard widget I’m writing for our Buddypress site.

    As far as ‘Follows’ (“Favorites”, in our case) goes, I’m looking to keep tabs on the following:

    1. Total follows
    2. Mutual follow
    3. New follows over increments of time.

    1. This is easy, $follows_total = count($wpdb->get_results( 'SELECT * FROM wp_bp_follow', OBJECT ));

    2. Not sure if there’s a SQL-selection way to count instances where there is a relationship between leader_id and follow_id between two rows in the database, or if the only way is to do the comparison in php after querying for all of the rows? Any suggestions?

    3. There’s no timestamp on follows.. so I’m either looking at adding structure to the database or saving my daily totals in another table and just comparing rows in that new table. Any suggestions?

    Also, r-a-y, trying to contact you about some contract work via your form. Not sure if it’s working or actively checked? Don’t know how else to reach ya.
    Thanks!

    https://www.ads-software.com/plugins/buddypress-followers/

Viewing 1 replies (of 1 total)
  • Plugin Author r-a-y

    (@r-a-y)

    1. You should use COUNT(*) in MySQL instead of using PHP’s count(). You should also cache this value.

    2. I haven’t really thought about this myself.

    3. There has been some talk about adding a 'follow_date' DB column to the table:
    https://github.com/r-a-y/buddypress-followers/issues/40

    I’ll probably add this column for v1.3. It will help with lookups over a certain period of time.

Viewing 1 replies (of 1 total)
  • The topic ‘Querying for BP-Follow stats’ is closed to new replies.