0

I have come up with a peculiar problem. IO am using the User Relationships module for my Drupal 7 site. The issue is that i had given privileges to the anonymous user to view user profile. The anonymous user however cannot be a part of the user relationship but that user had clicked on that action and now somehow or other when i log in as an authenticated user and see the view which i have created to show me the users who are following me, i see i am followed(the name of the relationship) by an Anonymous user. How can i remove this. i also checked in the databases but i saw nothing regarding this...no request with user id 0. i also have all the correct permissions.

Any Suggestions

Regards

enter image description here

0

I ran into a very similar issue... Here's the code I used (modified to reflect the affected $user->uid as 0):

<?php
$anon_uid = 0;
$admin_uid = 1;
// The next line makes it appear as though the relationship was deleted by the original
// user in the relationship. You might want to change the value though since Anonymous
// should normally be denied access to do this. For example, to make it appear as
// though each of Anonymous's relationship was deleted by user 1, change $anon_uid 
// to $admin_uid (next line ONLY) 
$anon_deletedby = user_load(array('uid' => $anon_uid));
$anon_friends = user_relationships_load(array("user" => $anon_uid));
foreach ($anon_friends as $friend) {
  user_relationships_delete_relationship($friend, $anon_deletedby);
}
?>

PLEASE BE SURE TO BACK UP YOUR DATABASE AND TEST THIS IN A NON-PRODUCTION ENVIRONMENT FIRST.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.