• Resolved Jordan Thompson

    (@jordant1089)


    I am using HHVM and nginx, so that may be part of the issue I am having.

    The edit user page was blank and caused the error “Fatal error: Object of class stdClass could not be converted to string in /srv/www/stories/wp-content/plugins/press-permit-core/admin/profile_ui_pp.php on line 64”

    That line is:
    $roles = ppc_get_roles( 'user', $user->ID, compact( $post_types, $taxonomies ) );

    I looked into it and it appears that using the compact function was the causing the issues. I changed it to array_merge, which I believe works in the same way as compact should. This seems to correct the issue.

    The line is now:
    $roles = ppc_get_roles( 'user', $user->ID, array_merge( $post_types, $taxonomies ) );

    https://www.ads-software.com/plugins/press-permit-core/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Kevin Behrens

    (@kevinb)

    Can you let me know if this works on your installation?

    $args = array( 'post_types' => $post_types, 'taxonomies' => $taxonomies );
    $roles = ppc_get_roles( 'user', $user->ID, $args );

    That’s the effect you get with the compact function. array_merge() is not equivalent because it doesn’t set the keys.

    Thread Starter Jordan Thompson

    (@jordant1089)

    Thanks for the response. I did realize shortly after posting that there were many differences between compact and array_merge, so my change didn’t really solve the issue.

    Another fix I tried was to replace the $post_types and $taxonomy variables instead of compact.

    $post_types = pp_get_enabled_post_types( array() );//, 'object' ); Defaults to 'names'
    $taxonomies = pp_get_enabled_taxonomies( array() );//, 'object' ); Defaults to 'names'
    ...
    $roles = ppc_get_roles( 'user', $user->ID, compact( $post_types, $taxonomies ) );

    The site is currently using your code from above. It may just be the fact that the site does not have anything to show, but all three of these changes result in the same content on the edit users page as my previous installation on PHP, where the original code worked fine.

    Also, there is a similar issue to this one on the Edit permission group page (/press-permit-core/admin/permissions-ui_pp.php). The same code is at line 516. For this one, however, your fix above did not work.

    Plugin Author Kevin Behrens

    (@kevinb)

    What do you mean by “similar issue” and “did not work”? You get the same fatal error in permissions-ui_pp.php, with or without applying the change I suggested today?

    Thread Starter Jordan Thompson

    (@jordant1089)

    Yes, I do mean that the same fatal error occurred. The exact error is: “Fatal error: Object of class stdClass could not be converted to string in /wp-content/plugins/press-permit-core/admin/permissions-ui_pp.php on line 516”.

    I attempted the change you suggested, changing the line to:

    $roles = ppc_get_roles( $agent_type, $agent_id, array('post_types' => $post_types, 'taxonomies' => $taxonomies ) );

    I was incorrect in my previous reply. I messed up the code. This change does correct the issue in the permissions ui file.

    Thanks for your help with this. I know that this issue is limited in scope to only people using HHVM, but would these changes be present in future versions of the plugin? Just wondering so that I would know if I’ll have to make these changes for each updates.

    Plugin Author Kevin Behrens

    (@kevinb)

    Okay, so the code change does clear your error on both pages? I will include them in the next Press Permit Core version.

    Thread Starter Jordan Thompson

    (@jordant1089)

    Yes, the change fixed the error on both pages. Thanks again for your help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Edit user page blank’ is closed to new replies.