• Resolved melinach

    (@melinach)


    I’ve just updated my site and since then Ultime Member no longer works and displays this error message:

    Fatal error: Uncaught Error: Cannot access private property um\core\Options::$options in /home/lesmoustvg/www/wp-content/themes/Divi-Community/functions.php:89 Stack trace: #0 /home/lesmoustvg/www/wp-includes/class-wp-hook.php(324): custom_email_notifications_profile_is_updated(Array) #1 /home/lesmoustvg/www/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #2 /home/lesmoustvg/www/wp-content/plugins/ultimate-member/includes/class-config.php(642): apply_filters(‘um_email_notifi…’, Array) #3 /home/lesmoustvg/www/wp-content/plugins/ultimate-member/includes/class-init.php(1001): um\Config->__construct() #4 /home/lesmoustvg/www/wp-content/plugins/ultimate-member/includes/core/class-setup.php(288): UM->config() #5 /home/lesmoustvg/www/wp-content/plugins/ultimate-member/includes/core/class-setup.php(26): um\core\Setup->set_default_settings() #6 /home/lesmoustvg/www/wp-content/plugins/ultimate-member/includes/class-init.php(483): um\core\Setup->run_setup() #7 /home/lesmoustvg/www/wp-content/plugins/ultimate-member/includes/class-init.php(413): UM->single_site_activation() #8 /home/lesmoustvg/www/wp-includes/class-wp-hook.php(324): UM->activation(”) #9 /home/lesmoustvg/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(”, Array) #10 /home/lesmoustvg/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #11 /home/lesmoustvg/www/wp-admin/plugins.php(196): do_action(‘activate_ultima…’) #12 {main} thrown in /home/lesmoustvg/www/wp-content/themes/Divi-Community/functions.php on line 89

    Help, I don’t know what to do ! 😭

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • @melinach

    Do you have a custom code snippet in your active theme’s functions.php file?
    There is an issue in the functions.php file at line 89.
    Can you post the PHP code around this line here in the Forum?

    Thread Starter melinach

    (@melinach)

    This is the code :

    <?php

    // ACTIVTATION DU THEME ENFANT

    function theme_enqueue_styles() {

     wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

    }

    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );

    // SUPPRESSION DU NUMERO DE VERSION DE WORDPRESS

    function dc_delete_version() {

      return '';

    }

    add_filter('the_generator', 'dc_delete_version');

    // AJOUT DES ICONES FONT AWESOME

    function dc_load_fontawesome() {

      wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', null, '4.7.0' );

    }

    add_action('wp_enqueue_scripts', 'dc_load_fontawesome');

    // MASQUER LES ERREURS DE CONNEXION A L'ADMINISTRATION

    function wpm_hide_errors() {

        return "L'identifiant ou le mot de passe est incorrect";

    }

    add_filter('login_errors', 'wpm_hide_errors');

    //  Version 2.0 2022-09-20

    //  An email template for sending an email to the site admin when an UM User Profile is updated

    //  Source: https://github.com/MissVeronica/UM-Admin-User-Profile-Update-Email

    add_filter( 'um_email_notifications', 'custom_email_notifications_profile_is_updated', 10, 1 );

    add_action( 'um_user_after_updating_profile', 'custom_profile_is_updated_email', 10, 3 );

    add_action( 'profile_update', 'custom_profile_is_updated_email_backend', 10, 3 );

    add_filter( 'um_admin_settings_email_section_fields', 'um_admin_settings_email_section_fields_custom_forms', 10, 2 );

    function custom_email_notifications_profile_is_updated( $emails ) {

        $custom_emails = array(

                    'profile_is_updated_email' => array(

                    'key'            => 'profile_is_updated_email',

                    'title'          => __( 'Profile is updated email', 'ultimate-member' ),

                    'subject'        => 'Profile Update {username}',

                    'body'           => '',

                    'description'    => __( 'To send an email to the site admin when a user profile is updated', 'ultimate-member' ),

                    'recipient'      => 'admin',

                    'default_active' => true ));

        UM()->options()->options = array_merge( array(  'profile_is_updated_email_on'  => 1,

                                                        'profile_is_updated_email_sub' => 'Profile Update {username}', ),

                                                UM()->options()->options );

        return array_merge( $custom_emails, $emails );

    }

    function um_admin_settings_email_section_fields_custom_forms( $section_fields, $email_key ) {

        if( $email_key == 'profile_is_updated_email' ) {

            $section_fields[] = array(

                    'id'            => $email_key . '_custom_forms',

                    'type'          => 'text',

                    'label'         => __( 'Include these UM Profile Forms for sending emails:', 'ultimate-member' ),

                    'conditional'   => array( $email_key . '_on', '=', 1 ),

                    'tooltip'       => __( 'Comma separated UM Profile Form IDs, empty send emails always.', 'ultimate-member' )

                    );

        }

        return $section_fields;

    }

    function custom_profile_is_updated_email_backend( $user_id, $old_data, $user_data ) {

        if( isset( $_REQUEST['action']) && $_REQUEST['action'] == 'update' ) {

            custom_profile_is_updated_email( $user_data, $user_id );

        }

    }

    function custom_profile_is_updated_email( $to_update, $user_id, $args = array() ) {

        global $current_user;

        $forms = UM()->options()->get( 'profile_is_updated_email_custom_forms' );

        if( !empty( $forms )) {

            $forms = explode( ',', $forms );

            if( is_array( $forms ) && !in_array( $args['form_id'], $forms )) return;

        }

        $submitted = um_user( 'submitted' );    

        foreach( $to_update as $key => $value ) {

            $submitted[$key] = $value;

        }

        $registration_form_id = $submitted['form_id'];

        $registration_timestamp = um_user( 'timestamp' );

        $submitted['form_id'] = $args['form_id'];

        update_user_meta( $user_id, 'submitted', $submitted );

        update_user_meta( $user_id, 'timestamp', current_time( 'timestamp' ) );

        UM()->user()->remove_cache( $user_id );

        um_fetch_user( $user_id );

        $time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );

        um_fetch_user( $user_id );

        $args['tags'] = array(  '{profile_url}',

                                '{current_date}',

                                '{updating_user}' );

        $args['tags_replace'] = array(  um_user_profile_url( $user_id ),

                                        date_i18n( $time_format, current_time( 'timestamp' )),

                                        $current_user->user_login );

        UM()->mail()->send( get_bloginfo( 'admin_email' ), 'profile_is_updated_email', $args );

        $submitted['form_id'] = $registration_form_id;

        update_user_meta( $user_id, 'submitted', $submitted );

        update_user_meta( $user_id, 'timestamp', $registration_timestamp );

        UM()->user()->remove_cache( $user_id );

        um_fetch_user( $user_id );

    }

    Line 89 :

        UM()->options()->options = array_merge( array(  ‘profile_is_updated_email_on’  => 1,

                                                        ‘profile_is_updated_email_sub’ => ‘Profile Update {username}’, ),

                                                UM()->options()->options );

    It’s strange I haven’t touched anything… I don’t understand.
    Thank you very much 🙏

    @melinach

    This is a well known issue introduced with UM 2.8.5.
    More details about this issue and solutions here

    https://github.com/ultimatemember/ultimatemember/issues/1500

    @melinach

    You can try to replace your function code with:

    function custom_email_notifications_profile_is_updated( $um_emails ) {
    
        $um_emails['profile_is_updated_email'] = array(
    
                    'key'            => 'profile_is_updated_email',
                    'title'          => __( 'Profile is updated email', 'ultimate-member' ),
                    'subject'        => 'Profile Update {username}',
                    'body'           => '',
                    'description'    => __( 'To send an email to the site admin when a user profile is updated', 'ultimate-member' ),
                    'recipient'      => 'admin',
                    'default_active' => true
                );
    
        if ( UM()->options()->get( 'profile_is_updated_email_on' ) === '' ) {
            $email_on = empty( $um_emails['profile_is_updated_email']['default_active'] ) ? 0 : 1;
            UM()->options()->update( 'profile_is_updated_email_on', $email_on );
            UM()->options()->update( 'profile_is_updated_email_sub', $um__emails['profile_is_updated_email']['subject'] );
    
        }
    
        return $um_emails;
    }
    Plugin Support Yurii

    (@yuriinalivaiko)

    Hello @melinach

    You can not use UM()->options()->options in your custom code.

    Use UM()->options()->get( $option_id ); to get the option value.
    Use UM()->options()->update( $option_id, $value ); to update the option value.
    Use UM()->options()->remove( $option_id ); to delete the option.

    Regards

    Thread Starter melinach

    (@melinach)

    @missveronicatv

    Thank you so much for your help! it works! you saved my life 🙏

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Fatal error before MAJ’ is closed to new replies.