0

I'm working on a project where different people can register.

1) Only certain domains can register. I've used the User restrictions module for this purpose.

2) Admins can create files/resources and assign them to different people. To accomplish this, I installed Profile2 module and created an entity reference field in my custom content type where admins can decide which profile types can view this resource.

My problem is now I'm trying to come up with a rule that when somebody registers, based on the domain name of their email address, I'd like to associate them to different profile types.

Is that possible?

4
  • How did you implement those "files/resources" that admins can create? Are they like nodes (the resources), for which there is a field that can be used to "attach" files? If not can you explain what your implementation of them is instead? Feb 28 '16 at 18:49
  • The "resource" is a content type, and the file is a field defined in that content type.
    – farjam
    Feb 28 '16 at 21:01
  • OK, thanks for clarifying. About your "assign them to different people": is that a single "user", or something like a "group of people"? And that entity reference, where exactly does this reference to? Is that a specific user or something else? Feb 28 '16 at 21:12
  • Right now I'm assigning it single users (I use a user entity reference and multiple users can be selected too). But I'm looking for way to assign people under different companies and reference the companies instead of individual users (because every company can have multiple employees signing up on the website). I'm thinking I'll probably create different roles for each company and reference the role when creating the resource content. Then, when somebody logs in, I'll just display any content that's associated with his role.
    – farjam
    Feb 29 '16 at 0:08
0

Below is a potential solution for your "... based on the domain name of their email address, I'd like to associate them to different profile types ...").

You might want to try using the Conditional Rules module: use an "if condition" (contained in the Rules Action), and the Rules Action "... to associate them to different profile types ..." would only be executed if the "if condition" would be true. For a sample using the Conditional Rules module (for which there is not a lot of docu available), refer to my answer to the question "How to prevent a node being saved when using the Rules module?".

Instead of using Conditional (if/else) logic within the Rules Action, you can also use Switch logic.

Be aware: this module only has a beta release for D7, though it's used in over 8K sites (which makes it seem like a pretty robust module though).

3
  • Thanks for the suggestion. Do you think in general profile2 is the right module for this purpose. My main goal is to just for admins being able to upload new files and be able to assign them to one or more companies (that can contain multiple people) so they can see those files when they log in.
    – farjam
    Feb 28 '16 at 18:37
  • Let me think a bit on how to best improve my answer (I'll do so soon). As per your comment here, it makes me think that you're not "insisting" in using Profile2 for this. But instead that your question is more like "how can I implement a workflow that supports your main goal (as in your comment to my answer here). If my thinking is correct (can you confirm or correct via another comment?) then I'd want to enhance my answer with an alternative that doesn't involve Profile2 at all (you can still use that module, but it wouldn't be needed for this "wrorkflow". What do you think? Feb 28 '16 at 18:45
  • That's correct. I just chose profile2 as one approach, I don't have to use it.
    – farjam
    Feb 28 '16 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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