Problem/Motivation
The hook_user_role_*() docs in user.api.php are not consistent with other documentation like hook_node_insert(). @Dave Reid pointed out in #1119158-6: user_role_save() doesn't implement a presave hook that these usually start with "Act on…".
Proposed resolution
Update the docblocks of these hooks.
Remaining tasks
Task | Novice task? | Contributor instructions | Complete? |
---|---|---|---|
Create a patch | Yes | Instructions | No |
User interface changes
n/a
API changes
n/a
Original report by @skwashd
Some of the language in user.api.inc is a little clunky and not consistent with others parts of core. This was raised during the review of #1119158: user_role_save() doesn't implement a presave hook.
An example of this is the docs for the hook_user_role_*() functions.
/**
* Inform other modules that a user role has been added.
*
...
Comments
Comment #1
star-szrUpdating the issue summary, after some digging this looks like a good novice documentation issue because the changes proposed are not massive.
Comment #2
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedComment #3
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedDid changes in
user.api.php
documentation to make it more consistent like other core functions.Comment #4
star-szrThanks for taking this on @er.pushpinderrana :)
I don't think this is true for presave, at least not if you compare to hook_node_presave(). I don't think any transaction would be in progress at this point.
"updated" doesn't apply to insert operations.
Looks at more of the examples in node.api.php "Respond to" also looks like an acceptable substitution for "Act on" if you wish.
It might be helpful to review #629518: hook_node_insert() and other node hooks have imprecise/misleading descriptions.
Comment #5
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedIncorporated your suggested changes in this patch. If something missing please suggest.
Comment #6
star-szrLooks good to me, certainly an improvement. Thanks!
Comment #7
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedRe-rolled #5 patch for D7 too. Please review once.
Comment #8
star-szrThat's great but we need to get the 8.x patch in first and then backport once the status is "Patch (to be ported)" :)
https://www.drupal.org/contributor-tasks/backport
This should be removed from the D7 patch.
Comment #9
er.pushpinderrana CreditAttribution: er.pushpinderrana commented@Cottser, thankyou for guiding me.
I would surely removed these extra line code from D7 patch and tested manually, once the thread status come to "Patch (to be ported)".
Comment #11
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedRerolled patch #7 for D7 and removed unused lines from this patch.
Comment #13
er.pushpinderrana CreditAttribution: er.pushpinderrana commented@Cottser, please suggest on this how to deal with this situation because D8 patch is still under review and D7 patch is going for automate testing. Not sure, how to avoid/remove D7 patch until D8 patch get fixed.
Comment #14
star-szrSure :) This will not get committed to 7.x until it's committed to 8.x. It will not be committed to 8.x unless it is RTBC. So I suggest hiding the 7.x patches and waiting. You can hide patches from the issue summary using the files fieldset below the comment form.
Committers, #5 is the D8 patch here.
Comment #15
alexpottCommitted 310065c and pushed to 8.x. Thanks!
Comment #17
star-szrBack to D7 for backport :)
Comment #18
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedHere is patch for D7. Please review.
Comment #19
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedComment #20
star-szrMissed the version dropdown, patch looks good! Thanks @er.pushpinderrana.
Comment #25
David_Rothstein CreditAttribution: David_Rothstein commentedTestbot failure.
Comment #28
star-szrComment #31
dcam CreditAttribution: dcam commentedComment #34
dcam CreditAttribution: dcam commentedComment #37
dcam CreditAttribution: dcam commentedComment #39
David_Rothstein CreditAttribution: David_Rothstein commentedCommitted to 7.x - thanks!