Front end users module, and user specific content

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
rpw
New Member
New Member
Posts: 6
Joined: Tue Jun 12, 2012 3:56 pm

Front end users module, and user specific content

Post by rpw »

Hi,

I'm not a php programmer - so a tad out of my depth here. I have about 50 users, that need to log in and see some statistics.

The statistics are generated by a third party application, which has an api... using their tutorials, I've sort of figured out how to fetch the data and display it. I made a User Defined Tag - which works :)

I've also installed Front End Users Module - and set up various users. Searching the forums, I found some code which allows me to show specific content to a specific user:

Code: Select all

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

I then create a page with the $company variable as alias. So now that user has their own page - which only they can view.

So, in theory, all I need to do is pass the $company variable into my User Defined Tag, and that user should see all the stats associated with their company.

However, I can quickly see this becoming unmanageable...

So... what I'd like to do is just have one page, called Stats. When the user logs in, I would like to pass them to stats... and based on their username and password.... change the content of stats accordingly.

I've been looking through the forums - and can't figure this one out.


Many thanks,
Rob
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Front end users module, and user specific content

Post by applejack »

Once the user is logged in pass the company name to a Smarty value

{assign var=mycompany value=$company}

In the UDT get the value of mycompany using

$username = $smarty->get_template_vars('mycompany');

Or if you already have the value feu_user use

$username = $smarty->get_template_vars('feu_user');

Then pass username to the API to get the stats.
Post Reply

Return to “Modules/Add-Ons”