1

Is there a good way to map multiple backend users to a single frontend user?

Basically I want to do the following, we host a blog which is maintained by multiple persons, each as it's own credentials, but to the outside world they act as a single individual. So I need a way to have user1, user2 and user3 as log, but I want them to be a single user (virtually) on the frontend (like MrXY for example), thus leading to a single link to a profile page, a single email address that fetches from gravatar and a single name, without the need to hack the database each time for that.

I am aware that I could user an extra account just for the comments, with shared credentials, but I do not want to to this, I still need a way to keep them appart, so that I can tell if someone does a bad job or a good job.

And before I forget, we use bbpress as well, and allow users to register themselves. So mapping all accounts is no solution. It has to be editor-admin all map to one specified account.

1 Answer 1

2

Attach a custom user meta field to all of them - for e.g. a checkbox. Then, in your template, simply query the user meta field and if it is checked, just output the shared user name instead of the user profile field you would use for other users.

If you want to make sure that users can not attach themselves to that "group", you will have to wrap the addition of that profile field with

if ( current_user_can( 'manage_options' ) ) { ... }

to restrict it to "top" users like those which have the administrator role assigned.

1
  • 1
    Thanks. I basically used your idea. And afterwards added filters for link, name and avatar afterwards simply opening the same functions again using the default userid. And disallowing the default user to be mapped. Commented Jul 3, 2014 at 17:57

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.