HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Preventing display of catalogue entry-lists

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#104910 (In Topic #20465)
Avatar

Well-settled

Match-key needed!

Greetings,

I'm having trouble devising a  match-key that prevents a specific usergroup from seeing the names of entries listed beneath any of the various categories of my Weblinks catalogue. 

In place of the listed entries, I need a message indicating they're not viewable by the usergroup in question.

As the Breadcrumbs trail reveals, the catalogue is fairly complex, comprising multiple categories with sub-categories and sub-sub categories. All entries are confined to the last child subcategories (in most cases named "Individual Web-pages" and "Websites")

I've experimented unsuccessfully with several variations of this match-key
site:catalogues:weblinks:misc:type=entry 

I'd be really grateful if anyone can come up with a key that does the job!

Thanks for reading.

(P.S. I suppose it would be possible to insert a {$MATCH_KEY_MATCH} directive in the CATALOGUE_DEFAULT_TITLELIST_WRAP.tpl but I'd prefer to avoid that!)

Back to the top
 
Posted
Rating:
#104922
Avatar

Community saint

I tried and also had some trouble getting the correct syntax to restrict the end category page in my links catalogue. In any case, it looks like you probably have many pages that will need to be restricted and each one would probably need a separate match-key. This would take a while and be more difficult to maintain if you ever decide to add, remove, or merge categories, sub-categories, and sub-sub-categories, etc. I would modify the catalogue template and use a tempcode IF clause with {$IS_IN_GROUP}.

What you can do is copy that CATALOGUE_DEFAULT_TITLELIST_WRAP.tpl (I'll assume you've identified this as the correct template that you need to edit for your catalogue) to your theme template_custom directory and rename it, but change DEFAULT to the name of your catalogue. If your catalogue is named weblinks, the template should be named CATALOGUE_weblinks_TITLELIST_WRAP.tpl. Your weblinks catalogue will now use this template instead of the default. If you want this change to apply to all of your catalogues, then you can just edit the default template. Now you can edit it the template to look like this (not tested, so hopefully it's not too far off):

 
{+START,IF,{$IS_IN_GROUP,6}} 
 Display message to denied usergroup here.
{+END}
{+START,IF,{$NOT,{$IS_IN_GROUP,6}}
 
<p class="lonely_label">{!ENTRIES}:</p>
<ul class="spaced_list">
        {CONTENT}
</ul>
 
{+END}


Just change the 6 in the two {$IS_IN_GROUP} lines to the usergroup ID number of the usergroup you want to restrict. If you want to restrict more than one usergroup, you might have to play around with the syntax to see if you can add a comma separated list of usergroups. If the usergroup you want to restrict is a usergroup that non-restricted members can also belong to, then this won't work as-is and will need some more tweaking to get it to work.
Back to the top
 
Posted
Rating:
#104929
Avatar

Well-settled

Hi Jason!

Thank you so much for this - it works to perfection!

I've differed from your suggested Tempcode directives only as regards starting them after the "lonely_label{!ENTRIES}:" statement, since I want to conserve the original templated display-format and merely replace the {CONTENT} of the spaced list with my "no access" message. Here's my version:
<p class="lonely_label">{!ENTRIES}:</p>

{+START,IF,{$NOT,{$IS_IN_GROUP,1,10}}}
<ul class="spaced_list">
	{CONTENT}
</ul>
{+END}

{+START,IF,{$IS_IN_GROUP,1,10}}
<p>To view the entries, please purchase a subscription.</p>
{+END}
As it happens, I'd already tried out your Tempcode on the CATALOGUE_DEFAULT_TITLELIST_WRAP.tpl, but run up against the obvious snag that the entry-lists of all my catalogues were being replaced by the "no access" message, which wasn't desirable. What I didn't realize at the time of posting my topic was the possibility of specializing the default catalogue templates in respect of individual catalogues simply by renaming them - I learned of that only late last night on reading Chris' special tutorial on catalogue tweaking!  (My, the marvels of the ocPortal templating system!) So, reading your post made complete sense to me and really clarified the practical steps for accomplishing this.

My huge thanks and warm regards,

Richard.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: