Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sort activities by custom field


  • squadup
    Participant

    @squadup

    Excuse me if this request is in the wrong place:

    I have added a working custom date field to my activity page by editing the post-form.php and the the bp-custom.php. This is in my bp-custom.php:

    
    // CUSTOM DATE FIELD
    function add_date_to_activity( $content, $user_id, $activity_id ) {
    bp_activity_update_meta( $activity_id,'thedate', $_POST['thedate'] );
    }
    add_action( 'bp_activity_posted_update', 'add_date_to_activity', 10, 3 );
    function my_datemeta() {
    $my_datemeta = bp_activity_get_meta( bp_get_activity_id(),'thedate' );
    if (is_user_logged_in()) : {
    echo "<span class='datefont'>" . $my_datemeta . "</span></br>";
    }
    endif;
    }
    add_action( 'bp_activity_entry_meta','my_datemeta' );
    

    Now I am trying to sort the posted activities by this date field instead of the standard sort by activity-id’s. Is there any way to override the standard sort function?

    Thanks in advance, i’d be happy to share more information if necessary

  • You must be logged in to reply to this topic.
Skip to toolbar