Hi, all! I have added a new field in the g2_user table called "g_voucher". I was wondering how do i go about getting gallery to update that field as and when it's needed. I have come up with the following codes but do not know how to go on from here.
In g2helper.inc, I added to following:
Quote:
function voucherTransfer($id, $quantity) {
		$ret = GalleryEmbed::isExternalIdMapped($id, 'GalleryUser');
		if (empty($ret)) {
			$ret = GalleryEmbed::updateUser($id, array(
				'quantity' => $quantity)
			);
			if (isset($ret)) {
				$this->_errorHandler(GENERAL_ERROR, "updateUser failed for $id. Here is the error message from G2: <br />" . $ret->getAsHtml(), __LINE__, __FILE__);
			}
		}
		elseif (isset($ret) && $ret->getErrorCode() & ERROR_MISSING_OBJECT) {
			/*
			* User does not exist in gallery, so do nothing!
			*/
		}
		else {
			$this->_errorHandler(GENERAL_ERROR, "isExternalIdMapped failed for $id.", __LINE__, __FILE__);
		}
		$this->_done();
	}
In GalleryEmbed.class, I edited the function _setUserData by adding the followin lines to the function:
Quote:
if (isset($args['quantity'])) {
	    $user->setQuantity($args['quantity']);
	}
My question is how do I get Gallery to then create the necessary sql statements to update the g2_user table with the $user->setQuantity? Please help! Would really appreciate your advise.