Index: trunk/extensions/QPoll/qp_pollstore.php |
— | — | @@ -753,18 +753,21 @@ |
754 | 754 | if ( $this->username === $username ) { |
755 | 755 | return; |
756 | 756 | } |
757 | | - $this->username = $username; |
758 | 757 | $res = self::$db->select( 'qp_users','uid','name=' . self::$db->addQuotes( $username ), __METHOD__ ); |
759 | 758 | $row = self::$db->fetchObject( $res ); |
760 | | - if ( $row == false ) { |
| 759 | + if ( $row === false ) { |
761 | 760 | if ( $store_new_user_to_db ) { |
762 | | - self::$db->insert( 'qp_users', array( 'name'=>$this->username ), __METHOD__ . ':UpdateUser' ); |
| 761 | + self::$db->insert( 'qp_users', array( 'name' => $username ), __METHOD__ . ':UpdateUser' ); |
763 | 762 | $this->last_uid = intval( self::$db->insertId() ); |
| 763 | + # set username, user was created |
| 764 | + $this->username = $username; |
764 | 765 | } else { |
765 | 766 | $this->last_uid = null; |
766 | 767 | } |
767 | 768 | } else { |
768 | 769 | $this->last_uid = intval( $row->uid ); |
| 770 | + # set username, used was loaded |
| 771 | + $this->username = $username; |
769 | 772 | } |
770 | 773 | $res = self::$db->select( 'qp_users_polls', |
771 | 774 | array( 'attempts', 'short_interpretation', 'long_interpretation' ), |