2

I'm a little stuck with the registration flow on my site. What I have is a multi-user environment, where each user can, but does not have to, create a secondary/Profile2 "shop" profile.

Now I don't want to just expose the Profile2 shop type to everyone. So I've set up a shopkeeper role, and would like to somehow allow users to request or opt into the role. This isn't for security or anything. It just doesn't look professional having the menu link available to users who don't want or need the profile. Also, some newbie is bound to get curious and enter random crap, which will later mess with the display of their content.

My solution was to use a flag on the user page, which triggers a rule to promote the user, but the problem is; there's no Flag option to prevent users from being able to flag other user's accounts. Unless I use a page template to hide the flag link, but that's a perhaps a little too hacky, and as far as I understand, doesn't actually disable the link.

All I really want is some sort of link or checkbox somewhere(preferably on the user-page) saying, "I have a shop, lemme create a profile". So if anyone has a suggestion for my issue, it would be greatly appreciated!

Cheers,

Matt

0

Here's a fairly straightforward way to do it.

  1. Create a field (boolean) on the user account manage fields page. Assign it useful label such as "I want to run a store" etc.
  2. Create a rule to add the role as follows:

Event After saving user account AND After updating an existing user account

Conditions Data comparison (user account field value) == yes AND User has role (store) NOT

Actions Add user role (store)

And create another rule to remove the role:

Event After updating an existing user account

Conditions Data comparison (user account field value) account-unchanged == yes AND data comparison (user account field value) account == yes

Actions Remove user role (store)

This should let the users check the box and then the role will automatically be toggled on or off.

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.