ProLoser / aggrofolio

The first dedicated Blog-folio platform
unfol.io
1 stars 0 forks source link

Add a new 'Setting' record when someone registers #27

Closed ProLoser closed 12 years ago

ProLoser commented 12 years ago

During registration, a blank (or default) setting record should be inserted alongside the new user's account. You can refer to this documentation: http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-saveassociated-array-data-null-array-options-array on how to format the array for the association to be completed.

I would recommend in the UsersController, simply adding an empty array under a 'Setting' key NEXT to the 'User' key in $this->request->data just before the call to $this->User->save (or saveAssociated in this case).

Where you retrieve the default data or what you decide to use can be up to you. We can build out a theme selector, or let the user add other options (such as the site name).

ProLoser commented 12 years ago

I ended up doing this myself, although it's probably good because I caught a bug elsewhere that needed to be tweaked to make this work. For now I simply added a 'site_name' input, however there is still the opportunity to expand upon selecting from premade themes. Perhaps we should create themes table? Or just reserve this for when we look into expanding the view layer later?