2

We're building a site which will have certain content pages accessible only to logged in Drupal users.

I'd like users to be able to create their own Drupal accounts with access to those pages, but only those who have been pre-approved, who exist as contacts in CiviCRM, and are part of a 'web site users' group.

What's the best way to do this?

2
  • Do you anticipate folk creating an account in response to something you might send them, or does it just need to be 'any time'?
    – petednz - fuzion
    Feb 15, 2019 at 19:11
  • We might send e-mails that contain a sign up link when people are added to the users group in CiviCRM, but it also needs to work any time. If someone tries to create a Drupal account, I want them validated against the Civi group. If they're in it, they should be allowed to proceed and create an account. If they're not, they should get a rejection message. Feb 19, 2019 at 10:16

3 Answers 3

1

A couple of thoughts.

If you want this to be a response to an action - eg you folk send out a mailing - then you can do this via a webform - send out a link with checksum to a webform and upon submitting the webform you can trigger Drupal Rules (we usually do this by giving them a civicrm Tag) and this can also instantly log them in

If you want to do this as a self-service then I would probably be adding a wee form for folk to say 'send me a login link', they enter their email, it sends them a checksum and then you do the above approach of another webform.

3
  • This could work, but the 'send me a login link' form would then need to verify against the web site users group. How would I do that? Feb 19, 2019 at 10:30
  • can you pls expand/clarify the above statement with some examples. are you aware of CiviCRM Group Roles sync (if you are referring to the Drupal Roles needing to be determined based on Civi Group membership)
    – petednz - fuzion
    Feb 19, 2019 at 18:52
  • Well, exactly the same as in the original question, really, as all this does is move the required point of authentication from when the user creates an account, to when the user requests a login link. So, if a user submits the web form asking for a login link, it shouldn't send them one unless they exist as a contact in Civi, and are a part of the 'web site users' group. I don't know about Group Roles sync. I have Access Control ticked on my Civi web site users group, but not sure how to properly use it. Feb 20, 2019 at 18:12
1

I operate a similar system.

Thing to do is either A) create the contacts in Drupal manually or B) write a code thing (scheduled task / hook etc) which, upon them being approved in some way (e.g. added to the Group) creates an account in Drupal and mails them the details.

1
  • The 'a code thing' could be the Drupal rule referred to in my answer which can all be done in the UI
    – petednz - fuzion
    Feb 17, 2019 at 20:46
0

I wrote a plugin for Joomla that does this - it integrates into the Joomla account registration process and requires new accounts to match a CiviCRM record. Probably wouldn't be hard to create a Drupal version using the same approach.

2
  • This sounds like what wanted, but this is my first project with both Drupal and CiviCRM, so I'm really looking for something I could do without having to write code myself. Feb 19, 2019 at 10:33
  • Ok, not sure you can do it without writing any code, but Pete's approach gets close. Or you could ask someone to write the code for you.
    – Aidan
    Feb 19, 2019 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.