Posted: November 9, 2022 at 1:47 pm
Based off of this post (https://eventespresso.com/topic/create-users-for-each-of-the-registrants/), I’ve been unsuccessful with the code snippet. I’ve created my own “plugin” and uploaded it to the FTP. Is there something else on my end I need to do? |
|
Hi there, So you follow the steps here: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ Created a custom functions plugin and uploaded it to your site, added the snippet from the other thread: Did you activate the custom functions plugin? |
|
This reply has been marked as private. | |
Your running PHP8 and that snippet needs a quick update for it. Change this line: To be:
|
|
Thank you kindly! I will keep you posted to see if this works. |
|
Just a quick note for future readers of this thread, I’ve updated the snippet with the above change so no need to change it anymore. |
|
Thank you, Tony, for your assistance. This worked beautifully. Is there the option to create a username based off of their first and last name? Right now it’s creating the username based upon email address. In addition to that, is there a code snippet that possibly goes off of that one? I have administrative assistants and personnel signing up multiple people at a time for events and won’t always be able to have certain individuals sign up for themselves. I’d love it if you had the option to say, “If this account exists, please still continue with purchase of said ticket for specified user.” |
|
Sure, thats now your own custom function so you can change the code how you prefer, this section: Is what creates the user account and yes it currently uses
Sorry, I’m not sure I follow. Goes off and does what?
By specified user, do the registrant details? I assume you don’t mean the admin. |
|
Thank you. I will look further into this. I have administrative assistants sign-up two users. If one of those users is created through that code snippet, but the administrative assistant wants to sign them up for an additional event… it will prompt that user to sign into their own account. Is there a way around that? |
|
Yes, you can disable that check, using the second snippet here: https://gist.github.com/joshfeck/1131145859a3fab58f4d#file-disable_email_match_everyone-php Be careful when doing this, the reason that functionality exists is to keep your registration synced with the correct WP user account, disabling it can stop that happening. I highly recommend disabling the WP User sync feature when using the above snippet: Event Espresso -> Registration Form -> User integration settings. Set ‘Always sync contact information with WP user profile?’ to No and save. |
|
I still appear to be having an issue with the
with the plugin. Every now and then, it’ll give me a technical error and then a critical error. Any suggestions? |
|
Check the server’s error logs to see what the ‘full error’ being thrown is an post that here. The above could be from any code running, so we need the ‘ful’ error to troubleshoot. |
|
This reply has been marked as private. | |
Hi, That looks like an access log rather than the PHP error log? |
|
This reply has been marked as private. | |
Within:
What is line 24? |
|
I believe it’s this section because it’s saying, “Uncaught Error: Undefined constant “EE_FRONT_AJAX”” if (defined(‘EE_FRONT_AJAX’) && EE_FRONT_AJAX) { |
|
The error is stating
This part Then this part So getting the above error for that code doesn’t really make sense. Can you post the full contents of that file to Pastebin so I can take a look? |
|
Yeah, that makes no sense! The code is literally checking to see if the constant is defined before using it. That’s definitely the correct file, right? As in you don’t have multiple custom function plugins and that’s the ‘fixed’ one but the ‘other’ is actually the one activated (I’ve got to ask as I’ve seen it happen before). |
|
It should be the correct file, although I’ve since renamed the plugin name within the file and it’s still showing up under the old name. Any recommendations would be great on how to ensure it’s the correct file. |
|
That doesn’t sound like the right file. Hover over the deactivate link in Dashboard -> Plugins. Look at the URL in the browser, it will show you the directory and filename: https://monosnap.com/file/9BSWeBiBvHZjel41hnuxPQSeBf6oVg That’s the plugin directory name and the plugin file name. |
|
I think we have it sorted now, Tony. My apologies. Would you be able to tell me if there’s page or a way to create a page that has all of the events a specific user is attending? |
|
Something like the My Events section? https://eventespresso.com/wiki/wp-user-integration/#ee4-my-events That’s using the |
|
That’s perfect! Thank you, Tony. |
|
You’re most welcome 🙂 |
|
I have one more question as it pertains to registration. Right now, users receive an email and their brought to the backend of WordPress. Is there, or is it possible to create, a front-end registration form so users don’t see the backend? |
|
Is this when the user confirms the email within the email send by WordPress? You could use a plugin such as this: https://wordpress.org/plugins/remove-dashboard-access-for-non-admins/ TO remove dashboard access for subscribers (which I assume is what you have the above set to create?). |
|
Yes; is there a way to integrate the Gravity Forms User Registration Add-On and have the user go through that to set their password? Or is the registration from WordPress set-up through the back-end something that needs to happen? |
|
Not really, you’re using custom code to automatically generate user accounts from the values passed to it, I’m not sure how you would then use the Gravity From User Registration add-on to work with that?
The user doesn’t need any access to the dashboard/wp-admin in terms of Event Espresso, or the WP user account. The WP user account is created in the same way WordPress created them and an email sent for them to set the password is what you are getting currently I assume? Can you include a couple of screenshots showing what is happening? (You can mark you replay private so only EE staff can view them) https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots |
|
One more question, sorry. I current am using WP User Integration, the PHP that allows users to purchase multiple tickets at a time, and the “Always sync contact information with WP user profile? set to ‘No.’ If UserA purchases tickets for UserB, I want UserB to see that ticket on UserB’s profile. Is that something that can happen or not the way I have it set-up currently? |
|
Have you tested if that isn’t the case already? The code above looks like it should already handle that use case. |
|
I think I found the missing piece of the puzzle because it was still asking if you had an account to login. But, is this code okay to go in something like a Code Snippet plugin or does it need to be it’s own, standalone, plugin? `add_filter( ‘EED_WP_Users_SPCO__verify_user_access__perform_email_user_match_check’, ‘__return_false’ ); |
|
Do you mean a code snippet plugin that allows you to add snippets from within the admin? If so it depends on when that plugin is running the code. However, it will be slightly fast to load your custom code into an actual custom plugin so it doesn’t need to be loaded from the database each time. You don’t need every single snippet in its own plugin, but create a custom functions plugin to hold your custom snippets and place them all in there (you can also split them into different individual plugins if needed, that’s up to you. The code above should run fine anywhere as long as it runs before EE’s code to hook in before it runs. |
|
I’m currently running WPCode for the code snippets. Last night, I was successful in signing up for a ticket without logging in but the second ticket I purchased was not attached to the user’s account. I’m going to try to test this morning to see if putting that code in a separate plugin will help. |
|
If EE is no longer asking for them to log in, then that snippet is running fine. The code uses the email address to pull in the WP User account. This part of the code: Check if the current WP User already has an EE_Contact ID assigned to it ( If the user already has a contact assigned to them, then the registrant details input must match the first name, last name and email address exactly to link them up. |
|
Okay, so if the first name was ‘Ben’ and I input ‘Benjamin,’ that would not allow it to hook up to that attendee? Can I just have the email match or does it need to go off of the first name, last name and email address? |
|
No, it needs to match exactly.
No, because users use the same email address for multiple registrations. For example, someone may register 3 people and chose to use the same email address for them, their partner and their child but all different names. Now you’re getting into the complexities of creating multiple user accounts from registrations 🙂 |
|
This reply has been marked as private. | |
It’s not just with parent and child, that’s a quick example but the short answer is doing this based purely on the email address provided in a registration increases the risk of linking to the wrong user. If this happens and you end up with multiple records needing to be fixed, it’s on you rather than us to fix it as its removes the safeguarding we are doing on this. I’ll help point you in the direction you want to go here but if I don’t say the above and you return in 6 months with 2000 records needing to be fixed it’s then on me 🙂 Event Espresso itself will use the first name, last name and email address when checking EE_Contacts, your custom function about can skip first name and last name checks when it has created the user account on that request by changing this: To just be:
Which I think will do what you are asking for. |
|
Thank you for your assistance! In this instance, do you know if there’s an easy way to, as an administrator, switch tickets between users manually — if that were to happen? |
|
Switch tickets? Can you expand on what you mean a little more please? |
|
So, I guess if someone were to purchase a ticket and misspelled the email address, would we have to cancel that transaction and put through another one manually? Or is there a way to configure it to go to the correct person on the back-end in WordPress? |
|
I signed up, without logging into the website, and tested purchasing two tickets. One for myself and one for a colleague. It connected one of the tickets to my account just fine; the first entry. The second ticket, for my colleague, was not put into his “My Event Tickets” page. Is that a known issue with having it set-up this way, as well? |
|
The other issue is now the Pending Registrations are still showing up even though I’ve manually marked them as paid in the backend of the system. |
|
It gets a little complicated because now you’ll have a WP User created with the wrong email address and an EE_Contact created with the ‘wrong’ values and also at least 1 registration linked to that wrong contact AND that contact linked to the wrong WP User account. If the user already has an EE_Contact (the ‘correct’ EE_Contact) then I have a snippet you can use to set the ATT_ID (Contact ID) on a registration which means you can update a registration to switch from one contact to another: https://gist.github.com/Pebblo/239dcbbab9514c13ba48fe3e8e9a5add That only works if they already had a contact before making the error so you can swap the registration to the correct one (as long as that contact is then linked to the correct WP user).
Did you match the details exactly on second ticket to the other user? Did that user already have an EE contact? As in has they already made registrations whilst logged in and have those show in the My Events section? Check the registration and see if its linked to the correct EE_Contact for that user (compare the EE_Contact ID on that registration with one that does show up in my events). |
|
I don’t follow here, can you explain further? Or include some screenshots? https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots |
|
This reply has been marked as private. | |
Edit the user account in Dashboard -> Users. You should see their registrations at the bottom of the profile page and a button that takes you to ‘View Linked Contact’. CLicking on that will take you to the linked contact for that user.
Your not looking at pending registrations there, your view upcoming events. Click on the icon and you’ll see a list of registrations related to the event the row is for, do those show as Pending or Approved? |
|
So, no, only one of those courses is showing linked to that specific user/EE_Contact ID. If I click the gear, those registrations show up as approved. I was reading it, based on the key, as though the green was “Pending payment.” |
|
Right, so use the snippet I posted above in a custom functions plugin: You can add that to a custom functions plugin on your site, we have some documentation on creating one here: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ And update the ATT_ID for the ‘broken’ registration to be the correct ID for that user. The registration will then be linked to the correct EE_Contact and the my events section pulls the registrations linked to the user based on the ATT_ID.
Its showing the individual events and then the registrations for those individual events on each row. You could try the
The lists individual registrations rather than sectioning them into events, does that work better? |
|
And this is probably a stupid question, but where can I find the Contact ID, I’m assuming it’s a number — is it the post ID? |
|
Will that have to be continuously done with that specific user? If they keep purchasing events? |
|
Sorry, yeah. When you click on the ‘View Linked Contact’ button, the Contact ID is the post=XX in the address bar.
I’m not sure I follow… if they keep registering using details that don’t match the correct contact then yes, but… that’s kinda to be expected if they don’t match their own details is it not? |
|
The support post ‘Creating Multiple Users Upon Registration of an Event’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.