Ticket #128 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

event hooks for account settings

Reported by: misja Assigned to: misja
Priority: normal Milestone: 0.9
Component: core Version:
Severity: normal Keywords: account, events, hook
Cc: misja, rho, dramirez Patch Included:
Review Stage:

Description

Currently there are no event hooks for account information changes. One notable benefit would be a password change, which then could get synchronised with other systems, if necessary. We'll have to decide on a syntax, this is one suggestion:

$object = plugin_hook("user","password_change", $u);

Comments are welcome.

Attachments

00-hooks.diff (2.3 kB) - added by misja on 12/03/07 16:51:42.
Add hooks to user detail editing
01-hooks.diff (2.2 kB) - added by misja on 12/03/07 20:21:19.
Add hooks to user detail editing

Change History

11/07/07 17:59:21 changed by rho

  • cc set to misja, rho.

What about:

plugin_hook('user', 'password:update', $u)

11/08/07 05:36:09 changed by dramirez

  • milestone set to 0.9.

On the user details that I'm porting from units to mod (I didn't commit it yet) I added:

plugin_hook('profile','republish',$u)

And it would notify any change on the user details (we lack of this even hook too)

11/08/07 05:37:09 changed by dramirez

  • cc changed from misja, rho to misja, rho, dramirez.

11/08/07 14:26:49 changed by misja

The trouble is that an identifier will need to get added, since account settings get stored in separate fields and even tables, unlike the profile account settings. My first suggestion did break a convention, but what about something like:

plugin_hook('account:password','republish',$u)

(follow-up: ↓ 7 ) 11/08/07 15:48:39 changed by rho

  • keywords set to account, events, hook.

i like the profile republish, but for password -i think- the plugin hook must be before password get updated successful, right?

(follow-up: ↓ 8 ) 11/08/07 15:55:42 changed by dramirez

In both cases the event would be triggered after the event happened. I suggest to add both hooks:

plugin_hook('account:password','republish',$u)
plugin_hook('profile','republish',$u)

What do you think?

(in reply to: ↑ 5 ) 11/08/07 21:12:53 changed by misja

Replying to rho:

i like the profile republish, but for password -i think- the plugin hook must be before password get updated successful, right?

Yes, the hook must be before the password gets updated and md5'd

(in reply to: ↑ 6 ) 11/08/07 21:24:37 changed by misja

Replying to dramirez:

In both cases the event would be triggered after the event happened. I suggest to add both hooks: {{{ plugin_hook('account:password','republish',$u) }}} {{{ plugin_hook('profile','republish',$u) }}} What do you think?

Profile looks good to me, I'm still unsure about the account:password construction. Ideally we would have a standard object for this, e.g.

$u->name  = 'password';
$u->value = 'unencrypted_password';

So you could have plugin_hook('account','republish',$u). But then again, password is stored in the user table, whereas e.g. setting email nofications is stored in user_flags. Or should we pass it as a user_flag object and let the event handler deal with it?:

$u->flag  = 'password';
$u->value = 'unencrypted_password';

12/03/07 16:51:42 changed by misja

  • attachment 00-hooks.diff added.

Add hooks to user detail editing

12/03/07 16:51:46 changed by misja

Adds hooks to email, name and password change

12/03/07 20:21:19 changed by misja

  • attachment 01-hooks.diff added.

Add hooks to user detail editing

12/03/07 20:21:20 changed by misja

Uses simply userdetails now, plus fixed typo.

12/03/07 20:25:53 changed by misja

  • status changed from new to closed.
  • resolution set to fixed.

Hooks for change in name, email or password implemented in r1329