• 1.
    function dwqa_answer_button_action() {
  • 2.
    	$html = '';
  • 3.
    	if ( is_user_logged_in() ) {
  • 4.
    		if ( dwqa_current_user_can( 'edit_answer', get_the_ID() ) || dwqa_current_user_can( 'manage_answer' ) ) {
  • 5.
    			$parent_id = dwqa_get_question_from_answer_id();
  • 6.
    			$html .= '<a class="dwqa_edit_question" href="'. add_query_arg( array( 'edit' => get_the_ID() ), get_permalink( $parent_id ) ) .'">' . __( 'Edit', 'dwqa' ) . '</a> ';
  • 7.
    		}
  • 8.
     
  • 9.
    		if ( dwqa_current_user_can( 'delete_answer', get_the_ID() ) || dwqa_current_user_can( 'manage_answer' ) ) {
  • 10.
    			$action_url = add_query_arg( array( 'action' => 'dwqa_delete_answer', 'answer_id' => get_the_ID() ), admin_url( 'admin-ajax.php' ) );
  • 11.
    			$html .= '<a class="dwqa_delete_answer" href="'. wp_nonce_url( $action_url, '_dwqa_action_remove_answer_nonce' ) .'">' . __( 'Delete', 'dwqa' ) . '</a> ';
  • 12.
    		}
  • 13.
    	}
  • 14.
     
  • 15.
    	echo apply_filters( 'dwqa_answer_button_action', $html );
  • 16.
    }
function dwqa_answer_button_action() { $html = ''; if ( is_user_logged_in() ) { if ( dwqa_current_user_can( 'edit_answer', get_the_ID() ) || dwqa_current_user_can( 'manage_answer' ) ) { $parent_id = dwqa_get_question_from_answer_id(); $html .= '<a class="dwqa_edit_question" href="'. add_query_arg( array( 'edit' => get_the_ID() ), get_permalink( $parent_id ) ) .'">' . __( 'Edit', 'dwqa' ) . '</a> '; } if ( dwqa_current_user_can( 'delete_answer', get_the_ID() ) || dwqa_current_user_can( 'manage_answer' ) ) { $action_url = add_query_arg( array( 'action' => 'dwqa_delete_answer', 'answer_id' => get_the_ID() ), admin_url( 'admin-ajax.php' ) ); $html .= '<a class="dwqa_delete_answer" href="'. wp_nonce_url( $action_url, '_dwqa_action_remove_answer_nonce' ) .'">' . __( 'Delete', 'dwqa' ) . '</a> '; } } echo apply_filters( 'dwqa_answer_button_action', $html ); }

Copy Code to Clipboard Raw

Sign-in or Create a Free Account.

Snippi uses Twitter or Facebook to register and create accounts. Registration will enable you to keep track of your snippets. We never spam your timeline or wall. Ever.

Sign-in with Facebook Sign-in with Twitter