ap_comment_actions( object|integer $comment )

Description #

Comment actions args.

Parameters #

  • $comment
    object | integer (Required) Comment object.

Source #

File: includes/comments.php

266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
function ap_comment_actions( $comment ) {
    $comment = get_comment( $comment );
    $actions = array();
 
    if ( ap_user_can_edit_comment( $comment->comment_ID ) ) {
        $actions[] = array(
            'title' => __( 'Edit this Comment', 'anspress-question-answer' ),
            'label' => __( 'Edit', 'anspress-question-answer' ),
            'href'  => '#',
            'query' => array(
                'action'     => 'comment_modal',
                '__nonce'    => wp_create_nonce( 'edit_comment_' . $comment->comment_ID ),
                'comment_id' => $comment->comment_ID,
            ),
        );
    }
 
    if ( ap_user_can_delete_comment( $comment->comment_ID ) ) {
        $actions[] = array(
            'title' => __( 'Delete this Comment', 'anspress-question-answer' ),
            'label' => __( 'Delete', 'anspress-question-answer' ),
            'href'  => '#',
            'query' => array(
                '__nonce'        => wp_create_nonce( 'delete_comment_' . $comment->comment_ID ),
                'ap_ajax_action' => 'delete_comment',
                'comment_id'     => $comment->comment_ID,
            ),
        );
    }
 
    if ( '0' === $comment->comment_approved && ap_user_can_approve_comment() ) {
        $actions[] = array(
            'title' => __( 'Approve this Comment', 'anspress-question-answer' ),
            'label' => __( 'Approve', 'anspress-question-answer' ),
            'href'  => '#',
            'query' => array(
                '__nonce'        => wp_create_nonce( 'approve_comment_' . $comment->comment_ID ),
                'ap_ajax_action' => 'approve_comment',
                'comment_id'     => $comment->comment_ID,
            ),
        );
    }
 
    /**
     * For filtering comment action buttons.
     *
     * @param array $actions Comment actions.
     * @since   2.0.0
     */
    return apply_filters( 'ap_comment_actions', $actions );
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment