Skip to Content Skip to Menu

Question about a particular plugin event trigger

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
2 years 2 weeks ago - 2 years 2 weeks ago #331452 by bascherz
Long ago I wrote a plugin that used the following interface for the onBeforeUserUpdate trigger:
Code:
function beforeUserUpdate(&$user, &$cbUser)

Based on my decade-old code, I handled these two inputs as user being what was already stored in the database and cbUser being what was about to be stored. Debugging that plugin now, it appears these two objects may be identical when a profile change is impending. At least the fields my plugin is checking are identical. So I looked at the current (might be dated by now) trigger interface for this event on your "Using CB Triggers" page and now it looks like this:
Code:
$_PLUGINS->trigger( 'onBeforeUserUpdate', array( &$this, &$this, &$oldUserComplete, &$oldUserComplete ) );

Those last two arguments have the exact same name. Could someone please set straight what is going on here?

I am using CB 2.7.4+build.2022.10.21.15.41.28.56bdcdeab on Joomla 4.2.4.

Thanks in advance,
Bruce

Bruce S - Vienna, VA
Last edit: 2 years 2 weeks ago by bascherz.

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

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
2 years 2 weeks ago #331453 by bascherz
It's a bug in my code, but you have to admit that documentation "glitch" is a bit too coincidental.

Bruce S - Vienna, VA

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 2 weeks ago #331457 by krileon
It's not a documentation glitch. Those variables used to be something else a long time ago in CB 1.x (probably 6+ years ago). To prevent errors they were replaced with duplicates of existing objects. It's basically just backwards compatibility. With CB 3.x every trigger will be redone so we'll clean a lot of that up at that point.

With that trigger the first 2 variables are the updated user object and the last 2 are the old user object before changes.


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