• Hi,

    Is there a way to edit your post if some user has accidentally written something wrong or post. I saw an option in permission settings and i want my users/subscribers to be able to edit their own answer/post but when i enabled that option..it gives permission to edit all the post including the admin.
    Please help.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author DesignWall

    (@designwall)

    Hi,
    Thanks for contacting DesignWall.

    About this matter, you need to add the function below into wp-conten/themes/theme-folder/functions.php

    add_filter( ‘dwqa_question_button_action’, ‘dwqa_theme_question_button_action’ );
    function dwqa_theme_question_button_action() {
    $html = ”;
    if ( is_user_logged_in() ) {
    $followed = dwqa_is_followed() ? ‘followed’ : ‘follow’;
    $text = __( ‘Subscribe’, ‘dwqa’ );
    $html .= ‘<label for=”dwqa-favorites”>’;
    $html .= ‘<input type=”checkbox” id=”dwqa-favorites” data-post=”‘. get_the_ID() .'” data-nonce=”‘. wp_create_nonce( ‘_dwqa_follow_question’ ) .'” value=”‘. $followed .'” ‘. checked( $followed, ‘followed’, false ) .’/>’;
    $html .= ‘<span>’ . $text . ‘</span>’;
    $html .= ‘</label>’;
    if ( dwqa_current_user_can( ‘edit_question’, get_the_ID() ) || dwqa_current_user_can( ‘manage_question’ ) ) {
    $html .= ‘ get_the_ID() ), get_permalink() ) .'”>’ . __( ‘Edit’, ‘dwqa’ ) . ‘ ‘;
    }

    if ( dwqa_current_user_can( ‘delete_question’, get_the_ID() ) || dwqa_current_user_can( ‘manage_question’ ) ) {
    $action_url = add_query_arg( array( ‘action’ => ‘dwqa_delete_question’, ‘question_id’ => get_the_ID() ), admin_url( ‘admin-ajax.php’ ) );
    $html .= ‘‘ . __( ‘Delete’, ‘dwqa’ ) . ‘ ‘;
    }
    }

    return $html;
    }

    add_filter( ‘dwqa_answer_button_action’, ‘dwqa_theme_answer_button_action’ );
    function dwqa_theme_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 .= ‘ get_the_ID() ), get_permalink( $parent_id ) ) .'”>’ . __( ‘Edit’, ‘dwqa’ ) . ‘ ‘;
    }

    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 .= ‘‘ . __( ‘Delete’, ‘dwqa’ ) . ‘ ‘;
    }
    }

    return $html;
    }

    If you have more questions, feel free to ask.

    $html .= ‘ get_the_ID() ), get_permalink() ) .’”>’ . __( ‘Edit’, ‘dwqa’ ) . ‘ ‘;

    is the above line ok?

    pls give a working code … i am not a programmer.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘User Edit Option’ is closed to new replies.