Support

Home Forums Event Espresso Premium WP user multiple attendee & disable user traffic cop for logged in user

WP user multiple attendee & disable user traffic cop for logged in user

Posted: April 16, 2019 at 11:21 pm


Praxis

April 16, 2019 at 11:21 pm

Hi there,
Can you help me figure out a way to use this code that Josh wrote which creates a user account for each registrant in a group transaction (https://gist.github.com/joshfeck/8af9e821ba5bc6e55b0e )
with this older code that disables the user traffic cop, but only for logged in users (https://eventespresso.com/topic/login-options-between-wordpress-users-and-event-espresso-4/#post-185972)?

We need to allow groups to register together and each registrant automatically needs to get a wp user account, but we can’t force a login for any existing users that are registered by their colleagues.

-Hilary


Josh

  • Support Staff

April 17, 2019 at 12:30 pm

Hi,

You can put both snippets of code into a site plugin to do both things you want to do there.


Praxis

April 17, 2019 at 6:16 pm

Hi Josh,
I had assumed that would be the case, but I added the code below to the bottom of your “wp accounts for multiple attendees” plugin and it appears to be totally ignored. Should it be placed in a different spot?

//* Disable email match check for logged out users
add_filter( 'EED_WP_Users_SPCO__verify_user_access__perform_email_user_match_check', 'ee_wp_users_remove_email_user_match_check_logged_out' );
function ee_wp_users_remove_email_user_match_check_logged_out() {
    if ( ! is_user_logged_in() ) {
        return false;        
    } else {
        return true;
    }
}


Tony

  • Support Staff

April 18, 2019 at 4:16 am

Start by checking this isn’t a logic issue for what you are trying to do.

In place of the above, use:

add_filter( 'EED_WP_Users_SPCO__verify_user_access__perform_email_user_match_check', '__return_false' );

Does it work for you then?

Note that just disables the check completely, so this is just to test the code is running.


Praxis

April 18, 2019 at 10:52 pm

Hi Tony,
Yes, totally disabling the email user match check does work.


Tony

  • Support Staff

April 19, 2019 at 4:00 am

Ok, so that means the code is running, but its not the logic you want.

The code above tells EE not to match the emails if you are logged out:

//If NOT logged in
if ( ! is_user_logged_in() ) {
    //Return false to NOT cross check emails.
    return false;        
} else {
    // Otherwise return true.
    return true;
}

If you want the check disabled when logged IN but enabled when logged OUT, remove the !, so change the above to:

//If logged IN
if ( is_user_logged_in() ) {
    //Return false to NOT cross check emails.
    return false;        
} else {
    // Otherwise return true, cross check the emails..
    return true;
}


Praxis

April 23, 2019 at 3:21 pm

This totally works. And it solves a HUGE problem for us. Phew, thanks so much, Tony!

The support post ‘WP user multiple attendee & disable user traffic cop for logged in user’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Praxis 6 months, 4 weeks ago ago

Topic Tags

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!
[for="input_96_5_3"]
[for="input_96_5_3"]
[gravityform id=96 title=false description=false]
  • This field is for validation purposes and should be left unchanged.
[i]
[i]
[gravityform id=69 title=false description=false]
  • This field is for validation purposes and should be left unchanged.