Support

Home Forums WP User Integration Pre-upload users and show custom registration

Pre-upload users and show custom registration

Posted: July 15, 2017 at 9:48 am


mcgilloweek

July 15, 2017 at 9:48 am

Hello. I have EE4 with the WP User Integration Add-on and the Members plugin by Justin Tadlock. Can someone help me implement the following:

– Bulk pre-load users and some user info (e.g. date of birth) that I do not want users to self-input.
– Not allow users to register unless they are in the pre-uploaded database.
– Not allow users to edit or modify the pre-uploaded user info.
– Collect additional user info via the registration form.
– Show certain event categories to registrants based on their user info or category or role (can be creative here with how to show only certain events to certain kinds of users)

Thank you!!


Josh

  • Support Staff

July 18, 2017 at 10:04 am

Hi there,

I’ll follow up with each of your questions below:

– Bulk pre-load users and some user info (e.g. date of birth) that I do not want users to self-input.

You can use this plugin to bulk import users with user info:
https://wordpress.org/plugins/import-users-from-csv-with-meta/

– Not allow users to register unless they are in the pre-uploaded database.

You set the “Login Required on Registration” option to Yes in the WP Users Integration plugin:
https://eventespresso.com/wiki/wp-user-integration/#ee4setup

– Not allow users to edit or modify the pre-uploaded user info.

There are a few places where this can be edited, so there are a few parts to this. This part disallows the user from editing on their profile page:
https://wordpress.stackexchange.com/questions/29000/disallow-user-from-editing-their-own-profile-information

Then you’ll also need to set “Always sync contact information with WP user profile?” to No in the Event Espresso > Registration Form > Reg form settings page.

– Collect additional user info via the registration form.

You can collect additional registration/attendee info on the registration form by following these guides:
https://eventespresso.com/wiki/add-questions-event-espresso-question-groups/
https://eventespresso.com/wiki/questions/#40_

Please note that the registration form answers do not get written to the WP User meta table. These answers are attached to the registration. If you want the answers to be pre-populated on their following registrations, then there’s some code you can add to a functions plugin:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/mn_wp_user_addon_save_custom_answers_too.php

– Show certain event categories to registrants based on their user info or category or role (can be creative here with how to show only certain events to certain kinds of users)

You can actually use the Members plugin with some shortcodes to do this. The Members plugin has an [access] shortcode that you wrap around content so it’s hidden unless the user is logged in and has a matching capability on their account. Here’s an example step by step that shows how this can work:

1) Create some new custom capabilities with the Members plugin e.g.
ee_read_event_category_a, ee_read_event_category_b, and so on.
2) Assign the above capabilities to appropriate user accounts.
3) Set up your Event Espresso event categories e.g.
event_category_a, event_category_b, and so on.
4) Add these shortcodes to a page:

[access capability="ee_read_event_category_a"]
[ESPRESSO_EVENTS category_slug=event_category_a]
[/access]
[access capability="ee_read_event_category_b"]
[ESPRESSO_EVENTS category_slug=event_category_b]
[/access]

and so on.

Hope that helps!


mcgilloweek

July 21, 2017 at 2:29 pm

Hi, Josh! This was so amazingly helpful. Thanks so much for your comprehensive and informative reply.

Some follow-up questions:
– I went to the reg form settings page but can’t find the “Always sync contact information with WP user profile?” option…
– Is it possible to show more, related events only if someone has added a ticket for a parent event to their cart? (e.g. you sign up for a show and now have the option to add on a “meet and greet” package)
– Instead of using the Members plugin shortcode to hide/display events to certain users, could I pre-upload users in a new role I create (e.g. international_student) and then use the Event Espresso settings to only show events to this role? The only thing is that there used to be this setting to show events only to certain roles whenever I made an event and now it’s gone. Maybe because something I changed in the general settings affected this?

Thanks so much!!


Josh

  • Support Staff

July 21, 2017 at 2:40 pm

I went to the reg form settings page but can’t find the “Always sync contact information with WP user profile?” option…

Do you have the WP User Integration add-on activated? If so there should be a WP User Integration tab on the Event Espresso > Registration forms admin page where you’ll find that option.

Is it possible to show more, related events only if someone has added a ticket for a parent event to their cart? (e.g. you sign up for a show and now have the option to add on a “meet and greet” package)

This would require some significant PHP development.

Instead of using the Members plugin shortcode to hide/display events to certain users, could I pre-upload users in a new role I create (e.g. international_student) and then use the Event Espresso settings to only show events to this role?

Event Espresso does not have settings for hiding/displaying events to certain users.


mcgilloweek

July 22, 2017 at 2:31 pm

Hi Josh. Thanks so much for clarifying that. I have two more related questions that I sort of mentioned in my first post, but I realize I may not have explained well enough.

When people are using the EE registration form:
– How can I pre-populate their reg form answers with WP User meta data? You said that reg form info cannot be written to the WP user table (which makes sense), but is the reverse possible? I noticed that First Name, Last Name, and Email (system questions) are pre-populated in the registration form (I’m assuming by pulling this info from WP user data) so can this function be extended if (for instance) “Date of birth” is a field I added to the WP User data table and want this pulled into the “Date of birth” question in the registration form?
– (if the pre-population is possible) How could I not allow people to edit pre-populated fields?

To explain the background behind these requests, I am trying to prevent sneaky registrants from falsifying some of their information that I already have access to/know for a fact and am pre-populating via the plugins you linked me to (which are working out great).

Thank you!!


mcgilloweek

July 23, 2017 at 10:16 am

Hi again.
I tried your capability codes and they don’t seem to work for me.
What would I do if I want a user to see events made by a different user of a specific category. If the category slug is “fun” would the code be: ee_read_others_event_category_fun or ee_read_others_fun or…? Nothing is working for me, and I’ve tried many other variations. Thank you!!


Josh

  • Support Staff

July 24, 2017 at 3:12 pm

Hi there,

Prepopulating a registration form question with data from the wp user meta table would actually require some significant PHP development. I’m not sure why you’d include a field on the registration form where you don’t want the data changed anyway.

With regards to the capability, you’ll actually be creating the capability with the members plugin, then using the members plugin to restrict content. So the capability could be anything unique that you make up and as long as the capability you make is the same as what you use in the shortcode it will do the job. Another example:

1) Create new custom capabilities with the Members plugin e.g.
fun_read_events_category and
boring_read_events_category
2) Assign the capabilities to appropriate user accounts.
3) Set up your Event Espresso event categories e.g.
fun-event-category, boring-event-category, and so on.
4) Add these shortcodes to a page:

[access capability="fun_read_events_category"]
[ESPRESSO_EVENTS category_slug=fun-event-category]
[/access]
[access capability="boring_read_events_category"]
[ESPRESSO_EVENTS category_slug=boring-event-category]
[/access]

and so on.


mcgilloweek

July 24, 2017 at 4:45 pm

Hi Josh. Thanks for the help! I should explain my more specific reasoning behind all this registration form customization because maybe I’m unaware of settings or code that could help.

When an event organizer views or downloads a CSV of all the registrants for their event, in that CSV, I want to capture all my WP user meta data (that I pre-loaded with the plugin you suggested – thanks!) and all the registration form data that the registrant filled out.

So I was thinking that if I can pull the WP user data into the form and make it uneditable, it would be a “workaround” of sorts of pulling the data into the CSV that is exported, since it contains reg form data but not WP user data. HOWEVER, I have today learned from Lorenzo that reg form data is only put into the registration for the first event someone registers for in a multi-event order. This is a problem because I need each event to include the reg form data. The only way around this is to check the question groups for additional registrants and then it will consider each event a new registrant and require the person to fill out the form for each new event (not fun when I have people selecting 10 events in one order).

So I should start with the basic question and see if you have any suggestions (please!): How could I include pre-loaded WP user data AND any additionally collected reg form data in the CSVs that are exported for ALL the events anyone registers for?

Any and all creative solutions are welcome! I’m working with a developer who has been handling any custom CSS, PHP, JS code but does need templates or examples to work from when things are more complex.

Also, for the capabilities, that works but only in pages. I am hoping to restrict certain event organizers from seeing content in the EE wp-admin pages (e.g. https://mcgilloweek.ca/wp-admin/admin.php?page=espresso_registrations)

Thank you thank you thank you!!


Josh

  • Support Staff

July 25, 2017 at 8:17 am

First, I’m not sure that Lorenzo’s information was correct because if you include registration form questions for additional attendees, each registration for each event will include form fields and data.

That said, I don’t think it’s necessary to include the user meta into the registration just to get that information onto the CSV report. The CSV report has the capability to allow custom additional columns. If your developer has a reasonable understanding of the WordPress plugin API, then they can use this hook to add more columns to the registrations CSV report:

FHEE__EE_Export__report_registrations__reg_csv_array

Here’s a link to the source code where that filter resides in EE4 core so they can review the context:

https://github.com/eventespresso/event-espresso-core/blob/master/core/libraries/batch/JobHandlers/RegistrationsReport.php#L405

I am hoping to restrict certain event organizers from seeing content in the EE wp-admin pages (e.g. https://mcgilloweek.ca/wp-admin/admin.php?page=espresso_registrations)

You can restrict certain event organizers from seeing content in the EE wp-admin pages by using the Members plugin to edit their user account/role and remove some or all of the following capabilities:

ee_read_checkin
ee_read_checkins
ee_read_registration
ee_read_registrations
ee_read_others_registrations
ee_read_others_checkins

There’s more information in the documentation about the capabilities system:

https://eventespresso.com/wiki/event-espresso-4-roles-permissions/


mcgilloweek

July 26, 2017 at 1:39 pm

Hi Josh. Thanks so much for the response and info. I’ve now learned that this is why it’s helpful to explain my reasoning/needs rather than just ask for how to do something. 🙂

Lorenzo was right with what he told me, but maybe you misunderstood what I wrote or I wasn’t clear in what I wrote. There won’t ever be “additional guests” for my event sales. What I ideally need is that 1 guest can register for multiple events, fill out 1 registration form, and then the info from the form will be loaded into the CSV for all events that the 1 person registered for. That’s what doesn’t seem to be happening. Either, only one event in the order gets the reg form into a CSV or I have to enable “Additional Registrants” and it asks the 1 guest to complete a form per event and thinks that they are multiple people. However, your hook suggestion might be an even better solution, so I’ll work with that for now. Ideally then, I would ask my registrants to fill out a form somewhere on my site (not an EE form) and pull all the info from it to new columns in the CSVs. I’d also want to pull in WP user meta data into the CSV. You think that’s all possible? Any suggestions are appreciated!

And the capabilities documentation is helpful but there is a specific capability that I can’t seem to find (and may not exist therefore). If I have an EE event category called Fun Times and the category slug is “fun”, what would the capability be so that a user can only see events of that CATEGORY only, whether it’s their event or another user’s event. ee_read_events allows them to read only their events. ee_read_others_events allows them to read ALL others’ events. How do I allow them to read ALL events of the category “fun” no matter who authored them? I’ve tried ee_read_event_category_fun and ee_read_events_category_fun and ee_read_fun … nothing has worked.

Thanks as always!!


Josh

  • Support Staff

July 26, 2017 at 1:51 pm

The capability to view a category doesn’t exist because you’ll need to make it. Earlier in this thread I gave you some very specific step-by-step instructions about how to set up a page to view different lists of events by categories (with access restrictions). Here they are again:

1) Create new custom capabilities with the Members plugin e.g.
fun_read_events_category and
boring_read_events_category
2) Assign the capabilities to appropriate user accounts.
3) Set up your Event Espresso event categories e.g.
fun-event-category, boring-event-category, and so on.
4) Add these shortcodes to a page:

[access capability="fun_read_events_category"]
[ESPRESSO_EVENTS category_slug=fun-event-category]
[/access]
[access capability="boring_read_events_category"]
[ESPRESSO_EVENTS category_slug=boring-event-category]
[/access]

and so on.


mcgilloweek

July 26, 2017 at 2:31 pm

Right, I saw that and the issue that I mentioned in the follow-up is that I’m not using these capabilities to show events in front-end pages. I need the capability to apply to wp-admin areas (https://mcgilloweek.ca/wp-admin/admin.php?page=espresso_registrations) where I can’t wrap custom [access capability] shortcodes, to the best of my knowledge. Unless that’s possible in some way? The default ee_read_events and ee_read_others_events DO apply to the wp-admin areas so I thought that there might be “built-in” ee capabilities that involve reading event categories as well.


Josh

  • Support Staff

July 26, 2017 at 2:46 pm

The built in capabilities do not include restricting access to events based on categories.


mcgilloweek

July 26, 2017 at 2:53 pm

OK. Noted! Thanks for all your extensive help on this thread. Will mark as resolved 🙂

The support post ‘Pre-upload users and show custom registration’ 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.

Event Espresso