Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Black Friday Intro Offer for your subscription's lifetime
🎉 Black Friday sale is here! Great savings on professional and developer memberships! Get 25% off now with code BLACK-FRIDAY-2024!

OnBeforeUserProfileEditDisplay late to the party in Auto Action?

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
6 years 6 months ago - 6 years 6 months ago #304170 by bascherz
I setup an auto action to trigger on the onBeforeUserProfileEditDisplay event. The auto-action is a query that pulls data from some other table and populates a handful of profile fields. The event is triggering and the query is running. I can tell because when I edit my profile, the values from the other table show up in my comprofiler record when I look at it in the database. But the values do not display in the profile editor text boxes unless I refresh my browser window. How do I get them to display as soon as I enter the editor? That's what I thought using this event would achieve.

FYI, the same exact thing happens if I use the onBeforeUserProfileEditRequest event.

Thanks in advance,
Bruce

Bruce S - Vienna, VA
Last edit: 6 years 6 months ago by bascherz.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
6 years 6 months ago #304180 by krileon
By then the user object has already been constructed. Your query is not updating the user object. So that instance of profile edit will not see your changes unless you refresh the page. You'll need to use a field action and set the variable in the trigger that's the user object as a reference it should then update the field object. If you absolutely need to do this using a query I'm not sure what to suggest beyond a Code action and use PHP to perform your query then PHP to update the user object.

The onBeforeUserProfileEditRequest trigger is fired before the user object has been built. It however doesn't contain a user object in it of course and only contains the user id of the user being edited as [var1], which should be enough for CB Auto Actions to construct a user object for substitution purposes. You can try that trigger, but you may need to set User to Manually then select Variable 1.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
6 years 6 months ago #304195 by bascherz
Not really sure I get what you're telling me in that second part, Kyle. Could you please elaborate a bit on that possible solution? I tried using this method and accessing [var1_user_id], but it didn't seem to work at all. I am sure I am missing some salient point.

In the meantime, here's what I am doing as an interim solution. I used the onAfterUserLoginSuccess event, which loads the database table values into the super user's fields at login. My profile editor cancel/update auto-action still works as it should (clearing the fields upon Update or Cancel). But there appears to be no similar event (CB or Joomla) for backend logins. This is a minor limitation/inconvenience.

Thanks,
Bruce

Bruce S - Vienna, VA

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
6 years 6 months ago #304200 by krileon
Try using the below.

Global
Triggers: onBeforeUserProfileEditRequest
Type: Query
User: Manually
User Variable: Variable 1

This should work as the user object hasn't been constructed yet, but if the user object has already been cached into our cbUser API this still won't work. The best way is a field action that actually updates the user object.

But there appears to be no similar event (CB or Joomla) for backend logins. This is a minor limitation/inconvenience.

CB has no backend login control and that's entirely controlled by Joomla. There likely is a Joomla event for it, but I do not know what it is and am unsure if CB Auto Actions would even be able to act on it.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
6 years 6 months ago #304236 by bascherz
Kyle,

I already tried exactly that, but I thought maybe you left out some detail because it did not work at all. I can't use a field action because I have to query an ad hoc database table that stores the values common to all the super users who maintain this site feature before displaying them. I'm basically using user profile fields to read/update an ad hoc table because I didn't want to develop an extension just to do that. Pulling the table values at login will work OK, and the Joomla events work as well as the CB events. It's not a big deal if there are no equivalent back end events, but I will have to make sure the site owner knows he has to do all this via the front end profile editor. That should not be a big deal.

Thanks,
Bruce

Bruce S - Vienna, VA

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
6 years 6 months ago #304249 by krileon
Yeah it'd be better to do it after login, after profile update, and after registration events. Those would ensure the data is probably loaded back into the user object otherwise you're going to have to combine Field actions with CB Query Field usages, etc.. to get the query results back into the user object when the profile is being displayed; could quickly become a mess.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum