My NSID was continually blank after filling in my flickr username while editing my user.

Two things I noticed:

1) the "isset" checks on $account->flickr['nsid'] return TRUE if the field is ""; these checks chould be changed to "!empty" or "isset" should just be removed

2) currently $account->flickr['nsid'] is being set in the validate part of hook_user. This value is overwritten from the database by the time hook_user gets to insert/update. validate should just check the validity of the flickr username. Set the variable $nsid when doing the insert/update.

Patch attached.

CommentFileSizeAuthor
flickr-nsid-set.patch2.38 KBsamo

Comments

andrewlevine’s picture

Status: Active » Needs review

1. I've talked about something like this with drewish. Are there any implications of accessing an array key of an array that may not exist outside of an isset statement?
2. good catch.

andrewlevine’s picture

This value is overwritten from the database by the time hook_user gets to insert/update.

Can you explain when/why the value is overwritten? It works fine on my end. The reason the NSID is retrieved in validation is because we need to check it so if the user enters an invalid identifier, they are notified. The value is saved in hook_validate so we don't have to make the same API call twice.

If the value is somehow overwritten I would definitely like to fix the bug.

drewish’s picture

Status: Needs review » Fixed

whoops, didn't see this issue. i committed a similar fix for this last week.

Anonymous’s picture

Status: Fixed » Closed (fixed)