I've successfully created a node limit rule so that all authenticated users can only create one node of a certain type. However, I now want to override that limit for administrators (they should be able to create as many nodes of that type as they want). Note that by 'administrators' I mean the admin role created by Drupal, not User 1. I've tried creating a second rule that gives administrators a '-1' limit for that node type, but it isn't working...

How do I override a node limit for all users in the 'administrator' role?

Comments

duaelfr’s picture

Unfortunately, this is not currently possible.

The way to bypass this issue is to create a role thaht you assign to your non-admin users :
- manually if your users cannot sign in by themself
- automatically by a rule (or a dedicated module if you find one) if they can

Anonymous’s picture

Title: Override limit » Add ability to override limit per role
Version: 7.x-1.0-alpha5 » 7.x-1.x-dev
Component: Documentation » Code
Category: support » feature

Site builders shouldn't have to change the way they setup Drupal just to accommodate a module that doesn't do something it should; I'm therefore changing this to a feature request.

I can think of two ways to do this initially:

#1 - Create a new permission 'Override node limits'. Whichever roles have this permission can create any number of nodes as if Node Limit wasn't installed (works the same as User 1).

#2 - Add a new select list to the Node Limit edit form that allows you to select roles that are excluded from the limit (i.e. apply a limit to 'authenticated', but exclude from 'administrator'). It may also be a good idea to make the Role select lists allow multiple values...

Option #1 is easiest to setup but not as configurable as option #2. Thoughts?

duaelfr’s picture

Status: Active » Needs work

Yeah these are two great ideas.

#1 is not so hard to implement

#2 could be simply done by create a "negate" checkbox for each rule. It could not cover all use cases but it would always be better than today. The bility to choose multiple roles/content type/whatever is already in my todos.

In the future, the engine will be rewrited using Rules to become really powerfull but at this time I am too busy to manage this.
I add your suggestion in the todolist and I hope I will find a moment to improve this module before september :)

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new1.23 KB

Here's a patch that implements option #1.

I chose that because it was easier to do (and therefore quicker to get something working immediately), and also because you've already got plans to build a better system with Rules later on (so no point spending too much time on a temporary solution now).

duaelfr’s picture

Good !
I will review it on monday.
Thank you

Lalas’s picture

Please tell me how to override a users role's node creation limit for a user in that same role.

i will explain.

I have a user role "role1". And i have have three users user1, user2 and user3. The node creation limit for the role "role1" to create node of content type "type1" is set to 10. That means all these three users can create max 10 nodes of type1. I need to set the limit for the user1 as 15 so in effect user1 can create 15 nodes, user2 and user3 can create only 10 nodes.

Thank you

dougsap’s picture

Hi Lalas,

Can you describe your use case a little bit more (change the industry, etc. if you are uncomfortable sharing too much info). Describe who/what type of users they are (e.g., Trusted/Internal vs people placing advertisements, etc.).

I don't maintain this project, but I know enough about it that I know:

  • You want to avoid overly complex compound rules.
  • You sometimes need to look at the overall use case and potentially simplify what you are trying to do (to get an optimal solution).

I (or others) might have ideas when we hear more details.

Lalas’s picture

Hi dougsap

there are two types of roles associated with the website - site_admin and agents. my primary concern is to control the node creation limit for the agents. By default i gave permission to create 10 node for all the users of agent role. Consider the special case if a user of role agent request for permission to create more content of the restricted type (obviously after paying). Then site_admin (who has permission to administer nodelimit) gives that specific user more node creation quota - say 50 but the default permission for all the other users of role agent remains the same (in this case 10).

What i understood that the behavior of nodelimit module, limit of role dominates the limit of individual user .i.e if agent has three users say user1, user2 and user3. if the default nodelimit for the agent is 10 and if i change the limit for the user1 to 50 user1 can create only 10 nodes.

Please dont hesitate ask if you need more explanation.

Thank you.

Lalas’s picture

Hi all

I have noticed one more thing. we can create any user limit that is less than the default node limit of the role which contains the user.

I.e.

Agent(role) - Default node limit for a content type is 10;
User1 (of agent role) - limit 1 - 10 works. but we cant give user1 any limit greater that 10;

This is what i want to achive.

Please tell any of you have some leads

Thank you

dougsap’s picture

StatusFileSize
new91.72 KB

Hi Lajas,

The only way that I can think of this working for you is to:
1) Create a new role ~agent~.
2) Create node limits for each user user of the role ~agent~

Possible limitations

  • This may be unwieldy if there are a large number of agents.
  • If somebody forgets to create the node limit for the agent, they will be able to create an unlimited number of nodes.

The attached pdf should illustrate fairly clearly (though not exactly) the approach which would work.

Good luck! Dougsap

Lalas’s picture

Hi Doug

Thanks for reply. I achieved the functionality that way only. As you said there are some limitations to this approach. There is a lead to this solution here but i did not check it, i will update soon after testing it.

Lalas’s picture

My mistake that was mislead...

duaelfr’s picture

#4 has been pushed to dev.
Thank you BWPanda.

Still needs review.

dixon_’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Needs review » Patch (to be ported)

This needs backport. I need this, so I might do it

duaelfr’s picture

I did not really maintain the 6.x version so I hope you won't run into old unsolved issues.
If you need co-maintainership, just ask.

dixon_’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new955 bytes

Here's a very simple patch that implements the fix the same way that #4 does for the D7 branch.

  • DuaelFr committed d1b2709 on 8.x-1.x authored by BWPanda
    Issue #1665148 by BWPanda: add permission to allow roles to override...
jordanmagnuson’s picture

Issue summary: View changes
Status: Needs review » Needs work

Having a special role that just overrides everything strikes me as gimmicky, and also not very flexible (it doesn't allow specific rules to override specific other rules in a nuanced way).

I think it would be much better to simply allow sorting of the node limit rules (as you can currently do on the admin page), then give each one a corresponding weight, and apply them in descending order: when a rule matches for the current user, no further rules are applied. This would allow much more flexible overrides.

See screenshot: http://i.imgur.com/a2xvQIj.png

vaccinemedia’s picture

Is there any update on this issue? Is there a patch which allows limits to be applied by weight yet?

adriancid’s picture

Status: Needs work » Closed (won't fix)
jordanmagnuson’s picture

Is there a reason this was marked as "won't fix"?