1

In my social networking site, i have provided for users to be able to forge relationships between themselves using the User relationship module. This is working fine. I am creating a tab using quicktab to display the user their relations when he or she clicks on them. I assign my tab the block value : My Relationships: All relationships (user_relationship_blocks:my-all) which is already available in DRUPAL. However it does not show the picture of the user with whom the relationship is. I thought of using views but in views all relationship are showed. What i need is something like this:

Followers

User A (A's Picture) User B (B's Picture)

Following

User C (C's Picture) User D (D's Picture)

If this can be done using views or any other way, please advice...thanks

Edit/Update:

I tried using the default block provided: My Relationships: All relationships (user_relationships_blocks:my-all) This is under structure/blocks...I just enable it and display it...Its showing:

enter image description here Now i just need that the user picture also appears besides their name...Please advice/help...DO i have to do some changes in this block, if so, then just get me on starting line, i will carry it forward :) Thanks

  • 1
    I tried using views but am unable to get the result i want...would appreciate any help – why Feb 13 '13 at 7:50
  • this seems to be a simple thing to do but i am not getting it...would appreciate any help – why Feb 14 '13 at 9:57
1

$view = new view(); $view->name = 'user_freinds'; $view->description = 'Shows someone\'s related users'; $view->tag = ''; $view->base_table = 'user_relationships'; $view->human_name = 'User freinds'; $view->core = 0; $view->api_version = '3.0'; $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */ $handler = $view->new_display('default', 'Defaults', 'default'); $handler->display->display_options['use_more_always'] = FALSE; $handler->display->display_options['access']['type'] = 'none'; $handler->display->display_options['cache']['type'] = 'none'; $handler->display->display_options['query']['type'] = 'views_query'; $handler->display->display_options['exposed_form']['type'] = 'basic'; $handler->display->display_options['pager']['type'] = 'mini'; $handler->display->display_options['pager']['options']['items_per_page'] = '10'; $handler->display->display_options['pager']['options']['offset'] = '0'; $handler->display->display_options['pager']['options']['id'] = '0'; $handler->display->display_options['style_plugin'] = 'grid'; $handler->display->display_options['style_options']['grouping'] = ''; $handler->display->display_options['style_options']['columns'] = '5'; $handler->display->display_options['row_plugin'] = 'fields'; $handler->display->display_options['row_options']['inline'] = array( 'name_1' => 'name_1', ); $handler->display->display_options['row_options']['separator'] = ', '; /* No results behavior: Global: Text area */ $handler->display->display_options['empty']['area']['id'] = 'area'; $handler->display->display_options['empty']['area']['table'] = 'views'; $handler->display->display_options['empty']['area']['field'] = 'area'; $handler->display->display_options['empty']['area']['empty'] = TRUE; $handler->display->display_options['empty']['area']['content'] = 'لا يوجد محتوى'; $handler->display->display_options['empty']['area']['format'] = 'plain_text'; /* Relationship: User relationships: Requestee user */ $handler->display->display_options['relationships']['requestee_id']['id'] = 'requestee_id'; $handler->display->display_options['relationships']['requestee_id']['table'] = 'user_relationships'; $handler->display->display_options['relationships']['requestee_id']['field'] = 'requestee_id'; /* Relationship: User relationships: Requester user */ $handler->display->display_options['relationships']['requester_id']['id'] = 'requester_id'; $handler->display->display_options['relationships']['requester_id']['table'] = 'user_relationships'; $handler->display->display_options['relationships']['requester_id']['field'] = 'requester_id'; /* Relationship: User relationships: RTID */ $handler->display->display_options['relationships']['rtid']['id'] = 'rtid'; $handler->display->display_options['relationships']['rtid']['table'] = 'user_relationships'; $handler->display->display_options['relationships']['rtid']['field'] = 'rtid'; /* Field: User relationship types: Plural name */ $handler->display->display_options['fields']['plural_name']['id'] = 'plural_name'; $handler->display->display_options['fields']['plural_name']['table'] = 'user_relationship_types'; $handler->display->display_options['fields']['plural_name']['field'] = 'plural_name'; $handler->display->display_options['fields']['plural_name']['relationship'] = 'rtid'; $handler->display->display_options['fields']['plural_name']['label'] = ''; $handler->display->display_options['fields']['plural_name']['exclude'] = TRUE; /* Field: User: Picture */ $handler->display->display_options['fields']['picture']['id'] = 'picture'; $handler->display->display_options['fields']['picture']['table'] = 'users'; $handler->display->display_options['fields']['picture']['field'] = 'picture'; $handler->display->display_options['fields']['picture']['relationship'] = 'requestee_id'; $handler->display->display_options['fields']['picture']['label'] = ''; $handler->display->display_options['fields']['picture']['element_label_colon'] = FALSE; /* Field: User: Name */ $handler->display->display_options['fields']['name']['id'] = 'name'; $handler->display->display_options['fields']['name']['table'] = 'users'; $handler->display->display_options['fields']['name']['field'] = 'name'; $handler->display->display_options['fields']['name']['relationship'] = 'requestee_id'; $handler->display->display_options['fields']['name']['label'] = ''; /* Sort criterion: User relationship types: Plural name */ $handler->display->display_options['sorts']['plural_name']['id'] = 'plural_name'; $handler->display->display_options['sorts']['plural_name']['table'] = 'user_relationship_types'; $handler->display->display_options['sorts']['plural_name']['field'] = 'plural_name'; $handler->display->display_options['sorts']['plural_name']['relationship'] = 'rtid'; /* Contextual filter: User relationships: Requester user */ $handler->display->display_options['arguments']['requester_id']['id'] = 'requester_id'; $handler->display->display_options['arguments']['requester_id']['table'] = 'user_relationships'; $handler->display->display_options['arguments']['requester_id']['field'] = 'requester_id'; $handler->display->display_options['arguments']['requester_id']['default_action'] = 'default'; $handler->display->display_options['arguments']['requester_id']['exception']['title_enable'] = TRUE; $handler->display->display_options['arguments']['requester_id']['default_argument_type'] = 'user'; $handler->display->display_options['arguments']['requester_id']['default_argument_options']['user'] = FALSE; $handler->display->display_options['arguments']['requester_id']['summary']['format'] = 'default_summary'; $handler->display->display_options['arguments']['requester_id']['specify_validation'] = TRUE; $handler->display->display_options['arguments']['requester_id']['validate']['type'] = 'numeric'; $handler->display->display_options['filter_groups']['groups'] = array( 1 => 'AND', 2 => 'AND', ); /* Filter criterion: User relationships: Relationship status */ $handler->display->display_options['filters']['approved']['id'] = 'approved'; $handler->display->display_options['filters']['approved']['table'] = 'user_relationships'; $handler->display->display_options['filters']['approved']['field'] = 'approved'; $handler->display->display_options['filters']['approved']['value'] = '1'; $handler->display->display_options['filters']['approved']['group'] = 1; $handler->display->display_options['filters']['approved']['expose']['operator'] = FALSE;

/* Display: Block by type */ $handler = $view->new_display('block', 'Block by type', 'block_1'); $handler->display->display_options['defaults']['use_ajax'] = FALSE; $handler->display->display_options['use_ajax'] = TRUE; $handler->display->display_options['defaults']['hide_admin_links'] = FALSE; $handler->display->display_options['block_description'] = 'Display user\'s relationships grouped by relationship type';

/* Display: Block by user */ $handler = $view->new_display('block', 'Block by user', 'block_2'); $handler->display->display_options['defaults']['title'] = FALSE; $handler->display->display_options['title'] = 'Related users'; $handler->display->display_options['defaults']['hide_admin_links'] = FALSE; $handler->display->display_options['defaults']['style_plugin'] = FALSE; $handler->display->display_options['style_plugin'] = 'list'; $handler->display->display_options['style_options']['grouping'] = 'name'; $handler->display->display_options['defaults']['style_options'] = FALSE; $handler->display->display_options['defaults']['row_plugin'] = FALSE; $handler->display->display_options['row_plugin'] = 'fields'; $handler->display->display_options['defaults']['row_options'] = FALSE; $handler->display->display_options['defaults']['fields'] = FALSE; /* Field: User relationship types: Plural name */ $handler->display->display_options['fields']['plural_name']['id'] = 'plural_name'; $handler->display->display_options['fields']['plural_name']['table'] = 'user_relationship_types'; $handler->display->display_options['fields']['plural_name']['field'] = 'plural_name'; $handler->display->display_options['fields']['plural_name']['relationship'] = 'rtid'; $handler->display->display_options['fields']['plural_name']['label'] = ''; $handler->display->display_options['fields']['plural_name']['exclude'] = TRUE; /* Field: User: Name */ $handler->display->display_options['fields']['name']['id'] = 'name'; $handler->display->display_options['fields']['name']['table'] = 'users'; $handler->display->display_options['fields']['name']['field'] = 'name'; $handler->display->display_options['fields']['name']['relationship'] = 'requestee_id'; $handler->display->display_options['fields']['name']['label'] = ''; $handler->display->display_options['fields']['name']['exclude'] = TRUE; /* Field: Broken/missing handler */ $handler->display->display_options['fields']['updated_at']['id'] = 'updated_at'; $handler->display->display_options['fields']['updated_at']['table'] = 'user_relationships'; $handler->display->display_options['fields']['updated_at']['field'] = 'updated_at'; $handler->display->display_options['fields']['updated_at']['label'] = 'Added'; $handler->display->display_options['fields']['updated_at']['exclude'] = TRUE; /* Field: User relationship types: Name */ $handler->display->display_options['fields']['name_1']['id'] = 'name_1'; $handler->display->display_options['fields']['name_1']['table'] = 'user_relationship_types'; $handler->display->display_options['fields']['name_1']['field'] = 'name'; $handler->display->display_options['fields']['name_1']['relationship'] = 'rtid'; $handler->display->display_options['fields']['name_1']['label'] = ''; $handler->display->display_options['block_description'] = 'Display user\'s relationships grouped by user';

|improve this answer|||||
  • here is the export for the view – Mohammed Gomma Feb 19 '13 at 11:43
0

Download and enable the module UR-Views

then you will see a view called user-friends with two blocks

1-block by type 2-block by user

select the first and so you could make your own content-panes or blocks for further needs

|improve this answer|||||
  • UR-Views comes along with the User Relationship module in Drupal7. I have already installed that but i do not see any views such as user-friends – why Feb 14 '13 at 8:47
  • I have the module with drupal 7 and enabled 5 modules 1-UR-blocks 2-UR-Private message integration 3-UR-UI 4-User Relationships 5-UR-Views and found the default blocks and that view so try clear cache and read the docs – Mohammed Gomma Feb 14 '13 at 9:57
  • @Mhmdgomma...have done that already – why Feb 14 '13 at 10:12
  • you really need to be more specific and responsive...this is no way to help – why Feb 19 '13 at 6:34
  • 1
    sorry friend i was so busy and forget to respond – Mohammed Gomma Feb 19 '13 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.