Author Topic

Pascal Specht

Wednesday 11 February 2009 12:53:26 am

Comment50676

I didn't find a smart solution for this. But if anyone faces the same problem (having different content on the home page depending on the user belonging to a group or another) I ended up with this 'hack': I added code at the beginning of the frontpage template. This code checks if the rendered page is node 2 (home page) and if the user is belonging to a special group. If both conditions are met, it swaps the homepage node with another frontpage node (SpecialGroupHome). Not very nice, but works as intended.

</Pascal>

{if eq($node.node_id,2)}
{if userInSpecialGroup( ) }
{def $frontpages=fetch( content, list, hash( parent_node_id, 2,
                                               class_filter_type, include,
                                               class_filter_array, array('frontpage')
                                           ) )}
{foreach $frontpages as $fp}
{if eq($fp.name,'SpecialGroupHome')}
{set $node=$fp }
{/if}
{/foreach}
{/if}
{/if}