[FIX] Clearing coin address for account
This commit is contained in:
parent
1e922829dd
commit
a4e17e6a31
@ -51,7 +51,22 @@ class CoinAddress extends Base {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$stmt = $this->mysqli->prepare("INSERT INTO " . $this->getTableName() . " (account_id, currency, coin_address) VALUES (?, ?, ?)");
|
$stmt = $this->mysqli->prepare("INSERT INTO " . $this->getTableName() . " (account_id, currency, coin_address) VALUES (?, ?, ?)");
|
||||||
if ( $this->checkStmt($stmt) && $stmt->bind_param('sis', $userID, $currency, $address) && $stmt->execute()) {
|
if ( $this->checkStmt($stmt) && $stmt->bind_param('iss', $userID, $currency, $address) && $stmt->execute()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $this->sqlError();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a coin address record for a user
|
||||||
|
* @param userID int Account ID
|
||||||
|
* @param currency string Currency short handle, defaults to config option
|
||||||
|
* @return bool true or false
|
||||||
|
**/
|
||||||
|
public function remove ($userID, $currency=NULL) {
|
||||||
|
if ($currency === NULL) $currency = $this->config['currency'];
|
||||||
|
$stmt = $this->mysqli->prepare("DELETE FROM " . $this->getTableName() . " WHERE account_id = ? AND currency = ?");
|
||||||
|
if ( $this->checkStmt($stmt) && $stmt->bind_param('is', $userID, $currency) && $stmt->execute()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return $this->sqlError();
|
return $this->sqlError();
|
||||||
|
|||||||
@ -545,8 +545,15 @@ class User extends Base {
|
|||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('ddssii', $threshold, $donate, $email, $timezone, $is_anonymous, $userID) && $stmt->execute()) {
|
if ($this->checkStmt($stmt) && $stmt->bind_param('ddssii', $threshold, $donate, $email, $timezone, $is_anonymous, $userID) && $stmt->execute()) {
|
||||||
$this->log->log("info", $this->getUserName($userID)." updated their account details");
|
$this->log->log("info", $this->getUserName($userID)." updated their account details");
|
||||||
// Update coin address too
|
// Update coin address too
|
||||||
if ($this->coin_address->update($userID, $address))
|
if ($address) {
|
||||||
return true;
|
if ($this->coin_address->update($userID, $address)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($this->coin_address->remove($userID, $address)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Catchall
|
// Catchall
|
||||||
$this->setErrorMessage('Failed to update your account');
|
$this->setErrorMessage('Failed to update your account');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user