function bbp_update_reply_to($reply_id = 0, $reply_to = 0)
{
    // Validation
    $reply_id = bbp_get_reply_id($reply_id);
    $reply_to = bbp_validate_reply_to($reply_to);
    // Update or delete the `reply_to` postmeta
    if (!empty($reply_id)) {
        // Update the reply to
        if (!empty($reply_to)) {
            update_post_meta($reply_id, '_bbp_reply_to', $reply_to);
            // Delete the reply to
        } else {
            delete_post_meta($reply_id, '_bbp_reply_to');
        }
    }
    return (int) apply_filters('bbp_update_reply_to', (int) $reply_to, $reply_id);
}
Beispiel #2
0
/**
 * Return the value of reply to field
 *
 * @since bbPress (r4944)
 *
 * @uses bbp_get_reply_id() To validate the reply to
 * @uses apply_filters() Calls 'bbp_get_form_reply_to' with the reply to
 * @return string Value of reply to field
 */
function bbp_get_form_reply_to()
{
    // Set initial value
    $reply_to = 0;
    // Get $_REQUEST data
    if (isset($_REQUEST['bbp_reply_to'])) {
        $reply_to = bbp_validate_reply_to($_REQUEST['bbp_reply_to']);
    }
    // If empty, get from meta
    if (empty($reply_to)) {
        $reply_to = bbp_get_reply_to();
    }
    return (int) apply_filters('bbp_get_form_reply_to', $reply_to);
}