bbp_check_topic_edit()

Redirect if unathorized user is attempting to edit a topic

Description

Source

File: bp-forums/topics/functions.php

3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
function bbp_check_topic_edit() {
 
    // Bail if not editing a topic
    if ( !bbp_is_topic_edit() )
        return;
 
    // User cannot edit topic, so redirect back to topic
    if ( !current_user_can( 'edit_topic', bbp_get_topic_id() ) ) {
        wp_safe_redirect( bbp_get_topic_permalink() );
        exit();
    }
}

Changelog

Changelog
Version Description
bbPress (r3605) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.