This code in context_extras/context_condition_author/context_condition_author.inc assumes that if an entry is numeric, it is a uid. This could cause unexpected outcomes if there are usernames that are numeric.

  /**
   * Convert the list of users to be all UIDs.
   */
  function convert_to_uids($users) {
    global $user;
    $user_ids = array();
    $usernames = array();
    foreach ($users as $user_id) {
    if (is_numeric($user_id)) {
        $user_ids[] = $user_id;
      }
      if ($user_id == '<current_user>') {
        $user_ids[] = $user->uid;
        continue;
      } 
      // The rest will be user names
      $usernames[] = $user_id;
    } 
      
    if (!empty($usernames)) {
      $result = db_query("SELECT uid FROM {users} WHERE name IN (" . implode(', ', array_fill(0, count($usernames), "'%s'")) . ")", $usernames);
      while ($row = db_fetch_object($result)) {
        $user_ids[] = $result->uid;
      }
    }
    return $user_ids;
  }

I am writing a patch to fix this, will post soon.

Comments

dooug’s picture

Status: Active » Needs review
StatusFileSize
new1.9 KB

I realized that this context's condition value should not accept both UIDs and Usernames, because there is no logical way to determine if 123 refers to a Username or UID if both were to exist.

Instead I recommend that the condition only allow Usernames and the <current_user> token so that it can still function without the inconsistency mentioned above. I have attached a patch that needs testing.