• Resolved frannieto

    (@frannieto)


    WordPress 5.6
    PHP 7.3.23
    Post SMTP 2.0.20
    Post SMTP Extensions: Office 365 for Post SMTP Extension

    Fatal error: Uncaught Error: Class 'PostmanViewController' not found in wp-content\plugins\post-smtp\Postman\Extensions\Admin\PostmanAdmin.php:19 Stack trace: #0 wp-includes\class-wp-hook.php(287): PostmanAdmin->add_menu('') #1 wp-includes\class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) #2 wp-includes\plugin.php(484): WP_Hook->do_action(Array) #3 wp-admin\includes\menu.php(155): do_action('admin_menu', '') #4 wp-admin\menu.php(327): require_once('...') #5 wp-admin\admin.php(158): require('...') #6 wp-admin\index.php(10): require_once('...') #7 {main} thrown in wp-content\plugins\post-smtp\Postman\Extensions\Admin\PostmanAdmin.php on line 19

    The error only appears when logging in with a non-administrator user.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Same for me, for a user with author role.

    Same for me on a multisite with various roles except for super administrator. Well my error is slightly different but also just appeared.

    Fatal error: Uncaught Error: Class 'PostmanViewController' not found in /wordpress/wp-content/plugins/post-smtp/Postman/Extensions/Admin/PostmanAdmin.php:19 Stack trace: #0 /wordpress/wp-includes/class-wp-hook.php(287): PostmanAdmin->add_menu('') #1 /wordpress/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) #2 /wordpress/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #3 /wordpress/wp-admin/includes/menu.php(155): do_action('admin_menu', '') #4 /wordpress/wp-admin/menu.php(327): require_once('/home/clients/0...') #5 /wordpress/wp-admin/admin.php(158): require('/home/clients/0...') #6 /wordpress/wp-a in /wordpress/wp-content/plugins/post-smtp/Postman/Extensions/Admin/PostmanAdmin.php on line 19

    I got this too.
    The problem seems only to occur when accessing dashboard (i.e /wp-admin/*) pages with non admin users. The PostmanAdmin class is loaded and used even for non-admins. However the dependendat PostmanViewController is not!

    I made a really quick fix, that works in my usercase there all users are either admin or subscriber. I more robust fix could for sure be made, but sometimes quick’n’dirty is also ok.

    In the constructor in PostManAdmin.php I used current_user_can() to prevent PostManViewController from beeing accessed for my subscribers like this:

            if ( count( $extensions ) > 0 && current_user_can( 'edit_posts' )) {
                add_action('admin_menu', [ $this, 'add_menu' ], 20 );
            }

    instead of this

            if ( count( $extensions ) > 0 ) {
                add_action('admin_menu', [ $this, 'add_menu' ], 20 );
            }

    A better solution would be not to load PostManAdmin at all for said users, but as I sad: quick’n’dirty 🙂

    I short sidenote related @lymf ‘s usercase.
    Since he user with author-roles, my fix will not work. I check if the user have edit-post rights.
    @lymf : you have to change ‘edit-posts’ to another right that authors do not have.
    Or better, make a real fix so I dont have to 🙂

    • This reply was modified 4 years, 2 months ago by marxhz.

    Hi @marxhz,

    Thanks for this information! I have shared it with the developer @yehudah. 🙂

    Kind Regards,
    Tim

    Same error here:

    Post SMTP (version 2.0.20) PHP version 7.4.14 Error Details
    =============
    An error of type E_ERROR was caused in line 19 of the file /var/www/httpdocs/www/wp-content/plugins/post-smtp/Postman/Extensions/Admin/PostmanAdmin.php. Error message: Uncaught Error: Class ‘PostmanViewController’ not found in /var/www/httpdocs/www/wp-content/plugins/post-smtp/Postman/Extensions/Admin/PostmanAdmin.php:19

    Stack trace:
    #0 /var/www/httpdocs/www/wp-includes/class-wp-hook.php(287): PostmanAdmin->add_menu()
    #1 /var/www/httpdocs/www/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters()
    #2 /var/www/httpdocs/www/wp-includes/plugin.php(484): WP_Hook->do_action()
    #3 /var/www/httpdocs/www/wp-admin/includes/menu.php(155): do_action()
    #4 /var/www/httpdocs/www/wp-admin/menu.php(327): require_once(‘/var/www/vhosts…’)
    #5 /var/www/httpdocs/www/wp-admin/admin.php(158): require(‘/var/www/vhosts…’)
    #6 /var/www/httpdocs/www/wp-admin/plugin-install.php(16): require_once(‘/var/www/httpdocs…’)
    #7 {main} thrown

    Hi,

    A new version released, please check.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Fatal error: Uncaught Error: Class ‘PostmanViewController’ not found’ is closed to new replies.