diff --git a/commons_groups.module b/commons_groups.module index 56390fb..724574c 100644 --- a/commons_groups.module +++ b/commons_groups.module @@ -291,6 +291,7 @@ function commons_groups_tab_title($tab) { ->propertyCondition('entity_type', 'user') ->propertyCondition('gid', $user->uid) ->propertyCondition('etid', $user->uid, '<>') + ->propertyCondition('state', 1) ->count() ->execute(); @@ -328,6 +329,7 @@ function commons_groups_tab($tab) { ->propertyCondition('entity_type', 'user') ->propertyCondition('gid', $user->uid) ->propertyCondition('etid', $user->uid, '<>') + ->propertyCondition('state', 1) ->count() ->execute(); @@ -1059,7 +1061,7 @@ function commons_groups_field_formatter_view($entity_type, $entity, $field, $ins list($id,, $bundle) = entity_extract_ids($entity_type, $entity); if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_ACTIVE))) { $links['title'] = t('Message'); - $links['href'] = "contacts/messages/popup/$id"; + $links['href'] = 'user/' . $user->uid . '/contacts/messages/popup/' . $id; } else if (og_is_member($entity_type, $id, 'user', $account, array(OG_STATE_PENDING))) { @@ -1403,7 +1405,7 @@ function commons_groups_approve_trust(OgMembership $og_membership) { message_notify_send_message($message); // Redirect to Invitations screen. - drupal_goto('contacts/invitations'); + drupal_goto('user/' . $user->uid . '/contacts/invitations'); } /** @@ -1428,7 +1430,7 @@ function commons_groups_ignore_trust(OgMembership $og_membership) { $wrapper->save(); // Redirect to Invitations screen. - drupal_goto('contacts/invitations'); + drupal_goto('user/' . $user->uid . '/contacts/invitations'); } /** @@ -1509,7 +1511,7 @@ function commons_group_is_trusted_contact($uid, $account = NULL) { * are Trusted-Contacts. * * @param $uid - * Addressee's user object. + * Addressee's user object or User ID. */ function commons_groups_privatemsg_write_access($account) { global $user; @@ -1519,7 +1521,9 @@ function commons_groups_privatemsg_write_access($account) { return true; } - return (privatemsg_user_access('write privatemsg') && commons_group_is_trusted_contact($account->uid)); + $uid = isset($account->uid) ? $account->uid : $account; + + return (privatemsg_user_access('write privatemsg') && commons_group_is_trusted_contact($uid)); } /** diff --git a/commons_groups.views_default.inc b/commons_groups.views_default.inc index 9e460a1..508832c 100644 --- a/commons_groups.views_default.inc +++ b/commons_groups.views_default.inc @@ -1446,6 +1446,17 @@ function commons_groups_views_default_views() { $handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0'; $handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary'; $handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25'; + /* Contextual filter: User: Uid */ + $handler->display->display_options['arguments']['uid_1']['id'] = 'uid_1'; + $handler->display->display_options['arguments']['uid_1']['table'] = 'users'; + $handler->display->display_options['arguments']['uid_1']['field'] = 'uid'; + $handler->display->display_options['arguments']['uid_1']['relationship'] = 'og_membership_related_user_group'; + $handler->display->display_options['arguments']['uid_1']['default_action'] = 'default'; + $handler->display->display_options['arguments']['uid_1']['default_argument_type'] = 'current_user'; + $handler->display->display_options['arguments']['uid_1']['summary']['number_of_records'] = '0'; + $handler->display->display_options['arguments']['uid_1']['summary']['format'] = 'default_summary'; + $handler->display->display_options['arguments']['uid_1']['summary_options']['items_per_page'] = '25'; + $handler->display->display_options['arguments']['uid_1']['not'] = TRUE; /* Filter criterion: OG membership: Type */ $handler->display->display_options['filters']['type']['id'] = 'type'; $handler->display->display_options['filters']['type']['table'] = 'og_membership'; diff --git a/views/handlers/commons_groups_handler_send_message.inc b/views/handlers/commons_groups_handler_send_message.inc index 55ec4e8..39d558b 100644 --- a/views/handlers/commons_groups_handler_send_message.inc +++ b/views/handlers/commons_groups_handler_send_message.inc @@ -3,6 +3,8 @@ class commons_groups_handler_send_message extends views_handler_field { function render($values) { - return l(t('Send private message'), 'contacts/messages/popup/' . $values->og_membership_etid); + global $user; + + return l(t('Send private message'), 'user/' . $user->uid . '/contacts/messages/popup/' . $values->og_membership_etid); } }