• Resolved grmcreatives

    (@grmcreatives)


    Upon updating the plugin to version 2.16.2 I am getting a fatal php error site wide.

    PHP Fatal error:  Uncaught Error: Call to undefined function wp_get_current_user() in /nas/content/live/mylawnewstag/wp-includes/capabilities.php:693
    Stack trace:
    #0 /nas/content/live/mylawnewstag/wp-content/plugins/groups/lib/access/class-groups-post-access.php(230): current_user_can('groups_admin_gr...')
    #1 /nas/content/live/mylawnewstag/wp-includes/class-wp-hook.php(307): Groups_Post_Access::posts_where(' AND wp_posts.p...', Object(WP_Query))
    #2 /nas/content/live/mylawnewstag/wp-includes/plugin.php(233): WP_Hook->apply_filters(' AND wp_posts.p...', Array)
    #3 /nas/content/live/mylawnewstag/wp-includes/class-wp-query.php(2625): apply_filters_ref_array('posts_where', Array)
    #4 /nas/content/live/mylawnewstag/wp-includes/class-wp-query.php(3542): WP_Query->get_posts()
    #5 /nas/content/live/mylawnewstag/wp-includes/post.php(2430): WP_Query->query(Array)
    #6 /nas/content/live/mylawnewstag/wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php(149): get_posts(Array)
    #7 /nas/content/live/mylawnewstag/wp-content in /nas/content/live/mylawnewstag/wp-includes/capabilities.php on line 693

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi there,

    Sorry to hear that you get a fatal error on your site.

    So far I wasn’t able to replicate your error on my local installation using the free version of ACF. I’ve created a custom field and used it in a post that is restricted by Groups. Still though there is nothing logged when visiting this post as a user 1) who has access to it, 2) who is restricted from accessing, 3) as admin. As for the error itself, this is pretty weird and normally shouldn’t occur since it’s related to a WP Core function that is already defined.

    Can you please provide some more details on your setup? Does the error occur when visiting any kind of page or post on your site or for specific posts only, ie the ones that are restricted by Groups plugin and use a custom field?

    As for custom fields you’ve created, can you share with us an example custom field that you use for a post?

    Kind regards,
    George

    Thread Starter grmcreatives

    (@grmcreatives)

    Hi George,

    Thank you for your response.

    1. The basic setup of the site is this: We use groups + groups for WooCommerce to place customers/users into groups that we can then use WooCommerce Dynamic pricing to offer exclusive group based discounts on products.

    2. The error happens site wide (homepage, posts, pages, products etc). I will also note that everything appears to work just fine if the groups plugin is on version 2.14.1 and everything else is up to date. It is only when we update that single plugin to version 2.16.2 that the error appears.

    3. Custom fields appear to only be used for theming. Block groups are created to be used by the theme template files.

    4. The error occurs no matter what theme is active.

    5. Commenting out line 693 of wp-includes/capabilities.php resolves the error, but we would like to avoid modifying core.

    Thank you.

    Hi there,

    Of course you shouldn’t modify the core, this is not recommended.
    The error itself looks like a priority issue, as if wp_get_current_user() function is called earlier than it should.

    Also since it occurs site-wide and according to the stack trace the ACF addon is looking for the post id via its function acf_get_field_post() I think it would be most helpful if you can share the details of how you use the custom fields even for theming, which will help us replicate the issue.
    Does the error still occur if for example you temporary disable ACF addon?

    Kind regards,
    George

    Plugin Author itthinx

    (@itthinx)

    Is this still an issue?

    Plugin Author Kento

    (@proaktion)

    Assuming resolved.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal PHP errors with class-groups-post-access.php on version 2.16.2’ is closed to new replies.