• PHP Fatal Error occurs when updating a user in WordPress below 5.8:

    [25-Nov-2024 08:11:48 UTC] PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function SimpleWpMembership::sync_with_wp_profile(), 2 passed in /xx/wp-includes/class-wp-hook.php on line 287 and exactly 3 expected in /xx/wp-content/plugins/simple-membership/classes/class.simple-wp-membership.php:538
    Stack trace:
    #0 /xx/wp-includes/class-wp-hook.php(287): SimpleWpMembership->sync_with_wp_profile(106, Object(WP_User))
    #1 /xx/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
    #2 /xx/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
    #3 /xx/wp-includes/user.php(2087): do_action('profile_update', 106, Object(WP_User))
    #4 /xx/wp-includes/user.php(2206): wp_insert_user(Array)
    #5 /xx/wp-content/plugins/simple-membership/classes/class.swpm-utils.php(278): wp_update_user(Array)
    #6 /xx/wp-content/plugins/simple-membership/classes/class.swpm-front-registration.php(583): SwpmUtils::update_wp_user('username', Array)
    ...

    Reason is this change in WordPress 5.8 at profile_update action:

     * @since 5.8.0 The $userdata parameter was added.

    Possible fix in file classes/class.simple-wp-membership.php line 538:

    old:
    public function sync_with_wp_profile($wp_user_id, $old_user_data, $userdata) {

    new:
    public function sync_with_wp_profile($wp_user_id, $old_user_data, $userdata = array()) {

    Plugin data states compatibility “WordPress version 5.0 or higher”, this includes WordPress below 5.8.

    Simple Membership 4.5.7, WordPress 5.6.14

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.