How to do pages for registered users only?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
kazkas

How to do pages for registered users only?

Post by kazkas »

I need to create website with some pages, that are accessed only for logged in users. I would use CustomContent, but the tags needs to be added in every page, which has 2 downsides:
1/ Do not think administrator will fill the tags properly for new pages.
2/ With CustomContent tags there is no more WYSIWYG editing, because tags make mess in editing field.
I would set Global Content fields for every page and tell to edit only them, but there will be more pages every day or so, so this is not the solution either... Anyone has good idea about it???
Maybe there is additional functionality in CustomContent module that I don't know or module I missed?
Nick Smart
Forum Members
Forum Members
Posts: 116
Joined: Mon Jul 28, 2008 4:48 pm
Location: Cambridge, UK

Re: How to do pages for registered users only?

Post by Nick Smart »

How about putting the logic in the template instead. Create a 'secure_content' template and apply that to the relevant pages.

Replace

Code: Select all

{content}
with:

Code: Select all

{ if $ccuser->loggedin() }
	{content block="protected"}
{else}
	{content}
{/if}
and then you'll have two content blocks, one for secure content and the other where you can display a "please login" type message.

Nick
Last edited by Anonymous on Tue Sep 02, 2008 12:31 pm, edited 1 time in total.
Post Reply

Return to “Developers Discussion”