Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've use this module in a Drupal 7 project although it's a development release. When I set a node limit on a specific role the total of nodes for all users of that role together seems to be limited. For example if I have user1 and user2 with a node limit of 5 and user1 creates 4 nodes user2 can only create 1 more.
Is this expected behavior or is it something that should be fixed on of the upcoming releases? If it can be fixed and one of the maintainers can point me in the good direction I might be able to solve this issue and share my code.
Comment | File | Size | Author |
---|---|---|---|
#22 | MultipleUserOfRoleIssueAlpha04.jpg | 243.33 KB | dougsap |
#20 | MultipleUserOfRoleIssue.jpg | 312.16 KB | dougsap |
Comments
Comment #1
ricovandevin CreditAttribution: ricovandevin commentedI have made some changes to node_limit_role.module and for now this is working how I'd expect it to work. I changed the function
node_limit_role_node_limit_sql()
to this:Can someone please let me know whether I changed expected behavior by this? In that case additional functionality would should be added to the module.
Comment #2
DuaelFrHi Rico,
This was the expected behavior. The one you need is planned for a future release. If you want to provide a sub module I will be pleased to integrate it.
Regards
Comment #3
NathanM CreditAttribution: NathanM commentedSubscribing, as this is exactly what I need.
Comment #4
Sinan Erdem CreditAttribution: Sinan Erdem commentedHow can I achieve the same for content type instead of role?
Comment #5
DuaelFrI do not understand your need etcetera9, could you be more precise ?
Comment #6
Sinan Erdem CreditAttribution: Sinan Erdem commentedOf course.
I want to limit the number of contents per user for a specific content type.
For example; I want each user to create only 1 from Article content.
Comment #7
DuaelFrYou just have to use node_limit_type submodule to do that.
This issue is about limiting each user of a given role instead of all users of this role.
Comment #8
Sinan Erdem CreditAttribution: Sinan Erdem commentedNode limit type puts a limit for all users combined. For example if you set up a limit of 5, the number of content in the system cannot exceet 5. I want to give each user a right to create 5 contents of that type...
Comment #9
DuaelFrOh ! I missed this point ;)
With this patch you could do what you want. You can use more than one node_limit submodule at a time.
In your case you may combine node_limit_type and node_limit_role (modified as seen above)
Comment #10
Sinan Erdem CreditAttribution: Sinan Erdem commentedHehe thanks. I will try it...
Comment #11
grasmash CreditAttribution: grasmash commentedThat's also the functionality that I was expecting. Has this been implemented in dev?
Comment #12
DuaelFrNot yet sorry :/
Comment #13
jdrichmond CreditAttribution: jdrichmond commentedThis isn't a pretty solution, but it worked for me. I used "blog" as the node type here. Feel free to use your own node type.
Comment #14
DuaelFrA new submodule has been pushed to dev branch
http://drupalcode.org/project/node_limit.git/commit/dc3c193
Comment #15
dougsap CreditAttribution: dougsap commentedSuccessfully tested the new module node_limit_userofrole.
The Coder module gave 12 minor warnings - mostly:
Thanks.
Comment #16
DuaelFrThank you for your review.
I just pushed a new commit correcting coding standards.
Comment #17
dougsap CreditAttribution: dougsap commentedThe Coder module now reports no warnings for 'Node Limit User of Role'.
However, the functionality has changed. With various settings, but specifically for Limit=1, Content Type Specified, Users of Role = Authenticated, errors:
Notice: Undefined index: node_limit_role in node_limit_userofrole_node_limit_applies_in_context() (line 16 of/home/foo/sites/all/modules/node_limit/node_limit_userofrole/node_limit_userofrole.module).
Notice: Undefined index: node_limit_role in node_limit_userofrole_node_limit_applies_in_context() (line 17 of/home/foo/sites/all/modules/node_limit/node_limit_userofrole/node_limit_userofrole.module).
Notice: Undefined index: node_limit_role in node_limit_userofrole_node_limit_applies_in_context() (line 18 of/home/foo/sites/all/modules/node_limit/node_limit_userofrole/node_limit_userofrole.module).
It SEEMs to work, at least with some use cases, if I replace index 'node_limit_role' with 'node_limit_userofrole' in lines 16 through 19. Thanks!
Comment #18
dougsap CreditAttribution: dougsap commentedChanging status from 'Needs Review' to 'Needs Work'. My mistake.
Comment #19
DuaelFrOh dear ! This was a copy&paste mistake.
I just pushed a patch on git. http://drupalcode.org/project/node_limit.git/commit/8a09341
Comment #20
dougsap CreditAttribution: dougsap commentedThe 'Node Limit User of Role' module works great when used to restrict node creation by either Authenticated OR Anonymous users.
If separate restrictions (using different limits) are defined for both Authenticated OR Anonymous users, users of both roles will be limited to creating the same number of nodes (of the specified Content Type). See the attached image for a detailed example.
This is not something which I am personally concerned about. It probably is not a frequent use case. I am not sure if there are any easy workarounds. I am only highlighting it for evaluation.
I am very happy with the 'Node Limit User of Role' functionality provided in in 7.x-1.0-alpha3. It seems to be complete and stable enough that this particular issue could be closed.
Thanks again Edouard!
Comment #21
DuaelFrAlpha4 contains some improvements to avoid some limits to apply when they would not.
Comment #22
dougsap CreditAttribution: dougsap commentedBehavior on the compound 'Users of Role' issue (#20 above) is the same in Alpha04 as Alpha03. Thanks.
Comment #23
dougsap CreditAttribution: dougsap commentedI just realized that I should have changed status to 'needs work' with my previous post. Thanks!
Comment #24
chefnelone CreditAttribution: chefnelone commentedI'm in the same situation @finlet in #1, the function posted in #2 is working for me. Is this commited to dev?
Comment #25
DuaelFrYou might use node_limit_userofrole submodule chefnelone but be aware of what doug said in #22 if you need to restrict authenticated and anonymous users.
Comment #26
chefnelone CreditAttribution: chefnelone commentedthanks I'll take a look a the submodule.