Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8274311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:41:54+00:00 2026-06-08T07:41:54+00:00

I am trying to create the edit profile page for a logged user in

  • 0

I am trying to create the “edit” profile page for a logged user in cakephp. This would be the function to add/edit information about the user.
I get an error during the $this->User->save($this->data) function and I don’t understand what is the problem.

public function edit() {
   $this->User->id = $this->Auth->User('id');

    if ($this->request->is('post')) {
        if ($this->User->save($this->data)) {
            $this->Session->setFlash(__('The user has been saved'), 'flash_success');
           // $this->redirect($this->Auth->redirect());
        } else {
            var_dump($this->invalidFields());

            $this->Session->setFlash(__('The user could not be saved. Please, try again.'), 'flash_failure');
        }
    } else {
        //autocompleto il form
        $this->data = $this->User->read(null, $this->Auth->User('id'));
    }
}

The view is:

<?php 
echo $this->Form->create('User',array('action' => 'edit'));
echo $this->Form->input('name', array('label'=> 'Name'));
echo $this->Form->input('surname', array('label'=> 'Surname'));
echo $this->Form->input('id', array('type'=> 'hidden'));
echo $this->Form->end(__('Submit')); 
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:41:55+00:00Added an answer on June 8, 2026 at 7:41 am

    I see you use Auth component. If your Auth::authorize default value is overridden ensure that you give user proper rights to perform data writing (maybe he only allowed to read).

    Another issue could be your $validate declaration in model, where you force user to enter field value (using 'required' = true) but actually this field is not even displayed on View. You could avoid this validation rule on data edit if 'on' => 'create' is defined inside.

    Also I would recommend use CakePHP debug() instead of var_dump() for debugging purpose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I edit link tabs found on the default user profile page in
I'm trying to redirect users that login to their profile page but get the
I get this error when trying to register a new user. NoMethodError (undefined method
I'm trying to post on the page that I create. **Please note that this
I'm trying to edit the CSS file of the My Profile page on my
I'm trying to create a custom action for a Update My Profile Page. It
I am trying to create a form for the user to change their profile
We are trying to create an edit in place kind of form. I'm using
Trying to create a new Dedicated Cache Role in Windows Azure but get the
I'm trying to override FOSUserBundle form Edit profile ; I have created the class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.