Exemplo n.º 1
0
/**
 * Get move reply link
 *
 * Return the move link of the reply
 *
 * @since bbPress (r4521)
 *
 * @param mixed $args This function supports these arguments:
 *  - id: Reply id
 *  - link_before: HTML before the link
 *  - link_after: HTML after the link
 *  - move_text: Move text
 *  - move_title: Move title attribute
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply() To get the reply
 * @uses current_user_can() To check if the current user can edit the
 *                           topic
 * @uses bbp_get_reply_topic_id() To get the reply topic id
 * @uses bbp_get_reply_edit_url() To get the reply edit url
 * @uses add_query_arg() To add custom args to the url
 * @uses wp_nonce_url() To nonce the url
 * @uses esc_url() To escape the url
 * @uses apply_filters() Calls 'bbp_get_reply_move_link' with the reply
 *                        move link and args
 * @return string Reply move link
 */
function bbp_get_reply_move_link($args = '')
{
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('id' => 0, 'link_before' => '', 'link_after' => '', 'split_text' => esc_html__('Move', 'bbpress'), 'split_title' => esc_attr__('Move this reply', 'bbpress')), 'get_reply_move_link');
    $reply_id = bbp_get_reply_id($r['id']);
    $topic_id = bbp_get_reply_topic_id($reply_id);
    if (empty($reply_id) || !current_user_can('moderate', $topic_id)) {
        return;
    }
    $uri = add_query_arg(array('action' => 'move', 'reply_id' => $reply_id), bbp_get_reply_edit_url($reply_id));
    $retval = $r['link_before'] . '<a href="' . esc_url($uri) . '" title="' . $r['split_title'] . '" class="bbp-reply-move-link">' . $r['split_text'] . '</a>' . $r['link_after'];
    return apply_filters('bbp_get_reply_move_link', $retval, $r);
}
Exemplo n.º 2
0
/**
 * Output URL to the reply edit page
 *
 * @since bbPress (r2753)
 *
 * @param int $reply_id Optional. Reply id
 * @uses bbp_get_reply_edit_url() To get the reply edit url
 */
function bbp_reply_edit_url($reply_id = 0)
{
    echo bbp_get_reply_edit_url($reply_id);
}