gusrb84 (@gusrb84)

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • In reply to: Delete Topic Function

    gusrb84
    Participant

    @gusrb84

    I have same issue! delete_others_replies work, but not delete_replies..

    Temporary solution would be changing bbpress core (/includes/replies/capabilities.php)
    from:

    case 'delete_reply' :
    // Get the post
    $_post = get_post( $args[0] );
    if ( !empty( $_post ) ) {
    	// Get caps for post type object
    	$post_type = get_post_type_object( $_post->post_type );
    	$caps      = array();
    	// Add 'do_not_allow' cap if user is spam or deleted
    	if ( bbp_is_user_inactive( $user_id ) ) {
    	$caps[] = 'do_not_allow';
    	// Moderators can always edit forum content
    	} elseif ( user_can( $user_id, 'moderate' ) ) {
    	$caps[] = 'moderate';
    	// Unknown so map to delete_others_posts
    	} else {
    	$caps[] = $post_type->cap->delete_others_posts;
    	}
    }
    break;

    To:

    case 'delete_reply' :
    // Get the post
    $_post = get_post( $args[0] );
    if ( !empty( $_post ) ) {
    	// Get caps for post type object
    	$post_type = get_post_type_object( $_post->post_type );
    	$caps      = array();
    	// Add 'do_not_allow' cap if user is spam or deleted
    	if ( bbp_is_user_inactive( $user_id ) ) {
    	$caps[] = 'do_not_allow';
    	// Moderators can always edit forum content
    	} elseif ( user_can( $user_id, 'moderate' ) ) {
    	$caps[] = 'moderate';
    	// User is author so allow edit if not in admin
    	} elseif ( !is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) {
    	$caps[] = $post_type->cap->delete_posts;
    	// Unknown so map to delete_others_posts
    	} else {
    	$caps[] = $post_type->cap->delete_others_posts;
    	}
    }
    break;

    But I do not want to touch the core. How can I update my functions.php file to do the same? (i.e. add_filter)

    I’m very new to WP and BBP..


    gusrb84
    Participant

    @gusrb84

    found temporary solution.

    Fix 404 issue for bbPress 2.2.x

    It fix 404 error

Viewing 2 replies - 1 through 2 (of 2 total)