MainWP Community

Update to 4.1 fails

Hi,
being very cautious I started updating to 4.1 on a fresh staging site running Wordpress 5.5.1 and with all non-MWP plugins deactivated.
I started with just updating the Dashboard plugin to 4.1.1 and Wordpress crashed with the following error message:
When seeking help with this issue, you may be asked for some of the following information:
WordPress version 5.5.1
Current theme: Twenty Nineteen (version 1.7)
Current plugin: MainWP Custom Dashboard Extension (version 4.0)
PHP version 7.4.10

Error Details

An error of type E_ERROR was caused in line 7 of the file /home/huggenbe/www/mwp/staging/wp-content/plugins/mainwp-custom-dashboard-extension/class/mainwp-custom-dashboard.class.php(60) : eval()'d code. Error message: Uncaught Error: Call to undefined method MainWP_DB::getSQLWebsitesForCurrentUser() in /home/huggenbe/www/mwp/staging/wp-content/plugins/mainwp-custom-dashboard-extension/class/mainwp-custom-dashboard.class.php(60) : eval()‘d code:7
Stack trace:
#0 /home/huggenbe/www/mwp/staging/wp-includes/class-wp-hook.php(287): quick_form_in_admin_bar2(’\t\t

After deactivating the MainWP Custom Dashboard Extension on the server, the site is running again.

I’ve found this thread: MainWP Custom Dashboard Extension (version 4.0) crashed site after 4.1 update
and would like to know if manipulating the database is the only way to be able to use the extension further?

I identified the field via phpmyadmin but don’t know which part of the code I should delete.

defined( ‘ABSPATH’ ) or die( ‘No script kiddies please!’ );
add_filter( ‘mainwp_header_right’, ‘quick_form_in_admin_bar2’, 10, 3 );

function quick_form_in_admin_bar2($string) {

// SITE SELECTION
$sql		 = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
$websites	 = MainWP_DB::Instance()->query( $sql );
@MainWP_DB::data_seek( $websites, 0 );

// BUILD ADMIN URL
$admin_url = esc_url( admin_url() ) . \'admin.php?page=\'; 

$html = ’
<div class=“ui green buttons”>
<a class=“ui button” data-inverted="" data-position=“bottom right” data-tooltip=“Go to websites overview table” href="’.$admin_url.'managesites">Sites

		<div class=\"ui dropdown icon floating button\" style=\"z-index: 1000;\" data-inverted=\"\" data-position=\"bottom right\" data-tooltip=\"Choose common child site actions\" tabindex=\"0\">
			<i class=\"dropdown icon\"></i>


			<div class=\"menu\">
				<div class=\"ui icon search input\">
					<i class=\"search icon\"></i>
					<input type=\"text\" placeholder=\"Search child sites...\">
				</div>

				<div class=\"divider\"></div>
				<div class=\"header\">
					<div class=\"item\" style=\"display: inline; margin-right: 5px;\"><i class=\"settings icon\"></i><a href=\"\'.$admin_url.\'PluginsInstall\">Plugins</a></div>
					<div class=\"item\" style=\"display: inline; margin-right: 5px;\"><i class=\"settings icon\"></i><a href=\"\'.$admin_url.\'Extensions-Mainwp-Bulk-Settings-Manager\">Settings</a></div>
					<div class=\"item\" style=\"display: inline; margin-right: 5px;\"><i class=\"settings icon\"></i><a href=\"\'.$admin_url.\'Extensions-Mainwp-Client-Reports-Extension\">Reports</a></div>
					<div class=\"item\" style=\"display: inline; margin-right: 5px;\"><i class=\"settings icon\"></i><a href=\"\'.$admin_url.\'Extensions-Mainwp-Code-Snippets-Extension\">Snippets</a></div>
				</div>

				<div class=\"scrolling menu\">\';

					while ( $websites && ($website = @MainWP_DB::fetch_object( $websites ) ) ) {

						$favi_url = MainWP_Utility::get_favico_url( $website );

						$html .= \'
						<div class=\"item\">
							<img class=\"ui avatar image\" src=\"\'.$favi_url.\'\" style=\"vertical-align:middle;\">
							<span class=\"description\">\'.stripslashes($website->name).\'</span>
							<a href=\"\'.$admin_url.\'managesites&dashboard=\'.$website->id.\'\" data-tooltip=\"Open MainWP Child-Site-Dashboard\" data-position=\"top left\" data-inverted=\"\"><i class=\"dashboard icon\"></i></a>
							<a href=\"\'.$website->url.\'\" target=\"_blank\" data-tooltip=\"Open frontend in new tab\" data-position=\"top left\" data-inverted=\"\"><i class=\"external alternate icon\"></i></a>
							<a href=\"/wp-admin/admin.php?page=SiteOpen&newtab=yes&websiteid=\'.$website->id.\'\" target=\"_blank\" data-tooltip=\"Open backend in new tab\" data-position=\"top left\" data-inverted=\"\"><i class=\"sign in icon\"></i></a>
						</div>\';
					}

					$html .= \'
				</div>
			</div>
		</div>
	</div>
\';

return $string. $html;

}

Kind regards,
Lukas

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.