I’ve created a little custom plugin for a MultiSite WAAS.
The purpose is to see if the current user has the highest subscription “plan”.
And if not, restrict the MIME types they can upload.
When I try to activate the plugin I am getting an error message:
Plugin could not be activated because it triggered a fatal error.
Parse error: syntax error, unexpected ‘;’ in /var/www/staging1.com/htdocs/wp-content/plugins/restrict-mime-by-plan/restrict-mime-by-plan.php on line 31
Line 31 is the closing bracket and semi column for the array.
I honestly can’t see what’s wrong with that.
Anyone out there sharper eyes than me?
function restrict_mime($mimes) {
if ( function_exists('is_plugin_active_for_network') ){
if ( is_plugin_active_for_network( 'wp-ultimo/wp-ultimo.php' ) ) {
if ( !is_super_admin() ) {
//get user id
$user_id = get_current_user_id();
//define the Premium Pro plan ID
$plan_id = 52;
// restrict MIME types if the current user doesnt have Premium Pro plan
if ( !wu_has_plan( $user_id, $plan_id ){
$mimes = array(
'jpg|jpeg' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png'
);
return $mimes;
}
}
}
}
}
add_filter('upload_mimes','restrict_mime');