Skip to content

Commit

Permalink
Merge pull request #1006 from rjmackay/member-more-info-300
Browse files Browse the repository at this point in the history
Fix more info form when member logs in #300
  • Loading branch information
eyedol committed Apr 3, 2013
2 parents b486c47 + 44d15aa commit 7164074
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion application/controllers/members/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function index()
'notify' => $this->user->notify,
'color' => $this->user->color,
'password' => '', // Don't set a new password from here
'needinfo' => 0 // After we save this form once, we don't need to show it again
'needinfo' => $this->user->needinfo // After we save this form once, we don't need to show it again
);

// Javascript Header
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/members/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ public function index()
$user->public_profile = $post->public_profile;
$user->color = $post->color;
$user->needinfo = $needinfo;
if ($post->new_password != '')
if (! empty($post->new_password))
{
$user->password = $post->new_password;
}
}
$user->save();
//for plugins that want to know how the user now stands
Event::run('ushahidi_action.profile_edit_member', $user);
Expand Down
10 changes: 7 additions & 3 deletions application/models/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,24 @@ class User_Model extends Auth_User_Model {
* @param string riverid user id
* @return object ORM object from saving the user
*/
public static function create_user($email,$password,$riverid=false,$name=false)
public static function create_user($email, $password, $riverid=FALSE, $name=FALSE)
{
$user = ORM::factory('user');

$user->email = $email;
$user->username = User_Model::random_username();
$user->password = $password;

if ($name != false)
if (! empty($name))
{
$user->name = $name;
}
else
{
$user->needinfo = 1;
}

if ($riverid != false)
if ($riverid != FALSE)
{
$user->riverid = $riverid;
}
Expand Down
5 changes: 5 additions & 0 deletions application/views/members/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
<span style="float:left;"><?php echo url::base().'profile/user/'; ?></span>
<?php echo form::input('username', $user->username, ' class="text short2"'); ?>
</div>

<div class="row">
<h4><a href="#" class="tooltip" title="<?php echo Kohana::lang("tooltips.profile_password"); ?>"><?php echo Kohana::lang('ui_main.current_password'); ?></a> <span class="required"><?php echo Kohana::lang('ui_main.required'); ?></span></h4>
<?php print form::password('current_password', '', ' class="text"'); ?>
</div>

<div class="row" style="padding-top:10px;">
<h4><a href="#" class="tooltip" title="<?php echo Kohana::lang("tooltips.profile_public"); ?>"><?php echo Kohana::lang('ui_main.public_profile');?>:</a></h4>
Expand Down

0 comments on commit 7164074

Please sign in to comment.