Jump to content

Replicate /admin/profile in front-end member account settings page


Recommended Posts

Posted

I want to replicate /admin/profile in a styled front-end member account settings page - keep members out of the admin back-end entirely. 

Is there a quick, built-in way to add those form fields to a template?

In particular/for starters/for example Set Password. I already have a working version with a simple form processed like this:

if($input->post->updatepass) {

	$pass = $input->post->pass;
	
	if($pass) {
		if(strlen($pass) < 6) {
            $winorfail = '<p class="textblock error">Your new password must have at least six characters.</p>';
        } else if($pass !== $input->post->pass_confirm) {
            $winorfail = '<p class="textblock error">Your passwords do not match.</p>';
        } else {
            $user->of(false);
            $user->pass = $pass; 
            $user->save();
            $user->of(true);
            $winorfail = '<p class=textblock>Your password has been changed.</p>';
		}
    }
}

But I bet this is horribly unsafe and incomplete. The PW back-end version also asks for the current password for example. 

Is there a standard "tag" or function or line of code I can use to get the built-in PW processes for these fields? Or should I be able to find the block of code and copy/paste - what keywords should I search on?

Or am I on the right track and should I just keep using forms + processing like above?

I know how to replicate simple text and textarea field etc. and have even figured out a working image upload.

But how can I replicate a Repeater field on the front-end, with all the nice UI magic I get on the back-end?

How could I get image upload on the front-end with the same UI as in the back-end?

Edit: I found a few other questions about Repeater fields in front-end forms here and here. This looks promising. I'll try that and post findings on that thread.  

 

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