Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I had a view all set to list the information I want, which is the first name, public phone number and zip code of users. It is a list of "nodes", since I'm listing the fields from a node: the content profile personal information content type I created.
How do I now restrict the list to only be the information for users that are members of a certain organic group?
this is an export of my current attempt...
$view = new view;
$view->name = 'publicleaderlist';
$view->description = 'Leader List for the Public';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'field_homeaddress_lid' => array(
'label' => 'Location',
'required' => 0,
'id' => 'field_homeaddress_lid',
'table' => 'node_data_field_homeaddress',
'field' => 'field_homeaddress_lid',
'relationship' => 'none',
),
'nid' => array(
'label' => 'Group node (member)',
'required' => 1,
'id' => 'nid',
'table' => 'og_uid',
'field' => 'nid',
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'field_firstname_value' => array(
'label' => 'First Name',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_firstname_value',
'table' => 'node_data_field_firstname',
'field' => 'field_firstname_value',
'relationship' => 'none',
),
'field_phone_public_value' => array(
'label' => 'Public Phone',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_phone_public_value',
'table' => 'node_data_field_phone_public',
'field' => 'field_phone_public_value',
'relationship' => 'none',
),
'city' => array(
'label' => 'City',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'city',
'table' => 'location',
'field' => 'city',
'relationship' => 'field_homeaddress_lid',
),
'postal_code' => array(
'label' => 'Postal Code',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'postal_code',
'table' => 'location',
'field' => 'postal_code',
'relationship' => 'field_homeaddress_lid',
),
'latitude' => array(
'label' => 'Latitude',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'style' => 'dms',
'exclude' => 1,
'id' => 'latitude',
'table' => 'location',
'field' => 'latitude',
'override' => array(
'button' => 'Override',
),
'relationship' => 'field_homeaddress_lid',
),
'longitude' => array(
'label' => 'Longitude',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'style' => 'dms',
'exclude' => 1,
'id' => 'longitude',
'table' => 'location',
'field' => 'longitude',
'override' => array(
'button' => 'Override',
),
'relationship' => 'field_homeaddress_lid',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'rid' => array(
'operator' => 'or',
'value' => array(
'3' => '3',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'rid',
'table' => 'users_roles',
'field' => 'rid',
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'type' => array(
'operator' => 'in',
'value' => array(
'personalinformation' => 'personalinformation',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'type_groups' => array(
'operator' => 'in',
'value' => array(
'leadercatagorygrouping' => 'leadercatagorygrouping',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type_groups',
'table' => 'og',
'field' => 'type_groups',
'relationship' => 'nid',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 1,
'order' => 'asc',
'columns' => array(
'field_firstname_value' => 'field_firstname_value',
'field_phone_public_value' => 'field_phone_public_value',
'city' => 'city',
'postal_code' => 'postal_code',
'latitude' => 'latitude',
'longitude' => 'longitude',
),
'info' => array(
'field_firstname_value' => array(
'sortable' => 1,
'separator' => '',
),
'field_phone_public_value' => array(
'sortable' => 0,
'separator' => '',
),
'city' => array(
'sortable' => 1,
'separator' => '',
),
'postal_code' => array(
'sortable' => 1,
'separator' => '',
),
'latitude' => array(
'sortable' => 0,
'separator' => '',
),
'longitude' => array(
'sortable' => 0,
'separator' => '',
),
),
'default' => 'city',
));
$handler = $view->new_display('page', 'Map Page', 'page_1');
$handler->override_option('style_plugin', 'gmap');
$handler->override_option('style_options', array(
'grouping' => '',
'macro' => '[gmap ]',
'datasource' => 'location',
'latfield' => 'field_firstname_value',
'lonfield' => 'field_firstname_value',
'markers' => 'static',
'markerfield' => 'field_firstname_value',
'markertype' => 'purple',
));
$handler->override_option('path', 'pubicmap');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler = $view->new_display('page', 'Opperations Page', 'page_2');
$handler->override_option('style_plugin', 'bulk');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 1,
'order' => 'asc',
'columns' => array(
'field_firstname_value' => 'field_firstname_value',
'field_phone_public_value' => 'field_phone_public_value',
'city' => 'city',
'postal_code' => 'postal_code',
'latitude' => 'latitude',
'longitude' => 'longitude',
),
'info' => array(
'field_firstname_value' => array(
'sortable' => 0,
'separator' => '',
),
'field_phone_public_value' => array(
'sortable' => 0,
'separator' => '',
),
'city' => array(
'sortable' => 0,
'separator' => '',
),
'postal_code' => array(
'sortable' => 0,
'separator' => '',
),
'latitude' => array(
'sortable' => 0,
'separator' => '',
),
'longitude' => array(
'sortable' => 0,
'separator' => '',
),
),
'default' => '-1',
'execution_type' => '1',
'display_type' => '0',
'hide_select_all' => 0,
'skip_confirmation' => 0,
'display_result' => 1,
'merge_single_action' => 1,
'selected_operations' => array(
'node_save_action' => 'node_save_action',
'og_add_group_action' => 0,
'flag_nodes:1980f2a3af0b5c3577850d4ba2600405' => 0,
'node_assign_owner_action' => 0,
'views_bulk_operations_delete_node_action' => 0,
'node_mass_update:a27b9efabcd054685a549378b174ad11' => 0,
'system_message_action' => 0,
'token_actions_message_action' => 0,
'views_bulk_operations_ruleset_action_rules_set_1' => 0,
'views_bulk_operations_script_action' => 0,
'og_make_private_action' => 0,
'og_make_public_action' => 0,
'node_make_sticky_action' => 0,
'node_make_unsticky_action' => 0,
'node_mass_update:c4d3b28efb86fd703619a50b74d43794' => 0,
'views_bulk_operations_fields_action' => 0,
'views_bulk_operations_taxonomy_action' => 0,
'views_bulk_operations_argument_selector_action' => 0,
'node_promote_action' => 0,
'node_mass_update:14de7d028b4bffdf2b4a266562ca18ac' => 0,
'node_mass_update:9c585624b9b3af0b4687d5f97f35e047' => 0,
'node_publish_action' => 0,
'token_actions_goto_action' => 0,
'system_goto_action' => 0,
'og_remove_groups_action' => 0,
'node_unpromote_action' => 0,
'og_remove_group_action' => 0,
'node_mass_update:8ce21b08bb8e773d10018b484fe4815e' => 0,
'system_send_email_action' => 0,
'token_actions_send_email_action' => 0,
'flag_nodes:fc790522f159f7d6ba9af3c1d5731a16' => 0,
'flag_nodes:76e4c513dfadc798e2eb84ad0a677401' => 0,
'flag_nodes:a6caeb8a8f099d72a62696567bcfbf32' => 0,
'node_mass_update:0ccad85c1ebe4c9ceada1aa64293b080' => 0,
'node_unpublish_action' => 0,
'node_unpublish_by_keyword_action' => 0,
'auto_nodetitle_operations_update' => 0,
'pathauto_node_operations_update' => 0,
),
));
$handler->override_option('path', 'resave');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
and a screen shot of the UI.
Comments
Comment #1
YesCT CreditAttribution: YesCT commentedI wonder if I need to (or could) do it backwards from what I am trying now...
what if I made a view of *users* of a certain OG (the instructions for how to do that have to be around somewhere...), and then used a relationship to connect the profile node, and then displayed the fields using that relationship?
Comment #2
YesCT CreditAttribution: YesCT commentedhmmm, I wonder if the default view: og_members is the same thing?
is the answer as simple as just cloning it?