Hi,

I understand that in a next release the display name becomes optional. Wouldn't it be even better to make it an 'all or nothing' option. So either HybridAuth does not alter any display name or it alters all display names with an Identity attached to it?
That would include the use case when an identity was added to an existing account, in which case HybridAuth currently does not alter the display name.

Technically I suppose this could be realised easily by adding some code to the "_hybridauth_identity_save" function, something like this:

  $account = user_load($uid);
  $user_data = array(
      'data' => array(
          'hybridauth' => $data
          )
  );
  user_save($account, $user_data);

In this option I simply use the latest added identity.

Hope the maintainers share my opinion.

Regards,
Roeneman

Comments

duozersk’s picture

Assigned: Unassigned » duozersk
Status: Active » Closed (won't fix)

Roen,

Thank you for a feature request.

The $user->hybridauth property is currently being used as a flag to determine if a user account was created through HybridAuth. It is needed for features like removing username and password fields from account edit form. So your suggestion on the implementation of the requested feature will have side effects.

As for the feature itself - nope, I don't share your opinion. I find it strange that there was a user with some content (nodes, comments) and he was called "duozersk" and then after some time it becomes "Andrew Berezovsky" - this is weird behavior.

If you still want to implement it for your site - then you can implement the hook_username_alter() in your code and look for the identities attached to the current user account, etc.

Thanks
AndyB

roeneman’s picture

AndyB, thanks for your fast reply.

I understand where you coming from, I suppose my use case is somewhat different from the usual. And good to know about the side effects! Thanks

May I kindly request as an alternative to make the rules hook 'hybridauth_identity_added' available as regular hook for use outside of rules? Maybe this would be good for all hooks? Then I can do my own logic on name display, first login, etc.

Thanks,
Regards,
Roeneman

duozersk’s picture

Title: Make display name also for added identities » Invoke standard hooks on hybridauth events
Status: Closed (won't fix) » Active

Sure, it sounds like a good feature to have.

Smth like hook_hybridauth_event($event, $data)... needs more thinking though.

Thanks
AndyB

roeneman’s picture

Looking at the rules_hooks you have, I would say there is some logic to it to have one hook for all registration related events, and one for the login.

So for registration this could be something like this:

module_invoke_all('hybridauth_registration', $event, $account, $data);

$event = 'insert' / 'add' / 'delete'
$account = Global $user / $account
$data = $data / $del_identity_data

And for login just what you already have:
module_invoke_all('hybridauth_user_login', $user, $data);

Could this be a starting point?
Just try to be helpfull, and loving your module.
Rgds, Roeneman

duozersk’s picture

Sure, thanks for your thoughts. I would need to allocate some time so that I can concentrate on this topic and choose the naming and invoke model that covers our cases.

AndyB

duozersk’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.