Jump to content

Recommended Posts

Posted

Hi all,

right now I'm thinking about a system to manage users and their pages from within the backend.

Every user needs a different page.

I came up with the idea using a field within a template called "username" and use it in the users page template.

On page /login there's a login with username and password and

/login/userpage1

/login/userpage2

/login/userpage3

....

are the subpages (name of pages). Those are given a special role which is applied to my users.

The advantage I see:  I can easily redirect after login with

$mypage = $page->children->get("username=".$user->name)->name;
$session->redirect("/login/$mypage");

and I can easily check if the page is the users page with

if ($page->username != $user->name) { $session->redirect("/login/"); }

So this is a typical newbie approach, but it seems logical.  :rolleyes:

Are there any side effects I'm not seeing right now? Or is there a better way to manage something like this?

Regards,

Thomas

Posted

If I understand it correctly, it looks alright to me. We've done things like this before, connecting the user name with another page though rather than having a saperate "username" field, we just used the existing page "name" field to connect with the username. So that's the only thing I'd say, is to double check that you really need an extra "username" field, or if you can make use of the built-in name field to do all this. 

Posted

Thank you. It's working fine and I'll stick with the username field, because I need the name field for other purposes.

Regards,

Thomas

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...