Okay
  Public Ticket #3205647
Automatic Customer from Wordpress user
Open

Comments

  •  2
    Lindsay started the conversation

    Hi, I'm trying to better connect my Wordpress users to my Amelia customers. Currently when a user signs up on my site they are assigned the Amelia Customer user role. They are then directed to sign up for a meeting, and when they do, they create a Customer account. However, that customer account does not automatically link to the Wordpress Account, so when they schedule that first meeting, I can't show them how to use the customer panel to track appointments. And of course if they don't schedule a meeting in that first session, when they do schedule a meeting later, there's no way to automatically connect them. 

    I LOVE Amelia. Can implement custom code if needed to accomplish this? Thank you SO much for your help!!

  •  553
    Uroš replied

    Hello Lindsay,

    Thank you for reaching out to us.

    If I understood properly, you want to create customers in Amelia for each wp user with the "Amelia customer" role, is that right?

    Looking forward to your reply.

    Kind Regards, 

    Uroš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs

    You can try wpDataTables add-ons before purchase on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    Lindsay replied

    Correct! I would like to automatically create an Amelia customer when there is a user is assigned the Amelia Customer user role, and to connect that customer to their WP user. Right now, all new registrants on my site are assigned the Amelia Customer user role, but I have to manually connect them if they don't schedule a meeting on that first registration.

  •  553
    Uroš replied

    Hello Lindsay,

    Thank you for clearing that up.

    For that purpose, you can add the following code to the functions.php file.

    function createCustomers()
    {    $args  = array(
            'role'    => 'wpamelia-customer',
        );
        $users = get_users($args);
        $container = require AMELIA_PATH . '/src/Infrastructure/ContainerConfig/container.php';
        /** @var CustomerApplicationService $customerAS */    $customerAS = $container->get('application.user.customer.service');
        foreach ($users as $user) {
            $userMetaData = get_user_meta($user->ID);
            $userArr      =
                [   'status'     => 'visible',
                    'type'       => 'customer',
                    'firstName'  => !empty($userMetaData['first_name'][0]) ? $userMetaData['first_name'][0] : $user->data->user_login,
                    'lastName'   => !empty($userMetaData['last_name'][0]) ? $userMetaData['last_name'][0] : $user->data->user_login,
                    'email'      => $user->data->user_email,
                    'externalId' => $user->ID,
                ];
            $customerAS->createCustomer($userArr, true);
        }
    }

    Please let me know if that worked for you.

    Looking forward to your reply.

    Kind Regards, 

    Uroš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs

    You can try wpDataTables add-ons before purchase on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    Lindsay replied

    Thank you so much for trying!! I appreciate the effort. Unfortunately it didn't seem to do anything. 

    1. I created new user on the website (which is automatically assigned the Amelia-Customer role and nothing else) but this did not create a parallel Amelia Customer nor connect it to that wordpress account

    2. I scheduled a new meeting as that user, and an Amelia Customer was created, but not connected to the wordpress account

    3. I changed that user's role to (only) Subscriber, and then back to (only) Amelia-Customer and it did not create an Amelia Customer associated with that user, nor connect it to the wordpress account

    I know, it's disappointing, but perhaps it's something on my end? I would love to try again!!

  •  553
    Uroš replied

    Hello Lindsay,

    Thank you for the update.

    Please provide me a temporary WP-admin (administrator) user for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. 

    We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course, we do not provide login data to third parties. 

    You can write credentials here just check PRIVATE Reply so nobody can see them except us.

    Kind Regards, 

    Uroš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs

    You can try wpDataTables add-ons before purchase on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •   Lindsay replied privately
  •  553
    Uroš replied

    Hello Lindsay,

    Thank you for the credentials.

    Please note that the users can only be connected to customers in Amelia on the Amelia/Employees page if the email of the user and the employee is the same.

    Hope this helps you.

    Please let me know if you have any other questions.

    Kind Regards, 

    Uroš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs

    You can try wpDataTables add-ons before purchase on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    Lindsay replied

    I'm confused by your reply and mention of employees. I am trying to connect customers to WordPress users. I am trying to automatically generate an Amelia customer when a new user registers and is automatically applied the Amelia Customer role. There's nothing to match - the Amelia Customer that needs to be created would be created using the name and email provided when registering. I'm so sorry if I'm being unclear! 


    It would be great if new users that are assigned the Amelia Employee role at registration (I have 2 different registration flows, for customers and for employees) automatically became Amelia Employees too, but one thing at a time! 😁

  •  553
    Uroš replied

    Hello Lindsay,

    My apologies, I mistakenly wrote employees instead of customers. The new customers in Amelia are registered when they book an appointment and since you have the "Automatically create Amelia Customer user" option enabled, the wp user with the "Amelia customer" role with the same email as the customer and it will be connected to that customer. 

    Please let me know if it works that way at the moment.

    Kind Regards, 

    Uroš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs

    You can try wpDataTables add-ons before purchase on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    Lindsay replied

    Hi, yes, that's what I expected as well. And I'm pretty sure it USED to work that way. But for me, it no longer does. Note the latest customers, Juliann and Janitza. They were created as customers when they registered, but when they scheduled their first appointment (and they both had appointments scheduled) their customer account in Amelia was not connected with their Wordpress User. I believe when you register (and the amelia account is created) and then log out before scheduling that first appointment, the process breaks down. But you can test for yourself by registering on lindsaylovespets.com/register. Feel free to make as many test accounts as you need. Thank you so much for working through this - i really appreciated it.