Adding users from custom module

dsv
2008-03-19
2013-05-20
  • dsv
    dsv
    2008-03-19

    Hi,

    can someone tell me what im doing wrong? I have developed custom module (in version 0.10.x) and now im upgrading to current stable (v. 1.3.2).

    My module takes control over new user signup, so when i check user data i manually add the user to table mod_users (in 0.10.x) and user data in some other tables. Now, in v.1.3.2 i add user in table users. However, when i try to log in as new user, i get "Username and password combination not found." message (redirection to login page).

    Here is my code - function for inserting new user:

    // $result[0]['some_field']  -  data from signup page (table)
    // $result[0]['password']  -  password, allready md5 encoded

    $user = new PHPWS_User();
    $user->_password = $result[0]['password'];
    $user->username = $result[0]['username'];
    $user->approved = TRUE;
    $user->authorize = 1;
    $user->email = $result[0]['email'];
    $rez = $user->save();
    if($rez) {
        $id = $user->getId();

        // ...
    }

    PS: this post is also on:
    http://www.phpwsforums.com/showthread.php?p=26801#post26801

     
    • dsv
      dsv
      2008-03-20

      SOLVED:

      $user->_password must be md5($username.$password), i had md5($password)