backdrop-contrib / og

The Organic Groups module provides users the ability to create, manage, and delete 'groups' on a site.
GNU General Public License v2.0
1 stars 8 forks source link

Request Group Membership link is visible for nonauthenticated users (not logged in) #50

Closed schoenid closed 2 years ago

schoenid commented 2 years ago

While group content is made visible for guests (ANONYMOUS or nonauthenticated users), I found, that also the Request Group Membership link is visible.

This is ugly, because a nonauthenticated user can't become a group member. The Request Group Membership link must be hidden for the user role ANONYMOUS.

Workaround

To solve the problem I've disabled the Group field in the groups content type (MANAGE DISPLAYS) and then I've created a view as a workaround with the following configuration:

CONTEXTUAL FILTERS

(OG membership from user) OG membership: Group ID --> Content ID from URL

RELATIONSHIPS

OG membership: OG membership from User account
(OG membership from user) OG membership: Group Node from OG membership

FIELDS

(Group node from OG membership) Content: Group --> Formatter: OG subscribe link

(This gives the link ...)

FILTER CRITERIA

User account: Active (Active)
User account: Current (No)
(Group node from OG membership) OG membership: State (empty)

(This makes sure, the link is only displayed for a registered user, if (s)he is not a member of the current group node.)

indigoxela commented 2 years ago

The behavior seems to be like in D7, for anonymous the link becomes a redirect:

/user/login?destination=group/node/123/subscribe/og_group_ref

While this can be the desired output for some groups/sites, I agree that this might not always be the right thing. Maybe it could become an additional setting to show/hide for anonymous (then this would be a feature request).

In the meantime people can use the proposed workaround - many thanks @schoenid for providing it.

olafgrabienski commented 2 years ago

Maybe it could become an additional setting to show/hide for anonymous (then this would be a feature request).

Where would the setting be provided: in the field settings?

In the meantime people can use the proposed workaround

Here's another one:

schoenid commented 2 years ago

While this can be the desired output for some groups/sites, I agree that this might not always be the right thing. Maybe it could become an additional setting to show/hide for anonymous (then this would be a feature request).

I agree, in that case this should be a feature request.

Here's another one:

  • Requirement: a specific Layout for Groups (path: node/%, Type is Group)
  • admin/structure/types/manage/group/display/default: Hide the Group field
  • admin/structure/layouts/manage/group: Add the Group field as a block
  • Add a Visibility condition to the block, so that it's not shown for the role "Anonymous"

Right, thats another kind of filter ... Thanks a lot !

laryn commented 2 years ago

@schoenid Can you test with the latest code and see if this is still an issue or if the fixes that went in recently took care of this?

schoenid commented 2 years ago

@laryn

Can you test with the latest code and see if this is still an issue or if the fixes that went in recently took care of this?

Well, I can't call it an "issue" anymore ...

I found, that the best to fit the requirements will be,

  1. admin/structure/types/manage/group/display/default: Hide the Group field

  2. to add a "block view" for content with the following simplified configuration:

CONTEXTUAL FILTERS --> Content: Nid (Content ID from URL) FORMAT: Unformatted list FIELDS: Content: Group (Formatter: OG subscribe link) FILTER CRITERIA: Content: Type (= Group)

The Access will then be set either by

This will give the output of either

schoenid commented 2 years ago

I have to add the last comment to the WIKI, as soon as we have a structure, where it fits in ... or as soon as we created it ...