Skip Navigation

[Gelöst] How can I add a user account to a custom role in Access?

This support ticket is created vor 7 Jahre, 6 Monate. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+02:00)

This topic contains 9 Antworten, has 4 Stimmen.

Last updated by Juan vor 7 Jahre, 3 Monate.

Assisted by: Juan.

Author
Artikel
#446984

Hello

I can create a custom user role in Access, but I can't find any solution to add a specific user account to a role.

I can view already existing user accounts attached to the user role, but I can't add a user to a role manually, it looks as if I have to do it in code, and that can't be right.?

As a side question: Is it possible to have a custom post field, where you can select between the site user roles?

----

The reason I ask is because I use SkyVerge membership so customers can purchase membership access (not really that easy to do with access yet) and I use DW Question Answer for a discussion forum.

DW QA controls access by user group. So when a User purchases a membership, I have to manually add the user profile to a user.

I have a PHP script which does it but I am missing some hooks in skyverge membership, and I usually end up having to adding the user profile to the user manually.

I use another plugin (user role editor) to be able to manually add the user role to the users.
But I hope to be able to ditch that plugin if Access is able to add the custom user roles to a user.

And I will be able to create a custom post field, attached to a skyverge membership custom post type, and finally create the scripts I need to automate everything. Right now the user role is hardcoded in my scripts, I would prefer to be able to add the field to the membership CPT, so I can change it without having to change code.

#447130

It seems you figured out how to create Custom Roles in Access.

Now, you head to Dashboard > Users and add a New user.
When you do this, you will be able to pick the New user Role in the User Profile Section "Role"

The same way you can also EDIT a new user or an existing user.
hidden link

Custom Post Fields are not related to User Fields.
So you can not have a Field with a Selectable Option of User Roles unless you create a Select Field in Toolset > Post Fields and populate it manually with the Roles as options.
https://toolset.com/documentation/user-guides/using-custom-fields/

#447345

Hi Beda

You can assign multiple user roles to a user, but not through the standard wordpress interface (editing a user account)

So if you use Access to control user roles / permissions (in advanced mode) then you can't apply these custom roles as an extra role to a user if you do not use another plugin, like any of these.

hidden link

or this one (which I use)

hidden link

But since you can create a role and the capabilities in the Access plugin, it seems silly that you need to have an extra plugin to be able to attach these custom roles to a user account.

#447346

It's not standard in WordPress to use multiple Roles per User, and we do not support that.

What I can do, is let a DEV chime in here, to see if it would be accepted to add this as a Feature Request.

But for now, you can not add many Roles to one user with Access.

Is that what you would like Access to feature?
Add multiple User Roles to a Single User?

#447398

Please talk to a developer.

Multiple roles per user have been supported since wordpress 2.0, but there are no admin settings which makes it possible to add extra roles unless you install a third party plugin or writes the code your self

WP_User->add_role, adds an extra role to a user.

This is why I think it should be possible to control this in Access, when it is supported in wordpress but have no interface to control it.

And it is just silly that you need custom code / extra plugins, when you can manipulate custom user roles and capabilities in Access.

#447402

I will let a Developer answer here.

#447515

Juan
Supporter

Timezone: Europe/Madrid (GMT+02:00)

Hi Henrik

Thanks for the feedback.

As Beda was explaining, we do nto support multiple roles per user on Access. This is theoretically doable, of course, and I checked the Access code and this should be indeed doable, but at the moment we only work with one role per user. From a recent update, Access works with capabilities instead of the old, deprecated user levels, so in theory it would be easier now, since we just check and modify them, and they all are collected for us properly depending on each user roles, so WordPress itself would do all the heavy lifting.

In addition, we do not have any method for adding a role, custom or native, to a user. I understand that you are using third party plugins and that you would like to be able to do this all with just Access, but again we do not have such a GUI, and it would need some time to plan and implement something like that.

The only thing that I can do here is to file both ideas as feature requests. I will also discuss with the Access plugin mantainer in or team, so he can better estimate whether this would take a lot of time or not. In any case, I can not promise that this is eve going to be started for the current dveelopment cycle at all.

Hope it helps.

Regards.

#447780

Let me bring some input into your discussions then.

A user role specifies which responsibilities a user have within the organization.
In a small organization, it is not uncommon that a single performs multiple roles.

The access granted to a given user is the union of the capabilities applied to each user role.

Wordpress standard, does not have a gui to assign multiple roles to a user, but since this is common in other systems besides WordPress, and since this is actually how the security system seams to be designed, I would suggest that a permission plugin like Access would support this, even though WordPress still lacks a GUI to do the same.

I do not believe that WordPress will implement a gui soon. After all it has been over 10 years and we still have no option to upload a user avatar manually, even though this is also best practices in so many other systems and something a user would expect to be possible.

So please log this as a feature request. Until then I will uninstall Access (again) since I want to keep my plugin usage to a minimum, and I need this option.

#471844

Just checking in on an update- has this been prioritized for feature inclusion?

I'm new to layouts/views and am absolutely floored at what I can accomplished. Like, in software love.

That said, this is a massive product gap for access, and a regular requirement of sophisticated membership sites.

Many (most) membership plugins support multiple membership levels- Memberpress will even add multiple roles (wordpress roles... via addin) based on purchasing a membership. I was looking to integrate this feature with access roles in order to avoid layout issues (below).

I've tried using layouts with membership plugins and have seen some issues: every cell within the layout initiates a page view. This means that if you have blocked content on a page that has 4 cells, you get 4 error messages instead of 1. And if you're calling a view directly - each piece of content within the view is called (meaning that if you have a repeating list of 20 items, you'd get 20 more error messages).

I can get around this with a lot of shortcodes (e.g. check for membership level in each cell, and use shortcodes to call the view instead of adding the view directly... this initiates the page view first), but that is adding unnecessary overhead and feels "wrong".

Any advice/recommendations on how to handle these types of scenarios?

-multiple membership levels, with ability to upgrade multiple types of membership on a single account (memberpress does this)
-protect content based on membership level

#472082

Juan
Supporter

Timezone: Europe/Madrid (GMT+02:00)

Hi John

Thanks for the feedback.

Although this ticket is closed, and we should not star a discussion here, I will add a short answer at least.

We have a ticket about implementing multiple roles support for Acces. It contains a subtask about creating a GUi for setting multipel roles per user, but we still have to deal with some impompatibilities (for example, we set error messages per role: what should happen if a user has two roles without proper rights to perform an action and two different error messages to show? Which role error message should be used?). In short, this is still in its early stages.

Secondly, about the problems with Layouts and multiple error messages, I recommend that you open a specific ticket about it, and our support team will evaluate and eventually raise this to developers, which then should manage that as a compatibility or usability issue.

Hope it helps.

Regards.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.