Best way to add sub users

Hi. I'm looking a way to build a rather borderline user case. A user must need to have multiple personas, each with a profile and posting and messaging capabilities. The main user should receive all the notifications of his personas and must be able to post as a persona and message personas. The whole thing is intended to a roleplay community, where a user have many characters.

Well, I want some directions about the right wayto do this before starting.

As the user is a Elgg Entity I can create a new entity to store the persona and assign permissions like a user. As the entity will have the author uuid stored I can make them relate and search for the informations.

But I can also set the permission to users to create another users and annotate these users as characters and use this annotations instead of the entity author to make them relate.

So, question 1:

What approach is better, and exactly why?

I will need to make some little changes in some places.

To add a drop down selector in forms to chose the associated character, I think elgg_extend_view() is all I need, but to store the associated character in posts and comments, the best way is a annotation or a relationship? Also, to route notifications and messages I have some questions.

If I create another entity the notifications work out of box, because they are targeted to users, but How to make the characters able to receive messages and send these messages to the user's messagebox? Is think I will need to override a registered action in Messages core plugin, send or process, maybe booth, but this is safe? There is no plugin hook I can use?

If I use annotated users instead of a new entity the message is solved, I only need to make a custom view to load messages from all related sub users, maybe I can achieve this using elgg_extend_view(), but I'm clueless for notifications, as they are relationships, not objects.

So, question 2:

How to redirect notifications and messages?

Thanks for any help.

  • Your post is a bit too wide. Try splitting it into more specific topics.

    Some answers however:

    To add a drop down selector in forms to chose the associated character, I think elgg_extend_view() is all I need

    Yes, but additionally you also need to override permissions if you want to actually post as another account.

    to store the associated character in posts and comments, the best way is a annotation or a relationship? 

    Won't the user not become the actual owner ($content->owner_guid)?

    I'm not completely sure if you want to have:

    • Separate Elgg user accounts that user can switch between (each has an own entry in elgg_users_entity table)
    • Only one user, but somehow "fake" it as multiple different users

    In the first case you might want something similar as the bundled login_as plugin.

  • Thanks for  the answers. The way to transfer content ownership i very handy.

    What I want is a end user behaviour. If achieved as separate accounts or only one is a questions of what is the best approach. Main main challenge is that I don't want the user to need to manually switch between characters to view notifications or his characters, so login_as was not a solution for me.

    I'm not sure of what technical approach because each one have one upside and one downside. Using many users give me a problem with notifications, using only one user give me a problem with messages.

    But yeah, is a very broad topic. I will try to split things up.

  • I would probably make the characters real user accounts they get logged into. That way all the Elgg built-in functionality Just Works and your problem is reduced to synchronizing some settings (not too hard) and allowing switching between accounts (easy).

    This is especially true if these characters need to have independent group memberships, friendships, etc.

    The other way (1 user account), I think you would mark each content item with metadata indicating the character, and so you'd alter the user views to somehow sniff for the character that created that content. It doesn't seem too hard on the surface but I can imagine many more hacks that way. Drawing the activity stream would require looking up something elsewhere to tell you what character to draw. Ew.

  • ...I'd also suggest on registration they get a non-character "master" account, so all character accounts are treated identically and point to the master account via relationship.

    Obvious downside of this is that you now have user data and associations spread across several accounts. Still that seems much better than rewriting tons of plugins.

  • With character user accounts you will have to figure out how to show aggregated notifications/unread counts from all the characters, and have a logical place to switch the user between characters before they, e.g., reply to a message.

    How important is that a character's real identity not be leaked? Is the character mostly a hat being worn when posting some content?

    Do characters need distinct usernames, friendships, group memberships, etc?

  • I agree with Steves assessment, that's the route I'd go.  If you need to differentiate the behavior of the character accounts I'd probably create a subtype of user, owned by the master account, then a 'login_as' type functionality that allows you to simply switch between accounts at the push of a button.

  • Sorry for the absence, I get aught in some day to day chores.

    @Steve, I think a relationship between users is a god solution if t comes to use a user object for the characters. Finding the solution that needs the minimum amount of rewriting in a strong reason of this discussion.

    The secrecy of the main user is not a concern. In small communities these things are already known.

    And yes, the characters need distinct usernames, friendships and group memberships.

    I will study the roles plugin, maybe it's have the most of what I need to deal with players and character user. The login_as solution would be the easiest way to implement but offers the worst usability in my opinion. I will read again the notifications plugin that I not really understand to find a way to deal with notifications.

    Thanks again.

     

  • I'm not sure how it would be the worst usability, it would be just as simple as switching google accounts.  I doubt roles will help you in any significant way.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking