How do you create a relationship to another user? It doesn't show up on Invite, and I can't find anywhere that I can add a user as whatever relationship I have.

CommentFileSizeAuthor
#28 user_relationship_invites.module.zip1.57 KBeerpini
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cutandpaste’s picture

Okay, well the most obvious first, are the permissions set up properly?

After that:
Have you set up relationship types? The module only allows administrators to create relationship types. So you'll need to create a type (or two) on the admin side that users can use to relate through.

sprsquish’s picture

that last reply was actually from me. I forgot that I was logged in as a different user.

Zahor’s picture

I have set up relationship types (3 of them), have allowed permissions for users to have relationships.

I noticed from one of the inc files, that one of the urls was supposed to be relationship/request - that just takes me to the front page.

sprsquish’s picture

That's because it needs a user ID after it (/relationship/request/{uid})

Okay, just to be clear, the following permissions need to be checked:
can have relationship
maintain relationships
view user relationships

maintain is the key.. it should probably read "can request relationships"

Zahor’s picture

That was the first thing I did - still never worked.

Zahor’s picture

Ok, never mind my last post, adding the uid works but what about the invitations?

Zahor’s picture

I would also like some guidance on submitting the form pro grammatically. I want to add a tab or a button on a user's profile that says "add as a _____" that would do the same as going to that page. I was reading in Pro Drupal Dev. that this can be done (and I have the fuction), but I'm not sure what variables I would use. Can you help in this regard?

sprsquish’s picture

The module was built to be more of an API focus. So check out the _api file for the functions to do what you're looking to do.

Namely user_relationships_request_relationship

Zahor’s picture

I'll try to figure it out (coding is not my thing so much). Any thing on this working on the invite form? My users may invite numerous users at a time (one guy has a list of about 2000 he will invite) so requesting to add each one individually will be a bit of a task.

Zahor’s picture

Any updates on the module working with invite as it should? Any solution on the horizon or should I try to get someone to do it? (Or can I offer a bounty or something? I really need the functionality - like last week)

sprsquish’s picture

I don't understand why it's not working properly for with the invite module.

There isn't currently a way to do add a massive amount of people at a time (that I know of). I don't have the time to put toward creating it. You're more than welcome to find someone to do it and I'll be happy to help them as much as I can.

abqaria’s picture

i cannot add relationships

i do have permission set as stated above

i do have a couple of relations set

but no link to add relations

about inviting massive numbers i do have some thoughts in this link

http://drupal.org/node/151134

abqaria’s picture

i cannot find the build relation link

sprsquish’s picture

are you using a custom theme and creating custom profile pages?

Zahor’s picture

The module now works for me. I had someone work on it. I think they may have edited the invite module also (not sure - I have to ask them), but now I can mass invite and specify the relationship the user will have to me. Once they log in, the relationship is created. If all the modifications were to this module, I'll send it.

Do you think we can get some views support? I'd like to have more control over the way my existing relationships are displayed - the table view is not very appealing.

Either that or display the list of relations better?

sprsquish’s picture

Great to hear it. Would you have them upload the patch? I'd like to see what changes were made to the UR module.

There's a task in the issue queue to create view support. I'm slammed with another project so it may be a little slow to come.

I worked really hard to make the module as customizable as possible. Take a look in the _theme.inc file, nearly everything having to do with displaying relationship info.

abqaria’s picture

where should the link appear ?

i am using the theme newspaper

i am using usernode module for the profiles

abqaria’s picture

it worked after upgrading to the latest version

but how to make a link on the user page ?

hopefully zahor can help us

thanks alot

gwen’s picture

@abqaria

The link to add relationships is on the drupal user profile page (/user/$uid). Unless you've done some customizations, your users probably still go through that page to edit their usernames, email address, settings, etc. There currently is no out of the box add relationship link shown on the usernode page, but for now, you can add it yourself using module hooks and/or theming. For example, you could do something like:

function yourmodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'view':
      switch ($node->type) {
        case 'usernode':
          $node->relationship_link = l('add relationship', 'relationship/request/' . $node->uid, NULL, drupal_get_destination());
          break;
      }
      break;
  }
}

Then in yourtheme_node() (or node.tpl.php), you'd do something like:

function yourtheme_node($node, $teaser = FALSE, $page = FALSE) {
  ...
  if (isset($node->relationship_link)) {
    $output .= $node->relationship_link;
  }
  return $output;
}

There's no logic in the above code to check if the user is already your friend or not, tho, so you'd have to do some custom code to make that happen. If you're interested, you can peek at the code in user_relationships_hooks.inc. Look for the "view" section of user_relationships_user().

@sprsquish

Lots of folks seem to be using usernode nowadays, so we might consider adding this as a future feature to user relationships. I think we can probably do something like implement hook_nodeapi() and add some info to the README telling folks how they can add the link to their theme.

Zahor’s picture

abqaria, my solution is less than ideal.

I have a custom function that allows me to display a link on the user's profile (outputted with contemplate). The function creates and thus allows the url "relationship/request_add/rtid/.$node->uid" to be displayed on a user's profile. Clicking on the link takes you to confirmation page telling you, you are about to add that user as a ________. So it bypasses the relationship request page(where you have to select from the list). I had to add if statements to only display links based on certain roles (since roles determine what type of relationships you can have). I guess I could also go a step further and check to see if a user relationships exist already but this will be a chunk of code in the content template - which when I think of it, could just be added to the module but I don't know if I necessarily have the time to do that myself (that is something I can probably figure out) or the money to pay someone to do it(which I did do to get other functionality working).

But I'll see what time I have (I am really busy atm, as I'm trying to finish projects I've had for a while).

gwen’s picture

Title: create relationship » user relationship invite module doesn't automatically add inviter as relationship

We were able to reproduce the failing invite functionality also and found that it's b/c we forgot to submit a patch to the invite module. I submitted a feature request asking them to incorporate our patch, but until they do, you'll need to apply the patch yourself. The issue is at http://drupal.org/node/178652.

This thread seems to have changed and become more about the usernode module. To keep the issues separate, I created a new issue http://drupal.org/node/178654. Please comment there about usernode and keep this for invite. When the invite patch gets accepted, I'll mark this issue fixed.

gwen’s picture

I just tested this out and found it to be failing again, even after the patch. Some investigation showed that there may be dependencies based on version of the invite module. We should explore and put the correct dependencies into the documentation.

prfctns6@gmail.com’s picture

Component: User interface » Code
Assigned: Unassigned » prfctns6@gmail.com
Status: Active » Fixed

The primary problem was that the code that loaded the invite from the user_relationship_invites table was only doing the query if the invite code was numeric. However, invite codes are hex without the leading '0x', so the invite code frequently doesn't pass the isnumeric() test.

While I was in there, I noticed a couple of other housekeeping issues not specifically related to this failure, but that need fixed.

I've committed a patch that fixes all the above issues. Let me know if you still have problems.

gwen’s picture

Status: Fixed » Active

I'm changing the status of this back to active since the invite module hasn't accepted our patch quite yet.

prfctns6@gmail.com’s picture

Assigned: prfctns6@gmail.com » Unassigned
gwen’s picture

Status: Active » Fixed

Invite module accepted our module on 10/14. I updated the README to warn folks that they'll need to use a recent verision of invite or apply the patch themselves.

Anonymous’s picture

Status: Fixed » Closed (fixed)
eerpini’s picture

I was using the user_relationship_invites module for creating user relationships among users when an invitation was sent . The invitation form contained a form for selecting a relationship with the invitee . But when the new user tried to register , the relationship with the inviter would vanish after the registration has been done . This issue has already been discussed at this place
http://drupal.org/node/175518. .
A patch had been implemented in the invite module, and so the module should be working properly , but it does not . the problem comes here , in the file user_relationship_invites.module, the following code :

if (($code = arg(2)) && ($invite = user_relationship_invites_get_invite($code))) {
      $inviter           =& $invite->inviter;
      $relationship_type =& $invite->relationship_type;

in this part of the code $code = arg(2) does not hold true .arg(2) is the invite code sent to the new user in the invitation email . It is a session variable , and the above methode does not usually work : so i had to make the following changes :

if ($invite  = uri_load_from_session()) {
      $inviter           =& $invite->inviter;
      $relationship_type =& $invite->relationship_type;

and added the following function to user_relationship_invites.module :

function uri_load_from_session(){
	  if (isset($_SESSION[INVITE_SESSION_NAME])) {
        return user_relationship_invites_get_invite($_SESSION[INVITE_SESSION_NAME]);
  }
  return FALSE;
}

the file user_relationship_invites.module with the above changes has been attached to this node and can be downloaded .

farald’s picture

Status: Closed (fixed) » Active

Reason: #28

farald’s picture

Oh, sorry didnt realize the tread was that old!

farald’s picture

Status: Active » Closed (fixed)
andrenoronha’s picture

Version: 5.x-1.x-dev » 6.x-1.0-rc2

I'm using ur invite module which comes with UR module. version 6.x-1.0-rc2
I set up invite module and user relationship invite module... but i can't see the check box or whatever to check to be a friend of the person i'm inviting at the url /invite.

what can be wrong?

alex.k’s picture

Version: 6.x-1.0-rc2 » 5.x-1.x-dev

If there's just one type of relationship set up, then you won't see any UI elements on the invite form. Relationship will be created automatically.

Also, please do not move issues between 5.x and 6.x. Open a new one if there is a bug, and perhaps reference the 5.x one from it. Thanks.

andrenoronha’s picture

Sorry sorry

I dont know if I missed something...but I have created another relationship type and then deleted it... now it's working

thanks