Support

Home Forums Event Espresso Premium URGENT: Getting primary registrant email from within custom shortcode Reply To: URGENT: Getting primary registrant email from within custom shortcode

Reply To: URGENT: Getting primary registrant email from within custom shortcode

Author Replies
Tony # Posted on April 17, 2018 at 2:40 pm

Hi there,

This works fine, but I am trying to get the primary registrant email (or any of the data for that matter) from within EE_MESSAGES_ADDERESSEE (which I can see has a $primary_registrant_email property)

Can I ask where you see that?

As far as I can tell the EE_Messages_Addressee object does not have a primary_registrant_email property, the only place I see that is the shortcode [PRIMARY_REGISTRANT_EMAIL] which calls the email method on an EE_Attendee object.

EE_Messages_Addressee has both the primary registration and primary attende objects available as properties, so you would do something like:

$primary_reg = $eea->primary_reg_obj;
$primary_attendee = $eea->primary_att_obj;

You’ll need to double check they return the expected objects before using them:

if( $primary_reg instanceof EE_Registration ) {
    //Is a valid EE_Registration object, do something with it here.
}

and

if ( $prmary_attendee instanceof EE_Attendee ) {
    //$primary_attendee is a valid EE_Attendee object, as it's the primary 
    //attendee object you can pull the email from it.
    $primary_att_email = $primary_attendee->email();
}

Note that urgent or not, we do not provide support for custom code. Whilst I’m more than happy to help point you in the right direction with the above it’s important to note that custom code is outside the scope of our support.

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