Page 1 of 1

loading dynamic global_content

Posted: Wed Sep 22, 2010 4:01 pm
by tralli
I need a little help implementing the following. I need to make content of certain global_content blocks viewable only to users that are authorized to view it. For each user in FEU module there is a hidden checkbox for each content that represents the user permission to view it. When the user logs in he sees a list of contents he has permission for. Now I need to make it so that when the user clicks a link in the list the correct global_content will load to the page. This sounds easy I know but cms is making this confusing for me to do. How would you do this?

Lets say a user has permission to view content1,content2 and content4
When he clicks the link for content2 the content for {global_content name='content2'} will load on the page.

Thanks in advance

Re: loading dynamic global_content

Posted: Thu Sep 23, 2010 6:13 pm
by NaN
Just some thoughts on this...

Let's assume the value of the checkboxes have the name of the global content blocks.
And the names of the global content user properties will start with global_content_...
If the user is logged in use the $FrontEndUsers Object that should be in the template to get the users properties (or the $mod object, not sure wich one is the most convenient):

Code: Select all


{if $ccuser->loggedin()}
    {assign var="user_props" value=$FrontEndUsers->GetUserProperties($userid)}
    {foreach from=$user_props item="prop"}
        {if $prop.title|truncate:14 == 'global_content_'}
            {global_content name=$prop.data}
        {/if}
    {/foreach}
{/if}

This should show all global content blocks that are setup in the users settings.