Jump to content

Populating a site with user pages


Recommended Posts

I'm capturing the main content for a site using a registration/profile process. The end product will be a categorised showcase of their submissions. They're selecting the page that would be the parent category as part of the profile process.

The easiest way to do this would probably be to copy the user pages to be "normal" pages when sign-up is closed. But I would like to avoid this as it would fracture the content if we needed to reopen registrations. So instead I would like to try leaving the users alone, and looping them simply by grabbing all users with the current page as their selected parent.

It won't be as simple as browsing to /users/user-name, I need to put them in categories based on regular pages like /category/child-category/user-name

I think this is easy enough, I know how to select the users and loop through them, load a template based on their page (I think) - but can you think of any reasons why I should or shouldn't do this, any complications I'm not considering? I'm going to try and store a nice unique name for them from their real name, when they sign up that can serve as the URL. Is there anything useful in the API that can make sure a name is unique and add a number if it's not?

I know this is a bit vague, but anyone done anything like this before?


Link to comment
Share on other sites

Two things came into my mind, if I get it right what you are after. (not totally sure):

You may create a "custom user page" as regular page after each successful registration. You only need one extra field in native user pages that stores the page id of the bundled custom user page. This way you can use the built in users and roles system for all login and access related and have all other stuff in a regular page with templates & fields of your choice including all regular api related stuff.
(For accessing pages that should not be public, you also may hook into viewable etc. and check if the $user->isLoggedin() and if the $user->custom_field_id matches the id of the custom-user-page that is tried to be accessed.)


Regarding unique URLs I used a lot something like the following:

$loginToken = bin2hex(random_bytes(30)) . md5(time());  // store this once into a dedicated field of the custom user page on registration


I think the random_bytes already should be enough, adding a timestamp may be a bit superstitious or overanxious. 🙂

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...