Skip to content

Commit

Permalink
Fixed #6896: cannot add users to a fresh LimeSurvey installation
Browse files Browse the repository at this point in the history
  • Loading branch information
mennodekker committed Nov 19, 2012
1 parent cd56826 commit 1bcd0f0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions application/models/User.php
Expand Up @@ -154,13 +154,24 @@ public static function insertUser($new_user, $new_pass,$new_full_name,$parent_us
}
}

/**
* This method is invoked before saving a record (after validation, if any).
* The default implementation raises the {@link onBeforeSave} event.
* You may override this method to do any preparation work for record saving.
* Use {@link isNewRecord} to determine whether the saving is
* for inserting or updating record.
* Make sure you call the parent implementation so that the event is raised properly.
* @return boolean whether the saving should be executed. Defaults to true.
*/
public function beforeSave()
{
// Postgres delivers bytea fields as streams :-o - if this is not done it looks like Postgres saves something unexpected
if (gettype($this->password)=='resource')
{
$this->password=stream_get_contents($this->password);
}

return parent::beforeSave();
}


Expand Down

2 comments on commit 1bcd0f0

@c-schmitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thank you!

@reinierpost
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This throws the next problem described in the bug report: $table=$this->getMetaData()->tableSchema; fails in insert() (I get a page consisting of the output '1' and the next line is never reached.)

Please sign in to comment.