• Resolved ka2

    (@ka2)


    Hi,

    It is occurred php warning as follows when remove user on profile screen with this plugin.

    reset() expects parameter 1 to be array, null given in ~/theme-my-login/modules/themed-profiles/themed-profiles.php on line 299

    If user deletion on profile screen, since $profileuser of arguments to be empty, then I think that it sould be checking the $profileuser object has property. I modified as follows, then I did prevent the error successfully. I want you to merge it.

    - $user_role = reset( $profileuser->roles );
    + $user_role = isset( $profileuser->roles ) && is_array( $profileuser->roles ) ? reset( $profileuser->roles ) : 'subscriber';

    Thank you,

    • This topic was modified 5 years, 11 months ago by ka2.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    I’m not sure what you mean. You can’t delete a user from their themed profile. Can you elaborate?

    Thread Starter ka2

    (@ka2)

    Sorry at the lack of explanation.

    I added custom process that the user can arbitrarily withdraw from the front end profile screen using this plugin. It only happens in that case will be an error.
    Since I need to take measures to deter this error every time we update the plugin, I hope to incorporate the fix into core.

    Thank you,

    • This reply was modified 5 years, 11 months ago by ka2.
    Plugin Author Jeff Farthing

    (@jfarthing84)

    In normal circumstances, I don’t believe there would be an instance where the roles property is not an array.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Occurred php warning when remove user on profile screen’ is closed to new replies.