Support Forum
Sorry if this is written somewhere, but I couldn't find anything.
I have multiple usergroups set up, and right now members only see forums that they have access to.
How can I make these show in grey (like this forum does). Basically I want users with no access to see what they're missing out on
This comes in two stages, the second of which is a little theme customisation. So I suggest we start with the first...
We use what we call the 'sneak peek' feature. For those user groups that are NOT allowed to access a forum we turn on the permission 'Can view a list of forums and list of topics only'. This allows the lists to be viewed but no posts within a topic.
Then in the forum admin > components > custom messages - you can optionally set up a message that will display to those users - or a url redirect that could go to a sign-up page or something like that.
So that covers showing the forums and/or topic listings to groups of users who can not access the actual posts. As I say - the next bit - the greying - involves some custom work to your theme template and CSS files. If you want to go that far then we can walk you through the changes but before we do that you will need to make a custom or child theme. The child theme is the easiest and best way to go - see this post for details: https://simple-press.com/simpl.....ld-themes/
YELLOW
SWORDFISH
|
First step: In you child theme CSS file you can, of course, remove everything tyhat was from the parent - but add:
.spOpaque { opacity: .5; }
Next you will need to copy from the parent to the child theme the template spGroupView.php. In the middle of that template you will see calls to the function sp_ColumnStart() - probably abot 4 of them. They will look more or less like this depending upon the theme:
sp_ColumnStart("tagClass=spColumnSection spLeft&width=6%&height=55px");
You need to make an insert into EACH one in the template like this:
sp_ColumnStart("tagClass=spColumnSection spLeft$spOpaque&width=6%&height=55px");
Note the insertion of the $spOpaque - no spaces either side.
Finally below this line of code (and the following comment) add:
$spOpaque = ''; if($spThisUser->guest && $spThisGroup->group_id != XX) $spOpaque = ' spOpaque';
Note the XX. This needs to equal the ID of the forum group that your guests CAN post to. You can get the ID from the Manage Groups and Forums admin panel. Also note the space character in ' spOpaque'. better to use the view raw code button and copy and paste as needed,
OK?
YELLOW
SWORDFISH
|
no... like in the article, create it empty... add in a styles and templates directory, also empty...
in the child directory, you need a spTheme.txt file which lists the parent and the stylesheet...
in the child styles directory, you will need mostly empty stylesheet and just add your changes...
in the child templates directory, copy over any templates that you want to modify and make your changes... you only need to copy the ones you want to change...
here is a shell of a default child you can use...
just add your new styles per Andy's feedback and then copy from default the template files and modify (just the ones you want to change)...
Visit Cruise Talk Central and Mr Papa's World
Mr Papa - thank you.
I've made the changes, but I'm finding the layout gets all messed up. All of the columns are getting pushed over to the left side, if that makes sense.
I'm guessing it's a problem with this line:
if($spThisUser->guest && $spThisGroup->group_id != 4) $spOpaque = ' spOpaque';
I wasn't too sure what you meant by "Finally below this line of code (and the following comment)"
I've copied the code below (I figured that'd be easier).
.
.
<?php
# --------------------------------------------------------------------------------------
#
# Simple:Press Template
# Theme : Default
# Template : group
# Author : Simple:Press
#
# The 'group' template is used to display the Group/Forum Index Listing
#
# --------------------------------------------------------------------------------------
# Load the forum header template - normally first thing
# ----------------------------------------------------------------------
sp_SectionStart('tagClass=spHeadContainer', 'head');
sp_load_template('spHead.php');
sp_SectionEnd('', 'head');
sp_SectionStart('tagClass=spBodyContainer', 'body');
# Start the 'groupView' section
# ----------------------------------------------------------------------
sp_SectionStart('tagClass=spListSection', 'groupView');
# Start the Group Loop
# ----------------------------------------------------------------------
if (sp_has_groups()) : while (sp_loop_groups()) : sp_the_group();
# Start the 'groupHeader' section
# ----------------------------------------------------------------------
sp_SectionStart('tagClass=spGroupViewSection', 'group');
sp_GroupHeaderRSSButton('tagClass=spButton spRight', __sp('Group RSS'), __sp('Subscribe to the RSS feed for this forum group'));
sp_GroupHeaderIcon('tagClass=spHeaderIcon spLeft');
sp_GroupHeaderName('tagClass=spHeaderName');
sp_InsertBreak('direction=right');
sp_GroupOpenClose('tagClass=spIcon spRight&default=open', 'Open forum listing', 'Close forum listing');
if (function_exists('sp_ShareThisTag')) sp_ShareThisTag('tagClass=ShareThisTag spRight');
sp_GroupHeaderDescription('tagClass=spHeaderDescription');
sp_GroupHeaderMessage('tagClass=spHeaderMessage');
sp_InsertBreak();
sp_SectionStart('tagClass=spGroupForumContainer', 'forumlist');
# Start the Forum Loop
# ----------------------------------------------------------------------
if (sp_has_forums()) : while (sp_loop_forums()) : sp_the_forum();
# Start the 'forum' section
# ----------------------------------------------------------------------
sp_SectionStart('tagClass=spGroupForumSection', 'forum');
# Column 1 of the forum row
# ----------------------------------------------------------------------
sp_ColumnStart('tagClass=spColumnSection spLeft$spOpaque&width=6%&height=55px');
$spOpaque = '';
if($spThisUser->guest && $spThisGroup->group_id != 4) $spOpaque = ' spOpaque';
sp_ForumIndexIcon('tagClass=spRowIcon spLeft');
sp_ColumnEnd();
# Column 2 of the forum row
# ----------------------------------------------------------------------
sp_ColumnStart('tagClass=spColumnSection spLeft$spOpaque&width=48%&height=55px');
$spOpaque = '';
if($spThisUser->guest && $spThisGroup->group_id != 4) $spOpaque = ' spOpaque';
sp_ForumIndexName('tagClass=spRowName', __sp('Browse topics in %NAME%'));
sp_ForumIndexDescription('tagClass=spRowDescription');
sp_ForumIndexPageLinks('tagClass=spInRowPageLinks spLeft', __sp('Jump to page %PAGE% of topics'));
sp_ColumnEnd();
# Column 4 of the forum row
# ----------------------------------------------------------------------
sp_ColumnStart('tagClass=spColumnSection spRight$spOpaque&width=32%&height=55px');
$spOpaque = '';
if($spThisUser->guest && $spThisGroup->group_id != 4) $spOpaque = ' spOpaque';
sp_ForumIndexLastPost('tagClass=spInRowPostLink&nicedate=1&date=0&time=0&stackdate=0', __sp('Last Post'), __sp('No Topics'));
sp_ColumnEnd();
# Column 3 of the forum row
# ----------------------------------------------------------------------
sp_ColumnStart('tagClass=spColumnSection spRight$spOpaque&width=14%&height=55px');
$spOpaque = '';
if($spThisUser->guest && $spThisGroup->group_id != 4) $spOpaque = ' spOpaque';
sp_ForumIndexTopicCount('tagClass=spInRowCount', __sp('Topics'), __sp('Topic'));
sp_ForumIndexPostCount('tagClass=spInRowCount', __sp('Posts'), __sp('Post'));
sp_ForumIndexStatusIcons('tagClass=spStatusIcon spCenter', __sp('This forum is locked'), __sp('This forum has unread posts in %COUNT% topic(s)'), __sp('Add new topic in this forum'), __sp('No permission to start topics'));
sp_ColumnEnd();
sp_InsertBreak();
sp_ForumIndexSubForums('unreadIcon=sp_SubForumUnreadIcon.png', __sp('Sub-Forums'), __sp('Browse topics in %NAME%'));
sp_SectionEnd('', 'forum');
endwhile; else:
sp_NoForumsInGroupMessage('tagClass=spMessage', __sp('There are no forums in this group'));
endif;
sp_SectionEnd('', 'forumlist');
sp_SectionEnd('', 'group');
endwhile; else:
sp_NoGroupMessage('tagClass=spMessage', __sp('The requested group does not exist or you do not have permission to view it'), __sp('No groups have been created yet'));
endif;
sp_SectionEnd('', 'groupView');
sp_RecentPostList('show=10', __sp('Unread and recently updated topics'));
sp_SectionEnd('', 'body');
# Load the forum footer template - normally last thing
# ----------------------------------------------------------------------
sp_SectionStart('tagClass=spFootContainer', 'foot');
sp_load_template('spFoot.php');
sp_SectionEnd('', 'foot');
?>
It looks like you didnt copy this part right:
sp_ColumnStart("tagClass=spColumnSection spLeft$spOpaque&width=6%&height=55px");
note, yours starts and ends with single quotes... must be double quotes...
Visit Cruise Talk Central and Mr Papa's World
Thank you.
Everything is displaying correctly now. I'm not seeing anything different for members with no access though. the colour is just the same as normal (i.e. not semi-opaque).
I've checked, and members don't have access to anything they shouldn't, so the roles are definitely working properly.
1 Guest(s)