Jump to content

Recommended Posts

Posted (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 by Redmak
Posted
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.

Posted
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 😛 

Posted
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!!! 😄 

Posted
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).

 

Posted
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.

Posted (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 by Redmak
Posted

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?

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...