Redmak Posted August 24, 2021 Share Posted August 24, 2021 (edited) I've been thinking about how I can make it clearer to my members how certain forums cannot be viewed by guests and my preference would be to have a tag like suffix after the forum name, (or even just an icon of sorts) but how can I ensure it only appears on forums that guests cannot see? (I would add this directly into the forumRow template). I was sad to see that the forum title (in ACP forum management) does not support HTML, because that would have made things a lot easier. Thanks in advance. Edited August 24, 2021 by Redmak Link to comment Share on other sites More sharing options...
Nathan Explosion Posted August 24, 2021 Share Posted August 24, 2021 {{if !$forum->canView(\IPS\Member::load(0))}}THIS IS MEMBERS ONLY{{endif}} Below screenshot is a logged in user: This is the guests view: Link to comment Share on other sites More sharing options...
opentype Posted August 24, 2021 Share Posted August 24, 2021 Personally, I add this to the structure of the forum itself, i.e. I have categories where I group public and member-only forums. Example: https://typography.guru/forums/ That makes it fairly obvious. In the past, I would also add a lock emoji to the forum name or description to achieve the same. Daniel F 1 Link to comment Share on other sites More sharing options...
Redmak Posted August 24, 2021 Author Share Posted August 24, 2021 1 hour ago, opentype said: Personally, I add this to the structure of the forum itself, i.e. I have categories where I group public and member-only forums. Example: https://typography.guru/forums/ That makes it fairly obvious. In the past, I would also add a lock emoji to the forum name or description to achieve the same. Thanks a lot for that! Okay I have another question for you, how do you get around Google complaining it cannot access (crawl) member only forums? I used to display the member forums to try and get guests to register (because they just got a permission denied message on trying to open a members forum) so I have again hid the member only forums to guests. Google suggests supplying a member login at Search Console for crawling and enabling ads in member only areas, but I don't want member topics ending up in Google Search. My forums have a mixture of guest and member (sub)forums across a couple of categories so it is not viable to lump the member only ones all in the same category. Link to comment Share on other sites More sharing options...
opentype Posted August 24, 2021 Share Posted August 24, 2021 Quote how do you get around Google complaining it cannot access (crawl) member only forums? I don’t. It’s perfectly normal to have non-public sections on a website. Jimi Wikman 1 Link to comment Share on other sites More sharing options...
Redmak Posted August 26, 2021 Author Share Posted August 26, 2021 On 8/24/2021 at 5:51 PM, Nathan Explosion said: {{if !$forum->canView(\IPS\Member::load(0))}}THIS IS MEMBERS ONLY{{endif}}  Is there a way to target specific forum numbers with that if statement, or exclude (is moderator) staff forums. I have MEMBERS ONLY on a bunch of staff forums 😛 Link to comment Share on other sites More sharing options...
Ryan Ashbrook Posted August 26, 2021 Share Posted August 26, 2021 {{if !$forum->canView( new \IPS\Member ) AND !\in_array( $forum->_id, array( 1, 2, 3 ) )}}THIS IS MEMBERS ONLY{{endif}} Â Link to comment Share on other sites More sharing options...
Redmak Posted August 26, 2021 Author Share Posted August 26, 2021 2 minutes ago, Ryan Ashbrook said: {{if !$forum->canView( new \IPS\Member ) AND !\in_array( $forum->_id, array( 1, 2, 3 ) )}}THIS IS MEMBERS ONLY{{endif}}  Thanks Ryannn!!! 😄 Link to comment Share on other sites More sharing options...
Redmak Posted August 26, 2021 Author Share Posted August 26, 2021 18 minutes ago, Ryan Ashbrook said: {{if !$forum->canView( new \IPS\Member ) AND !\in_array( $forum->_id, array( 1, 2, 3 ) )}}THIS IS MEMBERS ONLY{{endif}}  did not work 😞 {{if !$forum->canView( new \IPS\Member ) AND !\in_array( $forum->_id, array( 81, 82, 105, 202, 231, 232 ) )}}🔒{{endif}} This did not apply to the forums, it showed on each staff forum instead, which have totally different forum id (I am using a padlock to test output).  Link to comment Share on other sites More sharing options...
Nathan Explosion Posted August 26, 2021 Share Posted August 26, 2021 2 minutes ago, Redmak said: 81, 82, 105, 202, 231, 232 Are these the IDs of the staff forums? Link to comment Share on other sites More sharing options...
Ryan Ashbrook Posted August 26, 2021 Share Posted August 26, 2021 23 minutes ago, Redmak said: This did not apply to the forums, it showed on each staff forum instead, which have totally different forum id (I am using a padlock to test output). Yes, sorry - I should have specified. The ID's would be the ID's of your staff forums, not the members only forums. Link to comment Share on other sites More sharing options...
Redmak Posted August 26, 2021 Author Share Posted August 26, 2021 (edited) 28 minutes ago, Nathan Explosion said: Are these the IDs of the staff forums? Yeah I need a switch to display something only for members only forums, but excluding staff forums. Edited August 26, 2021 by Redmak Link to comment Share on other sites More sharing options...
Redmak Posted August 27, 2021 Author Share Posted August 27, 2021 Nobody? 😢 Link to comment Share on other sites More sharing options...
Ehren Posted August 31, 2021 Share Posted August 31, 2021 Hi @Redmak I do something similar on my own forums, however I show an overlay to non-customers (basically guests or regular members). If an admin or customer is viewing the site, the overlay isn't shown. I use css to achieve this, and it only involves a minor template modification on globalTemplate. This technique can easily be adjusted to show the icon/message to members instead. To use this technique on your site, open your globalTemplate file and find: <html Change that to: <html data-group-id='{expression="member.member_group_id"}' That will output the member group ID of the current visitor. We can now use something like the below code to display a message or icon next to certain forum names. This example will add a "Members only" badge next to forum #81 if the person viewing your site is in group 3 ("Members" by default): [data-group-id='3'] [data-forumid='81'] .ipsDataItem_title::after{ content: 'Members only'; font-size: 0.6em; font-weight: bold; background: rgb(var(--theme-text_light)); color: #fff; border-radius: 4px; padding: .2em .7em; margin-left: .7em; } If you're unfamiliar with CSS, you can add this badge to multiple forums by duplicating and comma separating the top line like so: [data-group-id='3'] [data-forumid='81'] .ipsDataItem_title::after, [data-group-id='3'] [data-forumid='82'] .ipsDataItem_title::after, [data-group-id='3'] [data-forumid='105'] .ipsDataItem_title::after, [data-group-id='3'] [data-forumid='202'] .ipsDataItem_title::after, [data-group-id='3'] [data-forumid='231'] .ipsDataItem_title::after, [data-group-id='3'] [data-forumid='232'] .ipsDataItem_title::after{ content: 'Members only'; font-size: 0.6em; font-weight: bold; background: rgb(var(--theme-text_light)); color: #fff; border-radius: 4px; padding: .2em .7em; margin-left: .7em; } Or, if you'd rather use the padlock instead: [data-group-id='3'] [data-forumid='81'] .ipsDataItem_title::after, [data-group-id='3'] [data-forumid='82'] .ipsDataItem_title::after, [data-group-id='3'] [data-forumid='105'] .ipsDataItem_title::after, [data-group-id='3'] [data-forumid='202'] .ipsDataItem_title::after, [data-group-id='3'] [data-forumid='231'] .ipsDataItem_title::after, [data-group-id='3'] [data-forumid='232'] .ipsDataItem_title::after{ content: '🔒'; }  Does that help? Marc Stridgen, Meddysong, Mark H and 1 other 4 Link to comment Share on other sites More sharing options...
Recommended Posts