本文整理汇总了PHP中Member::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::update方法的具体用法?PHP Member::update怎么用?PHP Member::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doApprove
public function doApprove()
{
$exist = Member::get()->filter(array('Email' => $this->Email))->first();
if ($exist) {
return false;
}
$member = new Member();
$data = $this->toMap();
unset($data['ID']);
unset($data['ClassName']);
unset($data['UnapprovedMember']);
$member->update($data);
$member->write();
if ($this->MemberType === 'Organization') {
$member->addToGroupByCode('organization');
$organization = new Organization();
$organization->AccountID = $member->ID;
$organization->company_name = $this->OrganizationName;
$organizationID = $organization->write();
$member->OrganizationID = $organizationID;
$member->write();
} else {
$member->addToGroupByCode('personal');
}
$this->setField('Approved', true);
$this->write();
return true;
}
示例2: finish
public function finish($data, $form)
{
parent::finish($data, $form);
$steps = DataObject::get('MultiFormStep', "SessionID = {$this->session->ID}");
if ($steps) {
foreach ($steps as $step) {
if ($step->class == 'Page2PersonalDetailsFormStep') {
$member = new Member();
$data = $step->loadData();
if ($data) {
$member->update($data);
$member->write();
}
}
if ($step->class == 'Page2OrganisationDetailsFormStep') {
$organisation = new Organisation();
$data = $step->loadData();
if ($data) {
$organisation->update($data);
if ($member && $member->ID) {
$organisation->MemberID = $member->ID;
}
$organisation->write();
}
}
// Debug::show($step->loadData()); // Shows the step data (unserialized by loadData)
}
}
$controller = $this->getController();
$controller->redirect($controller->Link() . 'finished');
}
示例3: doSave
function doSave($data, $form)
{
if (isset($data['Password']) && is_array($data['Password'])) {
$data['Password'] = $data['Password']['_Password'];
}
// We need to ensure that the unique field is never overwritten
$uniqueField = Member::get_unique_identifier_field();
if (isset($data[$uniqueField])) {
$SQL_unique = Convert::raw2sql($data[$uniqueField]);
$existingUniqueMember = Member::get()->filter(array($uniqueField => $SQL_unique))->first();
if ($existingUniqueMember && $existingUniqueMember->exists()) {
if (Member::currentUserID() != $existingUniqueMember->ID) {
die("current member does not match enrolled member.");
return false;
}
}
}
$member = Member::currentUser();
if (!$member) {
$member = new Member();
}
$member->update($data);
$member->write();
$arrayExtraFields = array();
if (isset($data["SelectedOption"])) {
$arrayExtraFields["SelectedOption"] = $data["SelectedOption"];
}
if (isset($data["BookingCode"])) {
$arrayExtraFields["BookingCode"] = $data["BookingCode"];
}
$this->controller->addAttendee($member, $arrayExtraFields);
$this->redirect($this->getController()->Link("thankyou"));
return;
}
示例4: setStatusCallback
public function setStatusCallback(StdClass $args, ReadOnlyObject $action, ReadWriteObject $mem_redirect, ReadWriteObject $mem_resend)
{
$vars = $this->args_vars->post;
$member = new Member($vars['member-id']);
$member->Status = $vars['new-status'];
$member->update();
return true;
}
示例5: testCMSAccess
public function testCMSAccess()
{
$members = Member::get()->byIDs($this->allFixtureIDs('Member'));
foreach ($members as $member) {
$this->assertTrue(Permission::checkMember($member, 'CMS_ACCESS'));
}
$member = new Member();
$member->update(array('FirstName' => 'No CMS', 'Surname' => 'Access', 'Email' => 'no-access@example.com'));
$member->write();
$this->assertFalse(Permission::checkMember($member, 'CMS_ACCESS'));
}
示例6: requireDefaultRecords
/**
* Create permissions, groups and member records if they don't exist.
*/
public function requireDefaultRecords()
{
parent::requireDefaultRecords();
$groups = array();
// create or update groups, cache id by title
foreach (self::$groups as $title => $description) {
if (!($group = DataObject::get_one('Group', " Title = '{$title}'"))) {
$group = new Group(array('Title' => $title));
}
// update description if exists, otherwise set
$group->Description = $description;
$group->write();
$groups[$title] = $group->ID;
}
// create or update permissions and assign to associated group
foreach (self::$permissions as $code => $groupTitle) {
if (!($perm = DataObject::get_one('Permission', " Code = '{$code}' "))) {
$perm = new Permission(array('Code' => $code));
}
$perm->GroupID = $groups[$groupTitle];
$perm->write();
}
// if config option is true create or update members, then add Member to group
if ($this->config()->get('create_members_and_assign_to_groups') === true) {
foreach (self::$members as $memberInfo) {
$email = $memberInfo['Email'];
if (!($member = DataObject::get_one('Member', " Email = '{$email}' "))) {
$member = new Member();
}
// set or update data
$member->update($memberInfo);
$member->write();
foreach (self::$member_groups[$email] as $groupTitle) {
// if not in the group already add it
$groupID = $groups[$groupTitle];
if (!$member->Groups()->filter('ID', $groupID)->first()) {
$member->Groups()->add($groupID);
}
$member->write();
}
}
}
}
示例7: createOrMerge
/**
* Create a new member with given data for a new member,
* or merge the data into the logged in member.
*
* IMPORTANT: Before creating a new Member record, we first
* check that the request email address doesn't already exist.
*
* @param array $data Form request data to update the member with
* @return boolean|object Member object or boolean FALSE
*/
public static function createOrMerge($data)
{
// Because we are using a ConfirmedPasswordField, the password will
// be an array of two fields
if (isset($data['Password']) && is_array($data['Password'])) {
$data['Password'] = $data['Password']['_Password'];
}
// We need to ensure that the unique field is never overwritten
$uniqueField = Member::get_unique_identifier_field();
if (isset($data[$uniqueField])) {
$SQL_unique = Convert::raw2xml($data[$uniqueField]);
$existingUniqueMember = DataObject::get_one('Member', "{$uniqueField} = '{$SQL_unique}'");
if ($existingUniqueMember && $existingUniqueMember->exists()) {
if (Member::currentUserID() != $existingUniqueMember->ID) {
return false;
}
}
}
if (!($member = Member::currentUser())) {
$member = new Member();
}
$member->update($data);
return $member;
}
示例8: array
if ($_POST['id'] == 0) {
// new ---> add
if ($member->addJobProfile($data) === false) {
echo 'ko';
exit;
}
} else {
// existing ---> update
if ($member->saveJobProfile($_POST['id'], $data) === false) {
echo 'ko';
exit;
}
}
$data = array();
$data['updated_on'] = date('Y-m-d');
$member->update($data);
echo 'ok';
exit;
}
if ($_POST['action'] == 'get_job_profiles') {
$criteria = array('columns' => "member_job_profiles.id, member_job_profiles.position_title, \n member_job_profiles.position_superior_title, \n member_job_profiles.employer, industries.industry AS specialization, \n employer_industries.industry AS employer_specialization, \n DATE_FORMAT(member_job_profiles.work_from, '%b, %Y') AS formatted_work_from, \n DATE_FORMAT(member_job_profiles.work_to, '%b, %Y') AS formatted_work_to", 'joins' => "member_job_profiles ON member_job_profiles.member = members.email_addr, \n industries ON industries.id = member_job_profiles.specialization, \n industries AS employer_industries ON employer_industries.id = member_job_profiles.employer_specialization", 'match' => "members.email_addr = '" . $_POST['id'] . "'", 'having' => "member_job_profiles.id IS NOT NULL", 'order' => "work_from DESC");
$member = new Member();
$result = $member->find($criteria);
if (is_null($result) || empty($result) || count($result) <= 0) {
echo '0';
exit;
}
if ($result === false) {
echo 'ko';
exit;
}
示例9: time
if ((!isset($_COOKIE['btUsername']) || !isset($_COOKIE['btPassword'])) && isset($_SESSION['btRememberMe']) && $_SESSION['btRememberMe'] == 1 && isset($_SESSION['btUsername']) && isset($_SESSION['btPassword'])) {
$cookieExpTime = time() + 60 * 60 * 24 * 3;
setcookie("btUsername", $_SESSION['btUsername'], $cookieExpTime, $MAIN_ROOT);
setcookie("btPassword", $_SESSION['btPassword'], $cookieExpTime, $MAIN_ROOT);
}
$menuXML = new SimpleXMLElement(BASE_DIRECTORY . "themes/" . $THEME . "/themeinfo.xml", NULL, true);
if (isset($_SESSION['btUsername']) && isset($_SESSION['btPassword'])) {
$memberObj = new Member($mysqli);
if ($memberObj->select($_SESSION['btUsername'])) {
if ($memberObj->authorizeLogin($_SESSION['btPassword'])) {
define("LOGGED_IN", true);
$memberInfo = $memberObj->get_info();
$memberUsername = $memberInfo['username'];
$memberID = $memberInfo['member_id'];
if ($memberInfo['loggedin'] == 0) {
$memberObj->update(array("loggedin"), array(1));
}
$actualPageNameLoc = strrpos($PAGE_NAME, " - ");
$actualPageName = substr($PAGE_NAME, 0, $actualPageNameLoc);
if ($PAGE_NAME == "") {
$actualPageName = "Home Page";
}
$lastSeenLink = "<a href='" . $dispHTTP . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . "'>" . $actualPageName . "</a>";
$arrUpdateColLastSeen = array("lastseen", "lastseenlink");
$arrUpdateValLastSeen = array(time(), $lastSeenLink);
if (time() - $memberInfo['lastlogin'] > 3600) {
$arrUpdateColLastSeen[] = "lastlogin";
$arrUpdateValLastSeen[] = time();
}
$memberObj->update($arrUpdateColLastSeen, $arrUpdateValLastSeen);
$rankObj = new Rank($mysqli);
示例10: Member
<?php
/*
* Bluethrust Clan Scripts v4
* Copyright 2014
*
* Author: Bluethrust Web Development
* E-mail: support@bluethrust.com
* Website: http://www.bluethrust.com
*
* License: http://www.bluethrust.com/license.php
*
*/
$prevFolder = "../";
include "../_setup.php";
$memberObj = new Member($mysqli);
if ($memberObj->select($_SESSION['btUsername']) && $memberObj->authorizeLogin($_SESSION['btPassword'])) {
$memberObj->update(array("loggedin"), array(0));
}
if (isset($_COOKIE['btUsername']) || isset($_COOKIE['btPassword'])) {
setcookie("btUsername", "", time() - 3600, $MAIN_ROOT);
setcookie("btPassword", "", time() - 3600, $MAIN_ROOT);
}
$_SESSION['btPassword'] = "";
$_SESSION['btUsername'] = "";
$_SESSION['btRememberMe'] = "";
echo "\n<script type='text/javascript'>\nwindow.location = '" . $MAIN_ROOT . "';\n</script>\n";
示例11: array
}
// 3. make the member privileged
// 3.1 check whether is the member active?
// if not, reset the password to the email and set flag to send email, and make member active.
// 3.2 make the recommender field to use the $branch
$send_password_reset_email = false;
$member_data = array();
$member_data['recommender'] = $branch;
$member_data['added_by'] = $employee->id();
$member = new Member($_POST['member']);
if (!$member->is_active()) {
$member_data['password'] = md5($member->id());
$member_data['active'] = 'Y';
$send_password_reset_email = true;
}
if ($member->update($member_data, true) === false) {
echo '-2';
// failed to activate member
exit;
}
// 4. make this $branch as default friend
// 4.1 if such a relationship does not exist, add and pre-approve it.
$contact_adding_error = false;
$query = "SELECT approved FROM member_referees \n WHERE member = '" . $member->id() . "' AND \n referee = '" . $branch . "'";
$result = $mysqli->query($query);
if (is_null($result[0]['approved'])) {
// add
$query = "INSERT INTO member_referees SET \n `member` = '" . $member->id() . "', \n `referee` = '" . $branch . "', \n `referred_on` = NOW(), \n `approved` = 'Y'; \n INSERT INTO member_referees SET \n `referee` = '" . $member->id() . "', \n `member` = '" . $branch . "', \n `referred_on` = NOW(), \n `approved` = 'Y'";
} else {
if ($result[0]['approved'] == 'N') {
// update
示例12: array
$data = array();
$data['firstname'] = $_POST['firstname'];
$data['lastname'] = $_POST['lastname'];
$data['phone_num'] = $_POST['phone_num'];
$data['address'] = $_POST['address'];
$data['state'] = $_POST['state'];
$data['zip'] = $_POST['zip'];
$data['country'] = $_POST['country'];
$data['citizenship'] = $_POST['citizenship'];
$data['hrm_gender'] = $_POST['hrm_gender'];
$data['hrm_ethnicity'] = $_POST['hrm_ethnicity'];
$data['hrm_birthdate'] = $_POST['hrm_birthdate'];
$member = NULL;
if ($mode == 'update') {
$member = new Member($_POST['id']);
if (!$member->update($data)) {
echo 'ko';
exit;
}
} else {
$member = new Member($_POST['email_addr']);
$new_password = generate_random_string_of(6);
$hash = md5($new_password);
$data['password'] = $hash;
$data['forget_password_question'] = '1';
$data['forget_password_answer'] = 'system picked';
$data['added_by'] = $employee->getId();
$data['joined_on'] = $today;
$data['active'] = 'Y';
$data['invites_available'] = '10';
if ($member->create($data) === false) {
示例13: dechex
// to avoid conflicts with existing usernames
$date = dechex(time());
$ngroup = new_ngroup("Test ballots group", 500, 25);
// create main member
$login = new Member;
$login->invite = Login::generate_token(24);
$login->eligible = true;
$login->verified = true;
$login->create();
$login->username = "t".$date."login";
$login->password = $password;
$login->mail = ERROR_MAIL;
$login->update(['username', 'password', 'eligible', 'mail'], 'activated=now()');
// go through all cases
$case = 0;
do {
$stopcase = 0;
do {
$case++;
$stopcase++;
} while ( ! $return = create_case($case, $stopcase) );
} while ( $return !== "end" );
/**
* create one test case
示例14: array
use Agil\View\View;
use Agil\Session\Session;
$request = View::route($_POST);
if ($request['METHOD'] == 'POST' && !empty($request['name']) && !empty($request['username']) && !empty($request['email'])) {
$logado = Session::get('logado');
$name = $request['name'];
$username = $request['username'];
$email = $request['email'];
try {
$sql = array('id_member' => $logado['id_member'], 'status' => '1');
$login = new Login();
$login->fields = array('username' => $username);
$login->update($sql);
$member = new Member();
$member->fields = array('name' => $name, 'email' => $email);
$member->update($sql);
$fields = array('name' => $name, 'email' => $email, 'username' => $username);
foreach ($logado as $key => $value) {
if (array_key_exists($key, $logado) && array_key_exists($key, $fields)) {
$logado[$key] = $fields[$key];
}
}
Session::update('logado', $logado);
?>
<script>
window.parent.boss.ajax.load('/app/user/form_profile/', '#app_conteiner');
</script>
<?php
} catch (Exception $e) {
echo $e;
}
示例15: array
}
// Disable members who fail to be promoted for auto-disable ranks
$arrRanks = array();
$result = $mysqli->query("SELECT rank_id FROM " . $dbprefix . "ranks WHERE autodisable != '0'");
while ($row = $result->fetch_assoc()) {
$arrRanks[] = $row['rank_id'];
}
$sqlRanks = "('" . implode("','", $arrRanks) . "')";
$result = $mysqli->query("SELECT * FROM " . $dbprefix . "members WHERE rank_id IN " . $sqlRanks . " AND onia = '0'");
while ($row = $result->fetch_assoc()) {
$member->select($row['member_id']);
$memberListInfo = $member->get_info();
$rankObj->select($row['rank_id']);
$memRankListInfo = $rankObj->get_info();
if (floor(time() / 86400) - floor($memberListInfo['datejoined'] / 86400) >= $memRankListInfo['autodisable']) {
$member->update(array("disabled", "disableddate"), array(1, $time));
$member->logAction("Disabled for failure to be promoted before " . $memRankListInfo['autodisable'] . " days.");
}
}
$rankCatObj = new RankCategory($mysqli);
$gameObj = new Game($mysqli);
$breadcrumbObj->setTitle("Members");
$breadcrumbObj->addCrumb("Home", $MAIN_ROOT);
$breadcrumbObj->addCrumb("Members");
include $prevFolder . "include/breadcrumb.php";
?>
<div id='tiltPhoneImg' style='display: none'><img src='<?php
echo $MAIN_ROOT;
?>
images/tiltphone.png'><p align='center'>need more space<br>tilt your phone!</p></div>
<table class='formTable' id='membersPageTable'>