[SOLVED] onBeforeUserProfileEditDisplay event issue

6 years 9 months ago - 6 years 9 months ago #295600 by bascherz
I'm a part-time hobbyist-level developer. Back in 2013 I had a developer subscription to Joomlapolis and downloaded a copy of the application programming interface document, which hadn't changed much since it was freely available back in 2006. Back in the Joomla 1.0 era, I wrote a CB plugin that used to use the onBeforeUserProfileDisplay event, my handler for which stopped working within the past couple years or so. Searching through these forums, I found a recent reference to an event named onBeforeUserProfileEditDisplay, which actually seemed more concisely what I needed and I suspected may be the new event name. So I changed my code to use this event, the function for which has two fewer arguments that the old one, and voila! My code started working again. SORT OF.

I use this event to update the user profile after registration is confirmed, before the user has a chance to log in for the first time. The event handler updates profile fields setup as type multicheckbox or multiselect to assert the default values for these fields. In testing a new user registration, those checkboxes aren't checked upon the first entry into the profile editor, but I have confirmed the database updates were done (so my code is working) and the checkboxes are checked upon the second profile edit after registration.

It is my understanding that this particular event is supposed to give the handler the opportunity to do things like this BEFORE the profile is displayed for editing. Am I misunderstanding this? Is there some other/better event I should be using? I don't have the API document for CB 2.x.

I realize this isn't a Joomlapolis developer support forum and I can't justify the cost of a developer subscription since I only write free extensions, but if this isn't working the way it should be I thought the kind folks at Joomlapolis should know about it. Of course, I would appreciate any critical input on this from them or the community.

Thanks in advance,
Bruce S.

______________________
Bruce S - Vienna, VA

Please Log in to join the conversation.

6 years 9 months ago #295636 by krileon
Replied by krileon on topic onBeforeUserProfileEditDisplay event issue
The trigger you probably should be using is onAfterFirstLogin, which is fired directly after login and only if it's their first login. A list of triggers available and their variables can be found below. It does tend to go out of date as new triggers are added, but I try to update it as often as possible.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18358-using-cb-triggers

Your current trigger is indeed firing directly before profile edit is displayed.


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 to join the conversation.

6 years 9 months ago #295697 by bascherz
Replied by bascherz on topic onBeforeUserProfileEditDisplay event issue
Yes, I figured that out later that day and made the change. However, I avoided it originally because login is every session whereas profile edit is as-needed. But it is working correctly now. Thanks!

______________________
Bruce S - Vienna, VA
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

6 years 9 months ago #295707 by krileon
Replied by krileon on topic onBeforeUserProfileEditDisplay event issue

However, I avoided it originally because login is every session

Won't be the case for onAfterFirstLogin since it only fires for their first login then never again.


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 to join the conversation.

6 years 9 months ago #295710 by bascherz
Replied by bascherz on topic onBeforeUserProfileEditDisplay event issue
Ah...subtle distinction I didn't catch. I used onAfterLogin, which is every time.

Thanks again. :-)

Bruce

______________________
Bruce S - Vienna, VA
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.198 seconds

Facebook Twitter LinkedIn