Download & Extend

user_is_blocked returns True for listed and blocked, else false

Project:Drupal core
Version:6.x-dev
Component:documentation
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed (fixed)
Issue tags:needs backport to D6, needs backport to D7

Issue Summary

API page: http://api.drupal.org/api/drupal/modules%21user%21user.module/function/u...

> Checks for usernames blocked by user administration.
> Return value
>
> boolean TRUE for blocked users, FALSE for active.

Should be:
boolean TRUE for blocked users, FALSE for active or name not found.

Comments

#1

Version:6.x-dev» 8.x-dev
Issue tags:+needs backport to D6, +needs backport to D7

Thanks for reporting this! Actually, it doesn't look like user_is_blocked() returns a Boolean value at all, in most cases. It returns a stdClass object if the query succeeds, and FALSE (at least in MySQL) if the query fails. This is incorrectly documented in Drupal 7 and 8 also.

By the way, please read the tagging guidelines (below the Tags field when reporting/commenting on an issue), and please don't make up your own tags.

#2

Issue tags:+Novice

Probably a good Novice project

#3

Assigned to:Anonymous» mjonesdinero
Status:active» needs review

attached is patch that changes the documentation for the API of user_blocked

AttachmentSizeStatusTest resultOperations
user_is_blocked-1552400-3.patch523 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 37,028 pass(es).View details

#4

Status:needs review» reviewed & tested by the community

Looks good to go

#5

Status:reviewed & tested by the community» needs review

My mistake, wrong issue.

#6

Status:needs review» needs work

See comment #1 above - this documentation is not accurate.

Also, it doesn't follow our documentation formatting standards:
http://drupal.org/node/1354#functions

#7

Better description which follows formatting standards.

AttachmentSizeStatusTest resultOperations
user_is_blocked-1552400-7.patch606 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 37,012 pass(es).View details

#8

Status:needs work» needs review

For test bot.

AttachmentSizeStatusTest resultOperations
user_is_blocked-1552400-7.patch606 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 37,007 pass(es).View details

#9

Status:needs review» needs work

SumeetSingh: Thanks for the patch... A few thoughts:

a) mjonesdinero had assigned the issue to himself, and it had only been a few hours since I reviewed his patch. It would be a bit more polite in the future to ask first "Are you still working on this?" and wait for a few days, before taking over an issue that someone is already working on. Thanks!

b) The formatting in this patch is not correct. Indentation is 2 spaces extra in @param/@return. It looks like you used tabs.

c) In documentation text, we don't normally say "stdClass", and we like to use complete sentences. So instead of this for the @return:

stdClass with the name field of a blocked user, FALSE for active user.

it should probably say:
Object with property 'name' (the user name), if the user is blocked; FALSE if the user is not blocked.

#10

My apologies did not realize, will keep that in mind for future reference.

#11

Status:needs work» needs review

updated from what jhodgdon commented

sorry for the wrong format earlier

AttachmentSizeStatusTest resultOperations
user_is_blocked-1552400-11.patch635 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 37,022 pass(es).View details

#12

Status:needs review» needs work

Thanks! One more fix though: Documentation needs to be wrapped into 80-character lines. See
http://drupal.org/node/1354#general
So that @return documentation needs wrapping.

#13

Status:needs work» needs review

here it is, updated the patch

AttachmentSizeStatusTest resultOperations
user_is_blocked-1552400-13.patch641 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 37,024 pass(es).View details

#14

Status:needs review» needs work

Almost there... @param and @return descriptions should end with ".":

+ * @param $name
+ *   A string containing a name of the user

#15

Status:needs work» needs review

here it is...

AttachmentSizeStatusTest resultOperations
user_is_blocked-1552400-15.patch638 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 36,974 pass(es).View details

#16

Status:needs review» reviewed & tested by the community

Thanks! I'll get this committed shortly.

#17

Version:8.x-dev» 6.x-dev
Status:reviewed & tested by the community» patch (to be ported)

I committed the above patch to 8.x and 7.x. Time to backport to 6.x. :)

#18

Status:patch (to be ported)» needs review

here is the patch for drupal 6

AttachmentSizeStatusTest resultOperations
user_is_blocked-1552400-18-vesrsion6.patch718 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 190 pass(es).View details

#19

Status:needs review» reviewed & tested by the community

That looks correct for Drupal 6.x. Thanks!

#20

Issue tags:-Novice

Removing novice tag since this just needs a commit now.

#21

Assigned to:mjonesdinero» Anonymous
Status:reviewed & tested by the community» fixed

Thanks again! Finally got this committed to 6.x.

#22

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here