Allow anonymous to view user profiles

Created on 23 January 2020, almost 5 years ago
Updated 25 December 2024, 14 days ago

How do I allow anonymous users to view users profile pages.
I have checked the permissions for anonymous users and they have both 'Profile: View any profile entities' and 'View any profile entities' checked but still get access denied.

I need anonymous users access to a users /user/*/stream

Is the social profile module overriding this ?

Feature request
Status

Closed: outdated

Version

8.0

Component

Profiles

Created by

🇦🇴Angola chipchenko

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇷🇺Russia cuman

    Solution

    Change on /mysite/public_html/profiles/contrib/social/modules/social_features/social_user/social_user.routing.yml this:

    social_user.user_home:
      path: '/user/{user}/home'
      defaults:
        _entity_view: 'user.stream'
      requirements:
        _user_is_logged_in: 'TRUE'
        _custom_access: '\Drupal\social_user\Controller\SocialUserController::accessUsersPages'
    
    social_user.stream:
      path: '/user/{user}/stream'
      defaults:
        _entity_view: 'user.stream'
      requirements:
        _user_is_logged_in: 'TRUE'
        _custom_access: '\Drupal\social_user\Controller\SocialUserController::accessUsersPages'

    By:

    social_user.user_home:
      path: '/user/{user}/home'
      defaults:
        _entity_view: 'user.stream'
      requirements:
        _custom_access: '\Drupal\social_user\Controller\SocialUserController::accessUsersPages'
    
    social_user.stream:
      path: '/user/{user}/stream'
      defaults:
        _entity_view: 'user.stream'
        _title_callback: 'Drupal\user\Controller\UserController::userTitle'
      requirements:
        _custom_access: '\Drupal\social_user\Controller\SocialUserController::accessUsersPages'

    This solution will allow the username to be displayed in the title and will give control over whether the stream is accessible to anonymous users.

    But it will be erased during the update. I suggest that the developers consider this solution for inclusion in the next releases.

Production build 0.71.5 2024