2

I am trying to create a social website that each member can create two different profiles with two different usernames, one public and one private. The member should be able to toggle between profiles the same way you do with facebook when you toggle between your main profile and a different page you own. The member is able to post new nodes as his/her private username or public username by simple toggling between the two. I have been researching many modules such as profile2 and subuser. The problem with subuser is that you can switch between your main account and the subuser easily but you can't switch between your subuser and the main user except if you logout first. Also, with the subuser, you are required to add another email address for each subuser. It would better if there is only one email address access to both accounts. What is the best solution?

  • Any body is able to answer this question? – yogi Moh Mar 3 '16 at 5:10
  • Due to drupal architecture it's not possible by default, but sure you have to do some coding tricks in order to achieve you goal – Mohammed Gomma Mar 3 '16 at 8:34
1

Due to drupal architecture you should go with a custom solution that create a second account for the user when he register by adding a global known prefix for unique fields that would be used when switching the user account.

Say user registered with mail someuser@somedomain.com you will make another account using that mail someuser.{global_key}@somedomain.com having {global_key} set in code you will use it for logging the user when he needs to switch accounts.

Scenario:

  • user registered
  • in custom module implement hook_user_register() and create another account for the user by using the {global_key}
  • if user needs to switch account do login by adding the prefix {global_key} to username (you could add to password or let password be the same) let switch account be a hook_menu implementation reading the

global $user object and create a new account using {global_key}

-user forget password send the reset password link with a query parameter identifies the account will be reset by implementing hook_mail_alter

Hope that helps!

  • Sounds good but I will have to consult my coder since I am not one – yogi Moh Mar 9 '16 at 10:55
1
+50

Not having a contributed module providing such feature you are asking here, I believe that the best solution is to design a custom module.

You want to register with a single email address, and post as more users (alias). So, at the very basic, you will have:

  • A new content type user_alias, referenced to the user entity, protected by the Node Access module
  • a field named Post as in the main content type entity (in your FB-like scenario, Page), referenced to the user_alias content type
  • node hooks handling for rendering the submitted by, replace username with the Past as as user_alias

Hope will help.

  • 1
    If you can convince me that the user can toggle between his account and his page and post as his page (!? sounds already absurd) I'll remove my downvote, maybe even grant you the bounty. Read the requirement in the question: "The member should be able to toggle between profiles the same way you do with facebook when you toggle between your main profile and a different page you own." – Елин Й. Mar 9 '16 at 6:44
  • 1
    Thanks for your availability to discuss, Елин. User can toggle between his account and his page and post as his page with a field named 'Post as' in the main content type entity (in your FB-like scenario, Page), referenced to the user_alias content type. – augusto Mar 9 '16 at 8:21
  • 1
    @augusto, if this work we will be facing another problem with views and rules to make this site work as a social website. So I will have to replace the other user entity with post as entity and I will have to provide the same functionality that the user entity has to the post as entity. If I want the "post as" entity to subscribe to an organic group, which is needed, it will not work. I believe we should have this functionality as a module by now since google+ and fb are doing it, obviously there is a need for it. – yogi Moh Mar 9 '16 at 10:51
  • 1
    @ЕлинЙ., my answer in based on your actual question. Since knowing the whole scenario would help quite a lot, please consider updating your question with everthing is involved, clearly describing your use cases. – augusto Mar 9 '16 at 11:02
  • 1
    It isn't my question. @yogiMoh has asked it. I find the requirement quite interesting, that's why I've set a bounty. His last comment tells more about my considerations, that a content type cannot replace an account. All efforts in this direction would only be workarounds, not solutions. If I wanted to switch between multiple accounts, I would expect to switch accounts, not fool other modules that a content type would be the author of my posts. – Елин Й. Mar 9 '16 at 15:18
0

Have you looked into the masquerade module? We use it for cases that a user needs to use multiple accounts. It lets you assign other user accounts a specific user.

  • 1
    Can I use it for all users where each user is able to switch back and forth with another specific user? For example: 1) user 1 and user2 only, 2) user 3 and user4 only, user 5 and user only, etc. – yogi Moh Mar 3 '16 at 23:22
  • It could extended to provide that functionality. – Chad Payne Mar 4 '16 at 21:21
  • @ChadPayne what about the one e-mail part? – No Sssweat Mar 6 '16 at 2:53
  • How to extend it? With what other modules? I can forget about the one email requirement. – yogi Moh Mar 6 '16 at 5:04

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.