Developer Question
Still wrapping my head around how una makes use of certain things. I have a alert registered for bx_persons and for add or edit. My alert processor is called on submit of add or edit form correctly.
My question is, it seems the alert processor is called before database update. I'll explain.
I'm wanting the display name of the user. Which the user could have changed on the form.
bx_import('BxDolProfile');
$oProfile = BxDolProfile::getInstance();
$sUserName = $oProfile->getDisplayName($oProfile->id());
//print $sUserName; exit;
So, even if member changes display name, it always shows the old one, because, it appears the alert processor is called before database update?
So what would be the proper way to get the display name in this context?
Thank you.
-
-
- · Wise
-
·
In reply to LeonidS
- ·
Hello @LeonidS
Unfortunately this gives me the "account name" not the profile display name.
-
- · Wise
- ·
I have been trying to understand when UNA calls alerts for different events. We need better documentation. I'm having to basically go through core code and just figure it out.
On the bx_persons add/edit alert, I can't seem to get the updated display name (current profile name).
@LeonidS anymore ideas? 🙏
-
- · Wise
- ·
Also, just tried using
$oAlert->iSender
Which again, gives me the not updated profile name. These alerts are thrown prematurely, or is there another one for after an edit or add is completed?
-
-
·
LeonidS
- ·
Perhaps the instance of the profile was already called before. So for the actual info you may try to use:
$aUserInfo = bx_srv('bx_persons', 'get_info', [$oAlert->iObject, false]); $sUserName = $aUserInfo['fullname'];
-
·
LeonidS
-
- · Wise
- ·
@LeonidS I will try it today, thank you.
-
-
·
Alex T⚜️
-
·
In reply to Wise
- ·
I have been trying to understand when UNA calls alerts for different events. We need better documentation. I'm having to basically go through core code and just figure it out.
We are currently working on the updated documentation for Alerts(hooks) system - https://ci.una.io/docs/hook.html
-
·
Alex T⚜️