Is the wordpress user-model changed in wpmu?

I’m running wpmu on heroku using a postgres extension. It works great, but I have a plugin that needs to get the userId based on the e-mail-adress. This is how it does it:

$sql = 'SELECT id FROM ' . $wpdb->users . ' WHERE user_email='' . addslashes($from) . "' LIMIT 1;";
$user_ID = $wpdb->get_var($sql);

$wpdb->get_var($sql) returns nothing. I’m trying to figure out why.

Related posts

1 comment

  1. The plugin should use the API, not some made-up SQL. addslashes() is not safe enough anyway.

    $user = get_user_by( 'email', 'user@example.com' );
    echo $user->ID;
    

    Besides that, the user tables are almost the same, there are just some tighter restrictions for user names in multi-site, because new sub domains could be made from the names.

Comments are closed.