diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-02-12 06:44:13 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-02-12 06:44:13 +0000 |
commit | 8bd39cd9813ac4c1253867191e132d903e7f158b (patch) | |
tree | 33101f0179f0c1391b7fd12354686507d1e4394c | |
parent | 3756cdd8c1a7ff2d14944fc4c4cb60346fa7f9e1 (diff) | |
download | brdo-8bd39cd9813ac4c1253867191e132d903e7f158b.tar.gz brdo-8bd39cd9813ac4c1253867191e132d903e7f158b.tar.bz2 |
#711592 by linclark and scor: Fixed rdf_preprocess_user_profile() uses currently logged in user.
-rw-r--r-- | modules/rdf/rdf.module | 2 | ||||
-rw-r--r-- | modules/rdf/rdf.test | 19 |
2 files changed, 12 insertions, 9 deletions
diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module index 00a99b0d4..ebe427724 100644 --- a/modules/rdf/rdf.module +++ b/modules/rdf/rdf.module @@ -476,7 +476,7 @@ function rdf_preprocess_user_profile(&$variables) { // Adds RDFa markup to the user profile page. Fields displayed in this page // will automatically describe the user. // @todo move to user.module - $account = user_load($variables['user']->uid); + $account = $variables['elements']['#account']; if (!empty($account->rdf_mapping['rdftype'])) { $variables['attributes_array']['typeof'] = $account->rdf_mapping['rdftype']; $variables['attributes_array']['about'] = url('user/' . $account->uid); diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test index 3140ae02c..1a41b96cf 100644 --- a/modules/rdf/rdf.test +++ b/modules/rdf/rdf.test @@ -291,19 +291,22 @@ class RdfMappingDefinitionTestCase extends DrupalWebTestCase { * Create a random user and ensure the default mapping for user is used. */ function testUserAttributesInMarkup() { - // Create a user with access to user profiles. - $user = $this->drupalCreateUser(array('access user profiles')); - $this->drupalLogin($user); + // Create two users, one with access to user profiles. + $user1 = $this->drupalCreateUser(array('access user profiles')); + $user2 = $this->drupalCreateUser(); + $this->drupalLogin($user1); // Browse to the user profile page. - $this->drupalGet('user/' . $user->uid); + $this->drupalGet('user/' . $user2->uid); // Ensure the default bundle mapping for user is used on the user profile // page. These attributes come from the user default bundle definition. - $profile_url = url('user/' . $user->uid); - $user_profile_about = $this->xpath("//div[@class='profile' and @typeof='sioc:User' and @about='$profile_url']"); - $this->assertTrue(!empty($user_profile_about), t('RDFa markup found on user profile page')); + $profile_url = url('user/' . $user2->uid); + $user2_profile_about = $this->xpath("//div[@class='profile' and @typeof='sioc:User' and @about='$profile_url']"); + $this->assertTrue(!empty($user2_profile_about), t('RDFa markup found on user profile page')); - // User creates node. + // User 2 creates node. + $this->drupalLogin($user2); $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1)); + $this->drupalLogin($user1); $this->drupalGet('node/' . $node->nid); // Ensures the default bundle mapping for user is used on the Authored By // information on the node. |