Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show the customfields on BBPress


  • eigodeasobo
    Participant

    @eigodeasobo

    Hi,

    I added Customfields to BBpress reply form by this code:

    //Input on BBP reply form
    function bbp_extra_reply_fields() {
    $custom = get_post_meta( bbp_get_reply_id(), 'bbp_custom', true);
    echo '<fieldset class="bbp-form bbp-form-add">';
    echo "<p><input id='bbp_reply_custom' type='text' name='bbp_custom' value='".$custom."'></p>";
    echo '</fieldset>';
    }
    add_action ( 'bbp_theme_before_reply_form_content', 'bbp_extra_reply_fields');
    
    //Register to Detabase
    add_action( 'bbp_new_reply', 'bbp_save_reply_extra_fields', 10, 1 );
    add_action( 'bbp_edit_reply', 'bbp_save_reply_extra_fields', 10, 1 );
    function bbp_save_reply_extra_fields( $reply_id ) {
    if (isset($_POST) && $_POST['bbp_custom']!='') {
    update_post_meta( $reply_id, 'bbp_custom', $_POST['bbp_custom'] );
    }
    }
    
    //Output to BBP reply
    function inputBBPreply_outputBBPreply() {
    $reply_id = bbp_get_reply_id();
    $reply_custom = get_post_meta( $reply_id, 'reply_custom', true);
    return '<div>'.$reply_custom.'</div>';
    }
    
    //Output to Buddypress activity
    function inputBBPreply_outputBPactivity() {
    //What should I write?
    }

    But this code dose not show at BuddyPress activity.

    What should I write?

    Thanks

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