• 1.
    function dwqa_question_button_action() {
  • 2.
    	$html = '';
  • 3.
    	if ( is_user_logged_in() ) {
  • 4.
    		$ID = get_the_ID();
  • 5.
    		$status = get_post_status( $ID );
  • 6.
    		$followed = dwqa_is_followed() ? 'followed' : 'follow';
  • 7.
    		$text = __( 'Subscribe', 'dwqa' );
  • 8.
    		$html .= '<label for="dwqa-favorites">';
  • 9.
    		$html .= '<input type="checkbox" id="dwqa-favorites" data-post="'. $ID .'" data-nonce="'. wp_create_nonce( '_dwqa_follow_question' ) .'" value="'. $followed .'" '. checked( $followed, 'followed', false ) .'/>';
  • 10.
    		$html .= '<span>' . $text . '</span>';
  • 11.
    		$html .= '</label>';
  • 12.
     
  • 13.
    		if ($status=='pending' && dwqa_current_user_can( 'manage_question' ) ) {
  • 14.
    			$html .= '<a class="dwqa_approve_question" href="'. wp_nonce_url(add_query_arg( array( 'approve' => $ID ), get_permalink() ), 'approve_question_'.$ID, 'dwqa_nonce') .'">' . __( 'Approve', 'dwqa' ) . '</a> ';
  • 15.
    		}
  • 16.
    		
  • 17.
    		if ( dwqa_current_user_can( 'edit_question', $ID ) || dwqa_current_user_can( 'manage_question' ) ) {
  • 18.
    			$html .= '<a class="dwqa_edit_question" href="'. add_query_arg( array( 'edit' => $ID ), get_permalink() ) .'">' . __( 'Edit', 'dwqa' ) . '</a> ';
  • 19.
    		}
  • 20.
     
  • 21.
    		if ( dwqa_current_user_can( 'delete_question', $ID ) || dwqa_current_user_can( 'manage_question' ) ) {
  • 22.
    			$action_url = add_query_arg( array( 'action' => 'dwqa_delete_question', 'question_id' => $ID ), admin_url( 'admin-ajax.php' ) );
  • 23.
    			$html .= '<a class="dwqa_delete_question" href="'. wp_nonce_url( $action_url, '_dwqa_action_remove_question_nonce' ) .'">' . __( 'Delete', 'dwqa' ) . '</a> ';
  • 24.
    		}
  • 25.
    	}
  • 26.
     
  • 27.
    	echo apply_filters( 'dwqa_question_button_action', $html );
  • 28.
    }
function dwqa_question_button_action() { $html = ''; if ( is_user_logged_in() ) { $ID = get_the_ID(); $status = get_post_status( $ID ); $followed = dwqa_is_followed() ? 'followed' : 'follow'; $text = __( 'Subscribe', 'dwqa' ); $html .= '<label for="dwqa-favorites">'; $html .= '<input type="checkbox" id="dwqa-favorites" data-post="'. $ID .'" data-nonce="'. wp_create_nonce( '_dwqa_follow_question' ) .'" value="'. $followed .'" '. checked( $followed, 'followed', false ) .'/>'; $html .= '<span>' . $text . '</span>'; $html .= '</label>'; if ($status=='pending' && dwqa_current_user_can( 'manage_question' ) ) { $html .= '<a class="dwqa_approve_question" href="'. wp_nonce_url(add_query_arg( array( 'approve' => $ID ), get_permalink() ), 'approve_question_'.$ID, 'dwqa_nonce') .'">' . __( 'Approve', 'dwqa' ) . '</a> '; } if ( dwqa_current_user_can( 'edit_question', $ID ) || dwqa_current_user_can( 'manage_question' ) ) { $html .= '<a class="dwqa_edit_question" href="'. add_query_arg( array( 'edit' => $ID ), get_permalink() ) .'">' . __( 'Edit', 'dwqa' ) . '</a> '; } if ( dwqa_current_user_can( 'delete_question', $ID ) || dwqa_current_user_can( 'manage_question' ) ) { $action_url = add_query_arg( array( 'action' => 'dwqa_delete_question', 'question_id' => $ID ), admin_url( 'admin-ajax.php' ) ); $html .= '<a class="dwqa_delete_question" href="'. wp_nonce_url( $action_url, '_dwqa_action_remove_question_nonce' ) .'">' . __( 'Delete', 'dwqa' ) . '</a> '; } } echo apply_filters( 'dwqa_question_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