Custom content based on induvidual Front End User

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
gstwebdev
New Member
New Member
Posts: 4
Joined: Fri Oct 28, 2011 5:40 am

Custom content based on induvidual Front End User

Post by gstwebdev »

Hi, I'm wondering if it is possible at all to determine what each individual user sees when they are logged in.
Im using the front end user and custom content modules

I currently have pages which determine what the users see by group; but am wanting to customise it further so that individual users can have a custom screen only to them.

at the minute i am using:
{if $ccuser->loggedin()}
{* content only for users that belongs to a specific group *}
{if $ccuser->memberof('GroupName')}
<div class="companyscreen"> {content block="GroupName" label="Group 1 content"}</div>
{/if}

{if $ccuser->memberof('OtherGroup')}
<div class="companyscreen"> {content block="Other" label="Content for Other Group"} </div>
{/if}
{/if}

is it possible to use a tag such as 'user_name' instead of memberof ?

Thanks in advance for any help.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Custom content based on induvidual Front End User

Post by Dr.CSS »

Asked and answered just a few days ago, please to search...
gstwebdev
New Member
New Member
Posts: 4
Joined: Fri Oct 28, 2011 5:40 am

Re: Custom content based on induvidual Front End User

Post by gstwebdev »

Do you mind please posting the link, as I searched for hours and hours and could not find what I was looking for. it would be much appreciated; thanks.
mr.bacan

Re: Custom content based on induvidual Front End User

Post by mr.bacan »

Hi gstwebdev,

Did you managed to solve this issue? I'm facing the same problem and can't find the post with the solution.

Thanks for any help on this.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Custom content based on induvidual Front End User

Post by jmcgin51 »

{if $ccuser->username('the_users_username')}
{* content only for that specific user *}
{/if}
mr.bacan

Re: Custom content based on induvidual Front End User

Post by mr.bacan »

jmcgin51 wrote:{if $ccuser->username('the_users_username')}
{* content only for that specific user *}
{/if}
Thanks for your reply. The issue here is that it only works on a specific user. I have 30 different users and I want each user to go to a personalized page.

How could that be achieved?

Thanks again for your help.
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Custom content based on induvidual Front End User

Post by staartmees »

after a succesfull login, I would redirect them to a selectionpage with the following code:

{if $ccuser->loggedin()}

{if $ccuser->username('user1')}
{redirect_page page='user1'}
{/if}

{if $ccuser->username('user2')}
{redirect_page page='user2'}
{/if}

{/if}
mr.bacan

Re: Custom content based on induvidual Front End User

Post by mr.bacan »

That's what I was thinking staartmees, but then I thought that every time a new user is added, the template must be edited.

Isn't there any tag to get the logged user's username automatically and then pass that as a variable on the redirect?

For example:

Code: Select all

{if $ccuser->loggedin()}

{if $ccuser->username('userid')}
{redirect_page page='userid'}
{/if}

{/if}
Thanks for your help on this.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Custom content based on induvidual Front End User

Post by jmcgin51 »

mr.bacan wrote: For example:

Code: Select all

{if $ccuser->loggedin()}

{if $ccuser->username('userid')}
{redirect_page page='userid'}
{/if}

{/if}
Even easier:

Code: Select all

{if $ccuser->loggedin()}
{redirect_page page=$ccuser->username()} 
{* where the page alias == the logged-in user's username *}
{/if}
You could also do this via userid instead, if you wanted to.

This kind of functionality would best be combined with a UDT that automatically creates a new page (with alias == username) when a user is created. Otherwise it will still potentially be a lot of work for the administrator to create all of the pages.
mr.bacan

Re: Custom content based on induvidual Front End User

Post by mr.bacan »

jmcgin51 wrote:

Code: Select all

{if $ccuser->loggedin()}
{redirect_page page=$ccuser->username()} 
{* where the page alias == the logged-in user's username *}
{/if}
Thanks for your answer, I wasn't able to test it last week. Now that I finally do, it doesn't work, it seems that "{redirect_page page=$ccuser->username()}" has an error, because it breaks my template. If I remove "$ccuser->username()" and put anything else, it works.

Am I doing something wrong?

Thanks again.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Custom content based on induvidual Front End User

Post by jmcgin51 »

sorry - try just {$username} instead.

so

{if $ccuser->loggedin()}
{redirect_page page=$username}
{* where the page alias == the logged-in user's username *}
{/if}
mr.bacan

Re: Custom content based on induvidual Front End User

Post by mr.bacan »

jmcgin51 wrote:{if $ccuser->loggedin()}
{redirect_page page=$username}
{* where the page alias == the logged-in user's username *}
{/if}
Thanks a lot jmcgin51, this worked like a charm. Sorry for my delayed answer on this, but I was on a business trip and didn't had the time to test it.

I'll keep making a few tests, but at a first glance it looks like you solved my problem.

Thanks a lot for your time guys.
Post Reply

Return to “Modules/Add-Ons”