Posted: April 17, 2018 at 10:27 am
|
I’ve created some custom shortcodes to be used within the mailing messages of EE4. 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) How do I go about retrieving this info? I’ve tried several approaches. EE_MESSAGES_ADDRESSEE has no get method in order to retrieve data, but all of its properties are public. my code for the shortcode in question is (for the moment) : Could I just get this data from the database itself? But I’d still need an ID or something from the registration. Stuck, please help. |
Hi there,
Can I ask where you see that? As far as I can tell the
You’ll need to double check they return the expected objects before using them:
and
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. |
|
|
Thanks for the feedback. I took a look at the classes in the source code for EE_MESSAGES_ADDRESSEE, EE_EVENT, EE_ATTENDEE, etc. and saw that they had public properties for each of these. I will give this a go, should be fine now, but will post an update. |
|
So it seems like the system doesn’t find any object except the event object (I used your code from https://gist.github.com/Pebblo/e87cc8e30c4848dcdfe2). The $aee object keep on returning null (as per $aee = $data instanceof EE_Messages_Addressee ? $data : NULL;). At first I thought this was because I was sending a test message directly from the message template and that there would thus be no object to associate. But I also tried doing an actual registration on the site, and it still returned null. Can I get the attendee details from just the event object, or can perhaps I use the other shortcodes within my custom shortcode? What I am trying to create (and why I don’t just use the existing shortcode as is) is I’ve built a page that has a quiz relating to the event with an access list (of registrants)(Everything is working fine up until this point). I now want to send the users that registered a link to the quiz page with an encrypted version of their email as a url parameter. I can handle the encryption/decryption, but I just need to get the registrant email for this. |
No, the event object is just all of the event details, it’s not linked to registrations, attendees etc.
You mean other EE message shortcodes? No but if you don’t have access to the data already, then neither will the shortcode at that point.
What context are you sending the message from? Which message template etc? Can you post all of your code to either a gist or pastebin so I can take a look over it?
|
|
|
https://pastebin.com/9wMG5BWR for the pastebin, I’ve commented out some code in order to debug, this is only the code for the shortcode. |
What context are you sending the message from? Which message template etc? |
|
|
Oh yeah, sorry. Shortcode is inside the [EVENT_LIST] context. |
Which message template etc? I need to know where you are using the shortcode, I can see from the code is an event based shortcode but in which message template are you using it and which ‘context’, see: https://eventespresso.com/wiki/messages-system-working-with-message-contexts/ |
|
|
Email Registration Approved Template (Registrant Recipient) . Thanks for clarifying, wasn’t really sure what you meant. |
Ok, you need something like this: https://gist.github.com/Pebblo/dc950fde4e8bfd5a70c6d6fc5e2ac9c7
The way I would have done this is to add the shortcode to either the Also be careful with your conditionals, in the code you linked to:
Check if Similar problem here:
If But anyway, the Gist I linked to above will return the primary_att_email, a quick example: Shortcode: http://take.ms/UugKN |
|
The support post ‘URGENT: Getting primary registrant email from within custom shortcode’ 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.