Hi,

Thank you for this wonderful module. I seem to have a slight problem. When I click 'Add to my Network', the popup works fine and able to add the user.

But when clicking on 'Remove from my Network', the popup appears, but does not load fully. It stays stuck. So basically cannot remove the user.

The following on my content profile tpl.

<?php if (count(array_intersect($user_roles, $approved_roles)) > 0) { ?>
<div><?php
if ($node->uid != $user->uid) {
 if ($relationships = user_relationships_load(array('between' => array($user->uid, $node->uid)))) { print "<a href=\"$uid/relationships/1/remove\" class=\"user_relationships_popup_link\">" . t('Remove from my Network') . "\n"; }
else { print ("<a href=\"" . $GLOBALS['base_url'] . "/relationship/$node->uid/request/1\" class=\"user_relationships_popup_link\">" . t('Add to my Network') . "\n"); } }
?></div>

In error report says 'page not found'.

Any help would be most appreciated.

Lilian

Comments

63reasons-AS’s picture

Try the following if it work, Not sure

if (count(array_intersect($user_roles, $approved_roles)) > 0) {
<div>

if ($node->uid != $user->uid) {
if ($relationships = user_relationships_load(array('between' => array($user->uid, $node->uid)))) { print "<a href=\"user/1/relationships/$uid/remove\" class=\"user_relationships_popup_link\">" . t('Remove from my Network') . "\n"; }
else { print ("<a href=\"" . $GLOBALS['base_url'] . "/relationship/$node->uid/request/1\" class=\"user_relationships_popup_link\">" . t('Add to my Network') . "\n"); } }

</div>

liliplanet’s picture

Thank you 63reasons. I tried the above, and still the same, does not load.

In my error reports I realize that it adds a url alias, in this case member/user/1/relationships/$uid/remove, so when I add the full website url (http://www.mysite.com/user/1/relationships/$uid/remove), it works.

Wonder why it's adding a url alias, but all good now, it works, and thank you so much!

dummas_324324_32’s picture

hi,

how can I create a link to remove a user from my friendslist..

/user/MY-ID/relationships/FRIENDS-ID/remove

does not work... under relationships it creats a url like /user/MY-ID/relationships/RELATIONSHIP-ID/remove

but how can I get the relationship-id??

any idea?

dummas_324324_32’s picture

push..

any idea?

alex.k’s picture

Try the following:
if (count(array_intersect($user_roles, $approved_roles)) > 0) {

if ($node->uid != $user->uid) {
  if ($relationships = user_relationships_load(array('between' => array($user->uid, $node->uid), 'rtid' => 1, 'approved' => 1), array('sort' => 'rid'))) {
    foreach ($relationships as $rid => $rel) {
      print l(
        t('Remove'),
        "user/{$uid}/relationships/{$rid}/remove",
        array(
          'title' => array('title' => t('Remove from my Network')),
          'query' => drupal_get_destination(),
          'attributes' => array('class' => 'user_relationships_popup_link'),
        )
      );
      print "\n";
    }
  }
  else { 
    print l(
      t('Add to my Network'),
      "relationship/{$node->uid}/request/1",
      array(
        'query' => drupal_get_destination(),
        'html'  => TRUE,
        'attributes' => array('class' => 'user_relationships_popup_link'),
      )
    );
  }
}

This was adapted from functions theme_user_relationships_remove_link and theme_user_relationships_request_relationship_direct_link in user_relationships_ui.theme.inc

mrf’s picture

Status: Active » Fixed

Going to assume this question has been answered. If you were involved in this issue and need additional guidance feel free to set to active or re-open, if not the best way to get help is to open a new support request.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.