Index: openid_provider_persona.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider_persona/openid_provider_persona.install,v retrieving revision 1.3.2.2 diff -u -p -r1.3.2.2 openid_provider_persona.install --- openid_provider_persona.install 31 Mar 2009 01:53:22 -0000 1.3.2.2 +++ openid_provider_persona.install 21 Apr 2009 12:57:50 -0000 @@ -1,5 +1,5 @@ $value) { - if (isset($value['sreg']) && $value['sreg'] == $name) { - // If we find one that matches we can then get the information from the persona - // Which the user has for this realm. If no persona it will fallback to the default persona - $field_value = db_result(db_query("SELECT field_value FROM {openid_provider_persona_values} WHERE persona_id = '%d' AND uid = '%d' AND type_uri = '%s'", $persona_id, $user->uid, $key)); - if ($field_value) { - $response[$name] = $field_value; - } - break; + // Go through all of the fields that we have defined in the schema and determine + // Which field key supports the simple registration that was requested by the RP + foreach (openid_provider_ax_schema_definitions() as $key => $value) { + if (isset($value['sreg']) && $value['sreg'] == $name) { + // If we find one that matches we can then get the information from the persona + // Which the user has for this realm. If no persona it will fallback to the default persona + $field_value = db_result(db_query("SELECT field_value FROM {openid_provider_persona_values} WHERE persona_id = '%d' AND uid = '%d' AND type_uri = '%s'", $persona_id, $user->uid, $key)); + if ($field_value) { + $response[$name] = $field_value; } + break; } } } @@ -172,7 +165,7 @@ function openid_provider_persona_process * @param $alias * Alias that the Relying Party is using for attribute exchange namespace */ -function openid_provider_persona_openid_provider_ax($op = 'load', $attributes = array(), $request = array(), $alias = NULL) { +function openid_provider_persona_openid_provider_ax($op = 'load', $attributes = array(), $request = array()) { global $user; $response = array(); @@ -197,33 +190,16 @@ function openid_provider_persona_openid_ $key = str_replace(".count.", ".type.", $key); } if (!preg_match("/\.type\./", $key)) { continue; }; - // Calling module hooks that can give us the value from somewhere else and if it does - // Not return anything then we will go to the users persona and get the information there - if ($values = module_invoke_all('openid_provider_ax', $realm, $attributes[$key])) { + // Parse through and if count is set we need to count through the values + $result = db_query("SELECT * FROM {openid_provider_persona_values} WHERE persona_id = '%d' AND uid = '%d' AND type_uri = '%s'", $persona_id, $user->uid, $attributes[$key]); + while ($row = db_fetch_object($result)) { + if ($counter > $count) { break; }; + $counter++; if ($count) { - foreach ($values as $k => $v) { - if ($count > $counter) { break; } - $counter++; - $response[str_replace(".type.", ".value.", $key) .".". $counter] = $v['value']; - } + $response[str_replace(".type.", ".value.", $key) .".". $counter] = $row->field_value; } else { - $v = array_shift($values); - $response[str_replace(".type.", ".value.", $key)] = $v['value']; - } - } - else { - // Parse through and if count is set we need to count through the values - $result = db_query("SELECT * FROM {openid_provider_persona_values} WHERE persona_id = '%d' AND uid = '%d' AND type_uri = '%s'", $persona_id, $user->uid, $attributes[$key]); - while ($row = db_fetch_object($result)) { - if ($counter > $count) { break; }; - $counter++; - if ($count) { - $response[str_replace(".type.", ".value.", $key) .".". $counter] = $row->field_value; - } - else { - $response[str_replace(".type.", ".value.", $key)] = $row->field_value; - } + $response[str_replace(".type.", ".value.", $key)] = $row->field_value; } } // Tell the response how many of the attribute we are returning Index: openid_provider_persona.pages.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/openid_provider_persona/openid_provider_persona.pages.inc,v retrieving revision 1.2.2.3 diff -u -p -r1.2.2.3 openid_provider_persona.pages.inc --- openid_provider_persona.pages.inc 9 Apr 2009 15:35:38 -0000 1.2.2.3 +++ openid_provider_persona.pages.inc 21 Apr 2009 12:57:50 -0000 @@ -1,5 +1,5 @@