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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

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.

jhodgdon’s picture

Issue tags: +Novice

Probably a good Novice project

mjonesdinero’s picture

Assigned: Unassigned » mjonesdinero
Status: Active » Needs review
FileSize
523 bytes

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

SumeetSingh’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to go

SumeetSingh’s picture

Status: Reviewed & tested by the community » Needs review

My mistake, wrong issue.

jhodgdon’s picture

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

SumeetSingh’s picture

Better description which follows formatting standards.

SumeetSingh’s picture

Status: Needs work » Needs review
FileSize
606 bytes

For test bot.

jhodgdon’s picture

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.

SumeetSingh’s picture

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

mjonesdinero’s picture

Status: Needs work » Needs review
FileSize
635 bytes

updated from what jhodgdon commented

sorry for the wrong format earlier

jhodgdon’s picture

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.

mjonesdinero’s picture

Status: Needs work » Needs review
FileSize
641 bytes

here it is, updated the patch

jhodgdon’s picture

Status: Needs review » Needs work

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

+ * @param $name
+ *   A string containing a name of the user
mjonesdinero’s picture

Status: Needs work » Needs review
FileSize
638 bytes

here it is...

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! I'll get this committed shortly.

jhodgdon’s picture

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. :)

mjonesdinero’s picture

Status: Patch (to be ported) » Needs review
FileSize
718 bytes

here is the patch for drupal 6

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

That looks correct for Drupal 6.x. Thanks!

star-szr’s picture

Issue tags: -Novice

Removing novice tag since this just needs a commit now.

jhodgdon’s picture

Assigned: mjonesdinero » Unassigned
Status: Reviewed & tested by the community » Fixed

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

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