Page 1 of 1
Custom content based on induvidual Front End User
Posted: Fri Oct 28, 2011 6:24 am
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.
Re: Custom content based on induvidual Front End User
Posted: Fri Oct 28, 2011 5:14 pm
by Dr.CSS
Asked and answered just a few days ago, please to search...
Re: Custom content based on induvidual Front End User
Posted: Tue Nov 01, 2011 10:12 pm
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.
Re: Custom content based on induvidual Front End User
Posted: Wed Mar 07, 2012 11:37 pm
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.
Re: Custom content based on induvidual Front End User
Posted: Thu Mar 08, 2012 3:56 am
by jmcgin51
{if $ccuser->username('the_users_username')}
{* content only for that specific user *}
{/if}
Re: Custom content based on induvidual Front End User
Posted: Fri Mar 09, 2012 4:28 pm
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.
Re: Custom content based on induvidual Front End User
Posted: Fri Mar 09, 2012 6:50 pm
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}
Re: Custom content based on induvidual Front End User
Posted: Fri Mar 09, 2012 8:32 pm
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.
Re: Custom content based on induvidual Front End User
Posted: Fri Mar 09, 2012 8:45 pm
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.
Re: Custom content based on induvidual Front End User
Posted: Tue Mar 13, 2012 6:44 pm
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.
Re: Custom content based on induvidual Front End User
Posted: Tue Mar 13, 2012 7:15 pm
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}
Re: Custom content based on induvidual Front End User
Posted: Wed Mar 21, 2012 1:47 pm
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.