Between 6.x and 7.x, the handy function user_external_login vanished without a trace (of documentation as to what your module should do if it needs to call that).

The only similar function I can find in 7.x is user_external_login_register() which seems to try to either login a user or create a new one. I don't have a good feeling calling a method like that, when I know for sure I do not want to create a new account.

But the real problem with user_external_login_register is that it completely ignores it's second parameter ($module). It's looks like a function which in 6.x took an authname and module now takes a plain old username and another dummy parameter. In other words, there's nothing external about it any more, since it neither reads nor writes to the authmap table.

What the heck happened here?

Comments

jhodgdon’s picture

Status: Active » Closed (duplicate)

http://api.drupal.org/api/function/user_external_login_register/7 does not actually ignore $module. It's used in this line:
user_set_authmaps($account, array("authname_$module" => $name));
and it looks like that is probably where it writes to the authmap table?

There is another issue on user_external_login() vanishing (and that vanishing not being documented):
#497612: Harden user login - move user_load() to submit handler
so please continue that discussion there...

So is there anything else here that remains to be cleared up, beyond "what do I do without user_external_login()", which is covered on that other issue? I don't think so, so I'll go ahead and mark this as a duplicate. If you think otherwise, please explain what else needs to be fixed/documented and set the status back to "active".

Dave Cohen’s picture

Status: Needs work » Closed (duplicate)

nevermind, see #3

Dave Cohen’s picture

Status: Closed (duplicate) » Needs work

Well, there should at least be some documentation about the API change. If I'm not totally confused still....

In D6. this function took an authname from the authmap table.

In D7, this function takes a name from the user table.

And it is overloaded in this awkward way... that it either logs a user in or registers a new user... it will only put a name in the authmap table if a user does not already have that username. It's just weird and still broken IMHO. You get what I mean? The $name parameter is first used to check the user table, then later maybe written to the authmap table.

jhodgdon’s picture

Please discuss the doc needed on the other issue, which has already been reopened to request that the change be documented.