Best practice for building user-specific pages?

Permalink
Hi,

I'm pitching for a job in which a client wants to manage around 300+ pages with information specific to members.

They've requested each member has a simple url to access this page like /users/jsmith which they're redirected to after they've logged in.

Is this a simple task in C5? First thoughts were to create a single page for each, but that would be massively time-consuming and probably an ineffective way of doing this right?

Any ideas/advice hugely welcome.

Thanks

osu
 
ryan replied on at Permalink Reply
ryan
Not sure what kind of info they want to manage for the users, but take a look at the /profile/ pages that c5 ships with.

basically you'd do a single page that makes a query and displays info off of the user's id
<?php
$u = new User();
$db = Loader::db();
$stuff = $db->getRow("SELECT * FROM customtable WHERE uID = ?,$u->getUserID());
?>

or the more concrete way would be user attributes.

You could also build out a tree of pages and do other custom stuff with the site events:
on_user_login
on_user_register

so, on_user_register you could create a bunch of pages that could be edited in the cms. Take a look at /concrete/controllers/install.php for sample code that builds out pages, installs blocks etc..

on_user_login - you could redirect to wherever..
osu replied on at Permalink Reply
osu
Thanks for this Ryan,

User attributes might work for this as it's mainly just text for each member. However, I understand my client wants to have an editable page so they can type in information and upload pdfs for each member. At the moment, it would be one page, but there would be more later.

With the single page method that you mentioned - I assume that means the page would be editable from within C5, but it would automatically display the user attributes that I specify in $stuff?

I'll also take a look at the controllers documentation as you suggest.
osu replied on at Permalink Reply
osu
Thanks for your help so far, I think I'm not experienced enough in PHP to be able to take on the task of site events in controllers yet...

So, before I get a quote for building this in the jobs section here, I need to know whether user attributes could be my solution.

Because the client wants to create more than 1 page for each member (i.e. a general info page and two other pages with documents relevant to them), I assume that creating a my_profile.php single page as suggested in the C5 documentation isn't going to work because it will only display the user attributes entered when the member signed up right?

I couldn't find documentation on the Users and Groups area of C5, but I assume user attributes are only for extra fields you add to the register form and are for new members who are signing up for an account rather than for clients to update content on a page(s)?

Is the only simple (noob) way around this to create individual password-protected pages for each client? How secure is that as well?

Sorry for so many questions
ryan replied on at Permalink Reply
ryan
So, user attributes are much more flexible than just the registration values. You can specify which ones are visible, hidden, available on registration.
With the upcoming version (concrete 5.3.3) user attributes (page and file attributes too) can be objects where they can really do whatever you could ever want to.

So with that said the way I would approach the problem is when a user is created you'd call a function that adds a few pages of different page types.

The site events are fairly simple to deal with you just define what event you want and then you specify what class and function would need to be called.

To automate all this there's no way around doing quite a bit of php coding. If I was to estimate just that part of it, I'd guess it'd take ~ 2 days of work with my experience level.