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.


[Solved] Blocking usergroup from viewing a screen

Login / Search

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

Well-settled

Not quite getting this right!

Greetings!

I'm trying to insert a Tempcode argument in my custom theme's WIKI_SCREEN.tpl to prevent a usergroup (Registered Guests, id 2) from viewing wiki-pages on clicking links to them. (I want them to see the links,though). I've inserted  {+START,IF,{$NOT,{$IS_IN_GROUP,2}}} as follows: (sorry about the lack of indentation, but this is otherwise correctly copied)

Code

<div class="wiki_screen">
   {+START,IF,{$NOT,{$IS_IN_GROUP,2}}}
{+START,IF_NON_EMPTY,{DESCRIPTION}}
{+START,IF,{$NOT,{HIDE_POSTS}}}
<div class="pe_wiki_page_description" itemprop="description">
<div class="box box___wiki_page_screen"><div class="box_inner">
<div>
{DESCRIPTION}
</div>
</div></div>
 
{+START,IF_NON_EMPTY,{$GET,bound_catalogue_entry}}{$CATALOGUE_ENTRY_ALL_FIELD_VALUES,{$GET,bound_catalogue_entry}}{+END}
</div>
{+END}
{+START,IF,{HIDE_POSTS}}
<div class="pe_wiki_page_description">
{DESCRIPTION}
</div>
 
{+START,IF_NON_EMPTY,{$GET,bound_catalogue_entry}}{$CATALOGUE_ENTRY_ALL_FIELD_VALUES,{$GET,bound_catalogue_entry}}{+END}
 
<hr class="spaced_rule" />
{+END}
{+END}

   {+END}

The result I'm getting puzzles me - almost all usergroups, including #2, still get pages displayed, EXCEPT for Admins (id 6) who just see the links to child pages and the row of edit/add buttons. I've also tried inserting arguments like {+START,IF,{$IS_IN_GROUP,1,3-6}} but haven't managed to get any of these to work. (no usergroups have secondary groups, btw,)

I'm wondering if, perhaps, the arguments are in the wrong place in the code, or if they aren't themselves just wrongly declared in some way.

If anyone recognizes my problem, I'd really appreciate your help!

Thanks for reading!
Back to the top
 
Posted
Rating:
#102456
Avatar

Community saint

I think you might be getting your usergroup ID's from the wrong place. ID 2 is the Administrators usergroup in a default installation of ocPortal. If you login to the Admin Zone of your web site, go to Security->Usergroups. This will show a table of all of the usergroups. Hover over the Edit link in the Actions column and it should pop up a little box with a number in it. That number should be the usergroup ID. Also, when hovering over the Edit link, the URL that shows in the browser status bar at the bottom of the browser window will end with the usergroup ID number.
Back to the top
 
Posted
Rating:
#102458
Avatar

Community saint


point up

YUP!

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#102459
Avatar

Well-settled

Hi Jason!

Well I'll be blowed - I never knew that!! What I'd been doing all along was assuming my usergroup ordering numbers were their id values. Explains everything - and the problem was fixed in literally 5 seconds! That's one small step... and one giant leap forward for me, as it's my first success at controlling usergroup viewing access to a screen, and there are other important ones I need to do as well. :thumbs:

Really can't thank you enough!

Best regards,

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

Quick reply   Contract

Your name:
Your message: