bbp_is_deactivation( $basename = '' )

Determine if Forums is being deactivated

Description

Return

(bool) True if deactivating Forums, false if not

Source

File: bp-forums/core/update.php

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
function bbp_is_deactivation( $basename = '' ) {
    global $pagenow;
 
    $bbp    = bbpress();
    $action = false;
 
    // Bail if not in admin/plugins
    if ( ! ( is_admin() && ( 'plugins.php' === $pagenow ) ) ) {
        return false;
    }
 
    if ( ! empty( $_REQUEST['action'] ) && ( '-1' !== $_REQUEST['action'] ) ) {
        $action = $_REQUEST['action'];
    } elseif ( ! empty( $_REQUEST['action2'] ) && ( '-1' !== $_REQUEST['action2'] ) ) {
        $action = $_REQUEST['action2'];
    }
 
    // Bail if not deactivating
    if ( empty( $action ) || !in_array( $action, array( 'deactivate', 'deactivate-selected' ) ) ) {
        return false;
    }
 
    // The plugin(s) being deactivated
    if ( $action === 'deactivate' ) {
        $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array();
    } else {
        $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
    }
 
    // Set basename if empty
    if ( empty( $basename ) && !empty( $bbp->basename ) ) {
        $basename = $bbp->basename;
    }
 
    // Bail if no basename
    if ( empty( $basename ) ) {
        return false;
    }
 
    // Is Forums being deactivated?
    return in_array( $basename, $plugins );
}

Changelog

Changelog
Version Description
bbPress (r3421) 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.