prefix The current WordPress table prefix. Allowed characters are a-z, A-Z, 0-9, the dash - and the underscore _. * * @return str The possibly-modified table prefix. */ $prefix = apply_filters( 'groups_get_table_prefix', $wpdb->prefix ); if ( is_string( $prefix ) ) { $prefix = preg_replace( '/[^a-zA-Z0-9-_]+/', '', $prefix ); } // use the default if the filter returned nonsense or null due to error if ( !is_string( $prefix ) ) { $prefix = $wpdb->prefix; } // Return the constructed table name. return $prefix . GROUPS_TP . $name; } /** * This returns true if admin override is enabled and the current user * is an administrator, otherwise false. * To enable admin override (AKA god mode for admins), add this to * your wp-config.php : * * define( 'GROUPS_ADMINISTRATOR_OVERRIDE', true ); * * Enabling this is NOT recommended for production sites. * * @param int $user_id indicate the user ID or omit to check for the current user * * @return boolean */ function _groups_admin_override( $user_id = null ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound $result = false; if ( ( $user_id === null ) && function_exists( 'get_current_user_id' ) ) { $user_id = get_current_user_id(); } if ( $user_id ) { if ( defined( 'GROUPS_ADMINISTRATOR_OVERRIDE' ) && ( GROUPS_ADMINISTRATOR_OVERRIDE === true ) ) { // @since 3.1.0 user_can() relies on get_userdata() which is defined in wp-includes/pluggable.php if ( function_exists( 'user_can' ) && function_exists( 'get_userdata' ) ) { if ( user_can( $user_id, 'administrator' ) ) { $result = true; } } } } return $result; }