sending requester details when creating user relationships .
when someone asks to relate to you on a drupal site with user_relationships enabled , it creates a really weird situation if u do not know the person who is requesting the relationship(requester) , to counter this , we can add a small tweak.
We can add a textarea form element to the page where the user is asked to confirm the relationship, the user requesting the relationship can be asked to fill in their details so that the requestee can recognise them . Once this is done the form element is submitted along with the entire form and processed , the requester details are entered into a separate table which are later retrieved for display on the "pending relationships" page for the requestee . The form elements can look like below :
now we need to create a table to store the details here is the query for that :
after this we have to process the submitted form and insert the values in to the table as follows :
if($result_details){
drupal_set_message("Details registered");
}
else{
drupal_set_message("Error occured during processing details");
}
now after we have done this , while we are displaying the pending relationships for the requestee we have display the above as Requester details, which can be done by editing user_relationships_theme.inc and adding the following code :
if($relationship->requester_id == $user->uid)
{
$rows[] = array(t("<b><br> My Details: </b><br>".$mentee_details."<br><br>"));
}
else
{
$rows[] = array(t("<b><br> Requestee Details: </b><br>".$mentee_details."<br><br>"));
}
there is one "twist" in this , here in the above code , i have used a check
if($relationship->requester_id == $user->uid)
this is required because if the requester himself is seeing his pending relationships then he will see the details he entered as My details and not Requestee Details.
These tweaks have been applied to MentorCorner , the site is still under development, but u can see these features in action when u try to associate with anyone from the "mentor pool " or the "mentor gallery".
Have fun :-).
- Article Type:
- Drupal Version:
- Tag Base:
- Login to post comments
