Making WordPress.org

Changeset 12246


Ignore:
Timestamp:
11/16/2022 02:13:05 AM (4 years ago)
Author:
dd32
Message:

bb-base: Handle errors from the plugins API being unavailable, in the least-graceful way possible, without triggering PHP Notices/warnings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/buddypress.org/public_html/wp-content/themes/bb-base/functions.php

    r12226 r12246  
    286286    $plugins = bb_base_plugins_api('query_plugins', $args);
    287287
     288    // Handle errors, in the least-graceful way possible.
     289    if ( is_wp_error( $plugins ) ) {
     290        return (object) array(
     291            'plugins' => array(),
     292            'info'    => array(
     293                'page'    => (int) $page,
     294                'results' => 0,
     295            )
     296        );
     297    }
     298
    288299    foreach( $plugins->plugins as $plugin_key => $plugin_value ) {
    289300        if ( $plugins->plugins[$plugin_key]->slug == 'mingle' ) {
Note: See TracChangeset for help on using the changeset viewer.