Support

Home Forums Event Espresso Premium Ticket Capability Requirement Reply To: Ticket Capability Requirement

Reply To: Ticket Capability Requirement

Author Replies
Tony # Posted on May 9, 2018 at 2:43 pm

Hi Paul,

What if, for some reason $user is null and you log null?

I’d log $registration->ID() and the user details.

Also, error_log() accepts a string, $user is likely to be a WP_User object, so that’s not going to work. At the very least it’ll give a PHP Warning each time its passed a WP_User object.

I’d do something like:

if( $registration instanceof EE_Registration ) {
    $debug_info['Registration_ID'] = $registration->ID();
}
if( $user instanceof WP_User ) {
    $debug_info['WP_User'] = array(
        'User_id' => $user->ID,
        'roles' => $user->roles
    );
}
error_log(print_r($debug_info, true));

Writing the full WP_User object to the log will also save the users hashed password, thats up to you if you wish to do so but the above will give you the Registration, User ID and roles the user is assigned to.

Do NOT follow this link or you will be banned from the site!