Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I am new in Drupal and PHP and I have a question.
with this code (when he is placed in the visibility settings) blocks are only shown to people hwo have a relationship to a user.
global $user;
$profile_uid = arg(1);
if (in_array('administrator', $user->roles))
{
return TRUE;
} else {
return user_relationships_load(array('between' => array($user->uid, $profile_uid), 'approved' => 1), array('count' => TRUE));
}
But what have I to change when I want to show the Block to a specific relation (for example "buddy")
I hope anyone can help me?
Best regards
Frank
Comments
Comment #1
mrf CreditAttribution: mrf commentedThat should do it for you the new important piece is rtid => array, you'll need to make sure you include the id of your buddy relationship there. Easy way to find that is going into the relationships admin and editing the relationship, the ID will be in the url path.
Comment #2
fraweg CreditAttribution: fraweg commentedThanks a lot!!!
Best regards
Frank