Posted: September 5, 2024 at 12:29 pm
We need to show the EE-registrants name instead of a reference ID in affiliateWP. This refrence ID corresponds uniquely with the search results in EE-transactions as ID (a 5-digit number). Can anyone help me write the mysql-code (and maybe PHP too) I have to use in a php file to retrieve the name of the registrant corresponding to that ID in EE-transactions? |
|
Hi there,
5 digit number? The Transaction ID’s are an auto incrementing row ID which starts at 1 and grows from there. Having a 5 digit TXN ID is easily doable, I’m just checking the value is indeed the TXN ID here… are you sure it is?
Generally, we don’t provide any custom code like this. However, if you have the TXN ID already and just want to pull the Primary registrant from that using our model system (in PHP, NOT directly via SQL) then I can help point you in the right direction for what you need to be looking into if that helps? |
|
Thanks Tony for your reply. I guess it might indeed the TXN-ID. It is probably 5-digits because our system is already working since years. If I can get the corresponding Primary registrant or the one who is recorded in that specific transaction via php using your model will be fine. I just need to pass the name to another php-function in the affiliate plugin. |
|
Querying with the model system takes a LOT of the work out for you tbh. If you have the TXN ID you can just pull the EE_Transaction object using the models with that ID, like so (I’ll use 11111 as the ID for now):
Now check we have an expert object returned (EE_Transaction) and then pull the primary registrant from it.
Now Now you have a much of methods on
I think all of those a fairly self-explanatory but what I recommend using is Kint: https://github.com/DuckDivers/kint-debugger It is a great little tool for debugging, enable that plugin and then do https://monosnap.com/file/8V3G2oH73FNpUnfyvhE090k813VeCo The Available Methods tab is very useful for finding methods on a class which may have what you need. If you are going to be working with EE for custom code I highly recommend reading over the docs on the model system, it makes pulling in pretty much any data within EE relatively easy (much easier than writing your own SQL and joining all of the tables yourself). See here: |
|
Thanks Tony, that´s really helpful! |
|
Ups the last link here doesn´t work: https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/model-querying.md |
|
just saying. Found it here: https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/model-querying.md |
|
ups, also don´t work when clicked…check here: |
|
Hi there, Its the forums formatting the
The URL you need is:
|
|
in EE Plugin I found a modul called EED_Affiliate_WP.module.php. Wouldn´t it be much easier to change the code within this modul to just add the name of the attendee? May I ask what I would have to write here to add the attendees name to the TXN_ID which is send over to Affiliate WP? |
|
While $txn instanceof EE_transaction I get an error here that I can not debug: What if I do not have a primary registration but only a participant? |
|
This is what the debugger delivers befor: a:3:{s:20:”attendee_information”;b:1;s:15:”payment_options”;i:1724789058;s:21:”finalize_registration”;b:1;} |
|
meanwhile got this error message to the script snippet above: |
|
Sure, it’d be easier to hack up core but then you lost the ability to update that add-on and we can’t provide support for it as it has been modified. If you want to go down that route you’d be much better creating your own function to ‘unhook’ the default EE function and replace it with your own to add whatever content you want it to be.
This isn’t custom code we are going to be able to write for you on the forums.
ADD to the TXN_ID? Previously you wanted to replace it. The TXN_ID here is a unique referral reference, with replacing it with the attendee name you lost the unique part of that becuase multiple transactions can be linked to the same name…. that could cause tissue later when you want to retrieve the referral.
See the For this kind of custom development you’ll need to be familiar with PHP and OOP to get this working.
I’m not sure I understand this, that code it requesting the primary registration for a transaction, within EE a traction will always have a primary registration.
Sorry but without some context here I don’t have any idea what that relates to.
That’s from the |
|
You must be logged in to reply to this support post. Sign In or Register for an Account