Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • For anyone that goes looking for this in the future here is something I threw together – it should be a good starting point.

    If you put what’s below in your functions file, your activity wall will only show _oembed_ activity.

    `
    add_filter( ‘bp_activity_get_user_join_filter’, ‘videos_filter_sql’, 10, 6 );
    add_filter( ‘bp_activity_total_activities_sql’, ‘videos_filter_sql_count’, 10, 3 );

    function videos_filter_sql_count( $sql, $where_sql, $sort ) {
    global $bp, $wpdb;

    if ( !empty( $bp->loggedin_user->is_super_admin ) && $bp->loggedin_user->is_super_admin )
    return $sql;

    $sql = $wpdb->prepare( “SELECT count(a.id) FROM {$bp->activity->table_name} a
    LEFT JOIN {$bp->activity->table_name_meta} m ON m.activity_id = a.id {$where_sql} AND (m.meta_key REGEXP ‘^_oembed_’) ORDER BY a.date_recorded {$sort}” );
    return $sql;
    }

    function videos_filter_sql( $sql, $select_sql, $from_sql, $where_sql, $sort, $pag_sql=” ) {
    global $bp, $wpdb;

    if ( !empty( $bp->loggedin_user->is_super_admin ) && $bp->loggedin_user->is_super_admin )
    return $sql;

    $from_sql .= ” LEFT JOIN {$bp->activity->table_name_meta} m ON m.activity_id = a.id”;
    $where_sql .= $wpdb->prepare( ” AND (m.meta_key REGEXP ‘^_oembed_’)” );

    if ( !empty( $pag_sql ) )
    $sql = $wpdb->prepare( “{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}” );
    else
    $sql = $wpdb->prepare( “{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort}” );

    return $sql;
    }`

    @r-a-y thanks very much!

    Hopefully @r-a-y looks at this. I don’t mind coding my own solution, just that I am not sure where the smartest place to hook into is.

    I can see parse_oembed is only called from bp-core-classes.php in the shortcode function and this is what confuses me…

    Me, five

    If anyone is looking for this, I have written a simple solution to the problem where I mimic the Activity stream “Favorite” feature from the single.php theme file of my blog theme to allow marking blog posts as favorite…

    http://www.dnxpert.com/2010/06/11/mark-blog-post-as-favorite-in-buddypress/

    This way, I don’t create any new tables and I don’t break anything – as I hope that marking a blog post as favorite will become a key feature of BP in the future.

Viewing 5 replies - 1 through 5 (of 5 total)
Skip to toolbar