get_websites_by_client_ids( $client_id, array( 'select_data' => $data_fields ) ); if ( $websites ) { foreach ( $websites as $website ) { if ( empty( $website->recent_pages ) ) { continue; } $pages = json_decode( $website->recent_pages, 1 ); if ( empty( $pages ) ) { continue; } foreach ( $pages as $page ) { $page['website'] = (object) array( 'id' => $website->id, 'url' => $website->url, 'name' => $website->name, ); $allPages[] = $page; } } } } else { if ( $current_wpid ) { $sql = MainWP_DB::instance()->get_sql_website_by_id( $current_wpid ); $individual = true; } else { $sql = MainWP_DB::instance()->get_sql_websites_for_current_user(); $individual = false; } $websites = MainWP_DB::instance()->query( $sql ); if ( $websites ) { while ( $websites && ( $website = MainWP_DB::fetch_object( $websites ) ) ) { if ( empty( $website->recent_pages ) ) { continue; } $pages = json_decode( $website->recent_pages, 1 ); if ( empty( $pages ) ) { continue; } foreach ( $pages as $page ) { $page['website'] = (object) array( 'id' => $website->id, 'url' => $website->url, 'name' => $website->name, ); $allPages[] = $page; } } MainWP_DB::free_result( $websites ); } } static::render_top_grid(); /** * Action: mainwp_recent_pages_widget_top * * Fires at the top of the Recent Pages widget. * * @since 4.1 */ do_action( 'mainwp_recent_pages_widget_top' ); ?>