From 5960d17e9771f1ff28cf69b735e0ea457b4b59aa Mon Sep 17 00:00:00 2001 From: Jochem van Nieuwenhuijsen Date: Mon, 8 May 2017 17:46:21 +0200 Subject: [PATCH 1/2] #2866041 by jochemvn: Add relationship to user table and filter out blocked users --- .../install/views.view.newest_users.yml | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/modules/social_features/social_profile/config/install/views.view.newest_users.yml b/modules/social_features/social_profile/config/install/views.view.newest_users.yml index 2b09e7ff69f..4a6d80180bf 100644 --- a/modules/social_features/social_profile/config/install/views.view.newest_users.yml +++ b/modules/social_features/social_profile/config/install/views.view.newest_users.yml @@ -136,6 +136,44 @@ display: entity_type: profile entity_field: type plugin_id: bundle + status: + id: status + table: users_field_data + field: status + relationship: uid + group_type: group + admin_label: '' + operator: '=' + value: '1' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + entity_type: user + entity_field: status + plugin_id: boolean sorts: created: id: created @@ -156,7 +194,18 @@ display: header: { } footer: { } empty: { } - relationships: { } + relationships: + uid: + id: uid + table: profile + field: uid + relationship: none + group_type: group + admin_label: User + required: true + entity_type: profile + entity_field: uid + plugin_id: standard arguments: { } display_extenders: { } cache_metadata: From 60ee7fdbbf72011fde2b7566c024f3845753d570 Mon Sep 17 00:00:00 2001 From: Jochem van Nieuwenhuijsen Date: Mon, 8 May 2017 17:52:40 +0200 Subject: [PATCH 2/2] #2866041 by jochemvn: Check if the user object is in fact a user object. For blocker users it's not there --- .../social_core/social_core.module | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/modules/social_features/social_core/social_core.module b/modules/social_features/social_core/social_core.module index 79eaeddd2c4..73b87f569a7 100644 --- a/modules/social_features/social_core/social_core.module +++ b/modules/social_features/social_core/social_core.module @@ -201,21 +201,27 @@ function social_core_preprocess_block(&$variables) { $link->setOption('use_more', FALSE); break; case 'events-block_events_on_profile': - $variables['subtitle'] = t('for this user'); - $variables['view_all_path'] = Url::fromRoute('view.events.events_overview', array('user' => $account->id())); - $variables['button_text'] = t('All ') . $variables['label']['#markup']; + if ($account instanceof \Drupal\user\Entity\User) { + $variables['subtitle'] = t('for this user'); + $variables['view_all_path'] = Url::fromRoute('view.events.events_overview', array('user' => $account->id())); + $variables['button_text'] = t('All ') . $variables['label']['#markup']; + } break; case 'topics-block_user_topics': - $variables['subtitle'] = t('for this user'); - $variables['view_all_path'] = Url::fromRoute('view.topics.page_profile', array('user' => $account->id())); - $variables['button_text'] = $more_link; - $link->setOption('use_more', FALSE); + if ($account instanceof \Drupal\user\Entity\User) { + $variables['subtitle'] = t('for this user'); + $variables['view_all_path'] = Url::fromRoute('view.topics.page_profile', array('user' => $account->id())); + $variables['button_text'] = $more_link; + $link->setOption('use_more', FALSE); + } break; case 'groups-block_user_groups': - $variables['subtitle'] = t('for this user'); - $variables['view_all_path'] = Url::fromRoute('view.groups.page_user_groups', array('user' => $account->id())); - $variables['button_text'] = $more_link; - $link->setOption('use_more', FALSE); + if ($account instanceof \Drupal\user\Entity\User) { + $variables['subtitle'] = t('for this user'); + $variables['view_all_path'] = Url::fromRoute('view.groups.page_user_groups', array('user' => $account->id())); + $variables['button_text'] = $more_link; + $link->setOption('use_more', FALSE); + } break; case 'group_members-block_newest_members': $variables['subtitle'] = t('in the group');