Support » Plugin: BuddyPress Activity Stream Bump to Top » WORKING ALTERNATIVE!

  • Hi everyone,

    I found a working alternative here – http://solvemyquest.com/move-new-commented-activity-stream-to-top/

    Just add the code to your bpcustom.php file. No idea what that is? Go to your plugins folder in Cpanel or via FTP and create a file called bpcustom.php. This is where you can add custom codes for Buddypress that will not be overwritten when updating Buddypress.

    Please be sure to comment at solvemyquest.com and thank the author for the fix. 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • Update – as of today there is an issue posting comments at solvemyquest.com, also the contact us page is blank lol. Please try to thank them, I’m sure it’ll be fixed up soon 🙂

    Hello Jbakuk

    I was in bit urgent to get the solution works, when i try access this http://solvemyquest.com/move-new-commented-activity-stream-to-top/

    I am getting the HTTP Error 500.0 – Internal Server Error , Can you please post your answer if you have with you .

    • This reply was modified 3 years, 1 month ago by Karthick Dev.

    Hi @karthick-dev,

    Looks like the site is having issues, or worse still has closed down which would be a shame.

    Sorry I am on mobile right now, I will post the code here tomorrow.

    @karthick-dev this is the code from solvemyquest.com, the site is still down. It works for me so I’d guess it’ll work for anyone. It’s not my code though so I can’t offer any support, give it a try.

    function smquest_bp_activity_bump_comment_posted( $comment_id, $params )
    {
    global $bp, $wpdb;

    extract( $params, EXTR_SKIP );

    $activity_parent = bp_activity_get_specific( array( ‘activity_ids’ => $activity_id ) );

    if ( !$activity_parent = $activity_parent[‘activities’][0] )
    return;

    if ( smquest_bp_activity_bump_denied_activity_type_check( $activity_parent->type ) )
    return;

    if ( !smquest_bp_activity_bump_denied_user_check() )
    return;

    //be nice and save the date_recorded
    if ( !bp_activity_get_meta( $activity_id, ‘bp_activity_bump_date_recorded’) )
    bp_activity_update_meta( $activity_id, ‘bp_activity_bump_date_recorded’, $activity_parent->date_recorded );

    $activity = new BP_Activity_Activity( $activity_id );
    $activity->date_recorded = gmdate( “Y-m-d H:i:s” );
    if ( !$activity->save() )
    return false;
    }
    add_action( ‘bp_activity_comment_posted’, ‘smquest_bp_activity_bump_comment_posted’, 1, 2 );

    function smquest_bp_activity_bump_time_since( $content, $activity )
    {
    global $bp;
    if ( !$bumpdate = bp_activity_get_meta( $activity->id, ‘bp_activity_bump_date_recorded’) )
    return $content;
    $content = ‘<span class=”time-since”>’ . sprintf( __( ‘ updated %s’, ‘bp-activity-bump’ ), bp_core_time_since( $activity->date_recorded ) ) . ‘</span>’;
    return apply_filters( ‘etivite_bp_activity_bump_time_since’, ‘<span class=”time-since time-created”>’ . sprintf( __( ‘ %s’, ‘buddypress’ ), bp_core_time_since( $bumpdate ) ) . ‘</span> · ‘ . $content, $activity->date_recorded, $bumpdate, $content );
    }
    add_filter( ‘bp_activity_time_since’, ‘smquest_bp_activity_bump_time_since’, 1, 2 );

    function smquest_bp_activity_bump_denied_activity_type_check( $type )
    {
    $types = (array) maybe_unserialize( get_option( ‘bp_activity_bump_denied_activity_types’) );
    return in_array( $type, apply_filters( ‘smquest_bp_activity_bump_denied_activity_types’, $types ) );
    }

    function smquest_bp_activity_bump_denied_user_check()
    {
    global $bp;
    //all, super, wp_cap
    $types = maybe_unserialize( get_option( ‘bp_activity_bump_denied_user_types’) );
    if ( $types && ( $types[‘super_admin’] || $types[‘user_cap’] ) )
    {
    if ( current_user_can( $types[‘user_cap’] ) )
    return true;

    if ( $types[‘super_admin’] && $bp->loggedin_user->is_super_admin )
    return true;

    return false;
    }

    return true;
    }

    Sweeny

    (@sweeny)

    Hi!

    @jbakuk
    I would like to bump top level activity item to the top of Activity Stream when a new child comment is added to it.

    Does this code works like this?
    Does this code change the sorting of old messages with the installing this code?

    Kind regards
    Alex

    jbakuk

    (@jbakuk)

    Hi Alex (@sweeny),

    Yes this code will bump an activity item when a new comment is added. I suggest you add the code & try it out to see for yourself.

    I don’t think it will affect older activity items, only new ones as they happen.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WORKING ALTERNATIVE!’ is closed to new replies.