Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted August 24, 20213 yr 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, 20213 yr by Redmak
August 24, 20213 yr {{if !$forum->canView(\IPS\Member::load(0))}}THIS IS MEMBERS ONLY{{endif}} Below screenshot is a logged in user: This is the guests view:
August 24, 20213 yr 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.
August 24, 20213 yr Author 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.
August 24, 20213 yr 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.
August 26, 20213 yr Author {{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 😛
August 26, 20213 yr {{if !$forum->canView( new \IPS\Member ) AND !\in_array( $forum->_id, array( 1, 2, 3 ) )}}THIS IS MEMBERS ONLY{{endif}}
August 26, 20213 yr Author {{if !$forum->canView( new \IPS\Member ) AND !\in_array( $forum->_id, array( 1, 2, 3 ) )}}THIS IS MEMBERS ONLY{{endif}} Thanks Ryannn!!! 😄
August 26, 20213 yr Author {{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).
August 26, 20213 yr 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.
August 26, 20213 yr Author 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, 20213 yr by Redmak
August 31, 20213 yr 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?