This module doesn't seem to work if you invite an existing user and they are not currently logged in to the site when they try to accept the invite.

If they log in while accepting the invite, the invite is never accepted.

If instead they create a new account (with a different email address) the invite is never accepted either.

The correct logic for what to do here seems to already exist in the module's invite_accept() function; the rest of the code just needs to be updated to work with it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David_Rothstein’s picture

Status: Active » Needs review
FileSize
1.94 KB

Here is a patch.

ckng’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#2215723: Only allow new users to be invited

A valid patch, but not needed if existing user should not be invited in the first place.

Do you have any use case where existing user could be invited? From my point of view, Invite should be for invitation to user not in the system yet?

Will keep this patch in view, but marked as duplicate of #2215723: Only allow new users to be invited so a proper solution could be created. Feel free to chimp in on the other task.

ckng’s picture

Status: Closed (duplicate) » Needs review

Reopening this. There are use cases for inviting registered user.

David_Rothstein’s picture

Yes, there are definitely use cases for inviting existing users. In my case I'm using the Invite OG Plugin module (https://www.drupal.org/sandbox/killerpoke/1441644) to invite people to organic groups, so it's certainly possible that they're already a member of the site (but not yet a member of the group they've been invited to).

I actually just ran into a situation where this patch is still incomplete. It might be considered a separate bug, but I think it's worth fixing here. The issue is that the Invite module assumes the only way to log in to a site is via the standard login form, but in fact that's not the case - the site I'm using this on also allows logins via https://www.drupal.org/project/hybridauth.

Here's an update to the patch that makes the Invite module respond to hook_user_login() instead so that it picks up all ways in which a user might log in.

ckng’s picture

Status: Needs review » Fixed

Thanks for the code. Committed.

  • David_Rothstein authored 4e5d429 on 7.x-4.x
    Issue #2501499 by David_Rothstein: If an existing user is invited and is...

Status: Fixed » Closed (fixed)

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