Frontend pages are blank when a user is logged in

When I'm logged in to the site, all pages on the front-end of the site are blank and there is an Internal Server Error in the browser console.

In the debug log I see the following errors:

PHP Fatal error: [] operator not supported for strings in ***/wp-content/plugins/siteorigin-panels/siteorigin-panels.php on line 363
PHP Fatal error: [] operator not supported for strings in ***/wp-content/themes/flash-pro/inc/extras.php on line 37

I've tried to deactivate all plugins and switch to the default WordPress theme, but the issue happens with this theme as well:
PHP Fatal error: [] operator not supported for strings in ***/wp-content/themes/twentyseventeen/inc/template-functions.php on line 34

I've tried to use different PHP versions(5.5, 5.6, 7.0), but no luck.

  • Ash
    • WordPress Hacker

    Hello allanlove

    Please check now. The issue is in the theme as well as in the plugin mentioned in the chat. Please consult with them so that they can release an update and the change I made doesn't get lost.

    This is my code which I added just before the problematic code:

    if( ! is_array( $classes ) ) $classes = array();

    Have a nice day!

    Cheers,
    Ash

  • Ash
    • WordPress Hacker

    Ohh I found the issue. The problem is with the mu-plugins you used. I have corrected them:

    <?php
    
    function user_role_admin_body_class( $classes = array() ) {
    global $current_user;
    foreach( $current_user->roles as $role )
    $classes[] = ' role-' . $role;
    return trim( $classes );
    }
    add_filter( 'admin_body_class', 'user_role_admin_body_class' ); //for back_end
    add_filter( 'body_class', 'user_role_admin_body_class' ); //for front_end

    Have a nice day!

    Cheers,
    Ash

  • allanlove
    • Site Builder, Child of Zeus

    Ok thank you for this!

    I have another question that you may help me with.

    We have franchisees log into the back end of their own website and was wondering if we gave certain widgets or rows or sections an ID (ttfranchisee)
    Then some code could be written to say if a widget has that ID then a franchisee user (EDITOR) can edit that widget or rows or sections but if it doesn't have it then they cant and only super admins can?

    Any help appreciated

    Regards

    • Ash
      • WordPress Hacker

      Hello allanlove

      It has to be edited by the developer of the plugin which provides the widget. It's quite tough to restrict a widget outside of the plugin.

      So, when a widget is developed within a plugin, there has to be a checker which will check the current logged in user's role and based on the role set the permission for the widget.

      Have a nice day!

      Cheers,
      Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.