Closed (won't fix)
Project:
User Relationships
Version:
6.x-1.0-rc1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Aug 2009 at 09:27 UTC
Updated:
21 Sep 2011 at 17:15 UTC
Found this issue http://drupal.org/node/289140 and then had a go at making it work for 6.X. I have it working and can make a module for all to test however there's one problem. When I request a relationship with a user the profile fields suddenly appear so it's not handling pending relationships. I've gotten further than I thought with this and it's almost there, hope someone can finish it off because I don't think I can do it.
function relationship_false($this_user, $that_user) {
$params = array('between' => array($this_user->uid, $that_user->uid));
$options = array('!pending_requests' => NULL, 'approved' => 1);
module_load_include('inc', 'user_relationships_api', 'user_relationships_api.api');
module_load_include('module', 'user_relationships_api', 'user_relationships_api');
return user_relationships_load($params, $options, TRUE);
}
function profile_view_profile(&$user) {
profile_load_profile($user);
// Show private fields to administrators and people viewing their own account.
if (user_access('administer users') || $GLOBALS['user']->uid == $user->uid) {
$result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d ORDER BY category, weight', PROFILE_HIDDEN);
}
else if (relationship_false($GLOBALS['user'], $user)) {
$result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d AND visibility != %d ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN);
}
else {
$result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d AND visibility != %d AND visibility != %d ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN, PROFILE_RELATIONSHIP);
}
'!pending_requests' => NULL I made that up, also tried 'pending' => 0 but am stabbing in the dark. This is what needs resolved though. BTW with this I intend to create an address book system i.e. load profile fields into address with those I have a relationship with.
Comments
Comment #1
OnlineWD™ commentedIs simply matter of adding 'approved' => 1 to parameter array. I will try and make a module for this now ..
Comment #2
OnlineWD™ commentedTrying to make module but cannot get this function to alter the state of the form after submitting it.
It alters the form but form remains unchanged after posting. If I edit profile.admin.inc directly using this code the form is altered after post.
Comment #3
mrf commentedGoing to close this out. Profile fields are now a much different beast for D7 and I'm only doing bug fixes for 6.x.