当前位置: 首页>>代码示例>>PHP>>正文


PHP Member类代码示例

本文整理汇总了PHP中Member的典型用法代码示例。如果您正苦于以下问题:PHP Member类的具体用法?PHP Member怎么用?PHP Member使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Member类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setNavigation

 protected function setNavigation(Member $member)
 {
     if ($member->getId() !== $this->getUser()->getMemberId()) {
         sfConfig::set('sf_nav_type', 'friend');
         sfConfig::set('sf_nav_id', $member->getId());
     }
 }
开发者ID:balibali,项目名称:opAlbumPlugin,代码行数:7,代码来源:opAlbumPluginActions.class.php

示例2: getMemberPostCount

 /**
  * returns a count of how many posts a member has made
  *
  * @param object $member - Member entity
  * @access public
  * @return int
  */
 public function getMemberPostCount(Member $member)
 {
     if (!$member->isLoaded()) {
         return 0;
     }
     return $this->countWhere("IdWriter = '{$member->getPKValue()}'");
 }
开发者ID:gpuenteallott,项目名称:rox,代码行数:14,代码来源:post.entity.php

示例3: addMember

 private function addMember($id, $name)
 {
     $session = $this->getSession($id);
     // Check for existing member
     foreach ($session->getMembers() as $candidate) {
         if ($candidate->getName() == $name) {
             $member = $candidate;
             break;
         }
     }
     // Create new member
     if (!isset($member)) {
         $member = new Member();
         $member->setName($name);
         $member->setSession($session);
         $this->save($member);
     }
     // Store name in cookie if not done yet
     if (!isset($_COOKIE['scrum_member_name'])) {
         setcookie('scrum_member_name', $name);
     }
     $result = new stdClass();
     $result->sessionId = $id;
     $result->memberId = $member->getId();
     return $result;
 }
开发者ID:rakesh-mohanta,项目名称:scrumonline,代码行数:26,代码来源:session-controller.php

示例4: CommentUserNotificationSubscriptionsFor

 /**
  * This method is overly complex, because {@link Comment} doesn't have a standard 'Parent' has_one, as it can be
  * attached to multiple different object types.
  *
  * @todo Can we fix this method without losing the flexibility that {@link Comment} provides?
  *
  * @see the above CommentUserNotificationSubscriptions() method for documentation
  * @param Member $member The {@link Member} object to find comments posted by, where `NotifyOfUpdates` = 1
  * @return ArrayList The list of {@link ArrayData} objects that can be shown in the template
  */
 public function CommentUserNotificationSubscriptionsFor(Member $member)
 {
     if (!$member || !$member->isInDB()) {
         return null;
     }
     // No member (or no ID yet), so nothing to find
     $allComments = Comment::get()->filter(array('AuthorID' => $member->ID, 'NotifyOfUpdates' => true));
     if (!$allComments) {
         return null;
     }
     $allObjects = new ArrayList();
     $allAddedComments = new ArrayList();
     // @todo O(n^2) :(
     foreach ($allComments as $comment) {
         $alreadyAdded = false;
         foreach ($allAddedComments as $obj) {
             if ($comment->BaseClass == $obj->BaseClass && $comment->ParentID == $obj->ParentID) {
                 $alreadyAdded = true;
                 break;
             }
         }
         if (!$alreadyAdded) {
             $baseClass = $comment->BaseClass;
             $baseObject = $baseClass::get()->byID($comment->ParentID);
             if ($baseObject) {
                 // @todo This could return the actual DataObject that we're expecting (e.g. the SiteTree object),
                 // but we can't add the 'CommentUserNotificationUnsubscribeLink' easily to it
                 $allObjects->push(new ArrayData(array('CommentUserNotificationUnsubscribeLink' => Controller::join_links('CommentingController', 'unsubscribenotification', $comment->ID), 'Title' => $baseObject->Title)));
                 $allAddedComments->push($comment);
                 // Keep track of what we've already added
             }
         }
     }
     return $allObjects;
 }
开发者ID:helpfulrobot,项目名称:madmatt-silverstripe-user-comment-notifications,代码行数:45,代码来源:ControllerCommentUserNotificationsExtension.php

示例5: execute

 function execute()
 {
     $return = new stdClass();
     $params = Request::_REQUEST();
     Config::set("HideDebugger", true);
     if (isset($params['id'])) {
         if ($params['id'] == Config::get("Member")->getID()) {
             $return->error = "ID matches logged in ID and cannot delete!";
             echo json_encode($return);
             return;
         }
         $user = new Member($params["id"]);
         if (isset($user) && $user->isValid()) {
             $user->delete();
             $return->id = $params['id'];
             $return->deleted = true;
             echo json_encode($return);
             return;
         } else {
             $return->error = "ID is invalid!";
             echo json_encode($return);
             return;
         }
     } else {
         $return->error = "Missing ID!";
         echo json_encode($return);
         return;
     }
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:29,代码来源:AdminUserDeleteController.class.inc.php

示例6: make_result_table

function make_result_table($user_ids, $signer, $ma_url)
{
    print "<h3>Results</h3>";
    if (count($user_ids) == 0) {
        print "<p>No results found. (warning: no partial matches!)</p>";
    } else {
        print "<table><tr><th>Name</th><th>Username</th><th>Email</th><th>URN</th><th>UUID</th><th>Actions</th></tr>";
        $requester_details = lookup_member_details($ma_url, $signer, $user_ids);
        foreach ($user_ids as $user_id) {
            $user_details = $requester_details[$user_id];
            $username = $user_details[MA_ATTRIBUTE_NAME::USERNAME];
            $member = new Member($user_id);
            $member->init_from_record($user_details);
            $name = $member->prettyName();
            $email = $user_details[MA_ATTRIBUTE_NAME::EMAIL_ADDRESS];
            $urn = $user_details[MA_ATTRIBUTE_NAME::URN];
            $mail_to = "<a href='mailto:{$email}'>{$email}</a>";
            print "<tr><td>{$name}</td><td>{$username}</td><td>{$mail_to}</td><td>{$urn}</td><td>{$user_id}</td>";
            print "<td><button onclick='expand_info(this);'>More info</button>";
            print "<button class='hideinfo' onclick='hide_info(this);' style='display:none;'>Close</button></td></tr>";
            $user_profile_info = get_user_profile_info($user_details, $name, $user_id);
            $user_project_info = get_user_project_info($user_id, $name, $signer);
            $user_slice_info = get_user_slice_info($user_id, $name, $signer);
            print "<tr style='display:none'>";
            print "<td colspan='3' style='vertical-align:top'>{$user_profile_info}</td>";
            print "<td style='vertical-align: top;'>{$user_project_info}</td>";
            print "<td style='vertical-align: top;'>{$user_slice_info}</td>";
            print "<td style='vertical-align: top;'><button onclick='disable_user(\"{$name}\", \"{$urn}\");'>Disable user</button></tr>";
        }
        print "</table>";
    }
}
开发者ID:ahelsing,项目名称:geni-portal,代码行数:32,代码来源:do-user-search.php

示例7: dispLoggedIn

function dispLoggedIn($arrLoginInfo)
{
    global $MAIN_ROOT, $mysqli;
    $memberObj = new Member($mysqli);
    /*
     $arrLoginInfo['memberID'] = $memberID;
    $arrLoginInfo['memberUsername'] = $memberUsername;
    $arrLoginInfo['memberRank'] = $memberRank;
    $arrLoginInfo['pmCID'] = $pmCID;
    $arrLoginInfo['pmCount'] = $dispPMCount;
    */
    $memberInfo = $arrLoginInfo['memberInfo'];
    $memberObj->select($memberInfo['member_id']);
    $dispLoggedinBox = "\n\t\t<div class='loggedInSection'>\n\t\t\t<b>Account Name:</b><br>\n\t\t\t<p>" . $memberObj->getMemberLink() . "</p>\n\t\t\t<div class='dottedLine' style='margin: 5px 0px'></div>\n\t\t\t<b>Rank:</b>\n\t\t\t<p>" . $arrLoginInfo['memberRank'] . "</p>\n\t\t\t<div class='dottedLine' style='margin: 5px 0px'></div>\n\t\t\t<b>Member Options:</b><br>\n\t\t\t<ul class='loggedInMenuList'>\n\t\t\t\t<li><a href='" . $MAIN_ROOT . "members'>My Account</a></li>\n\t\t\t\t<li><a href='" . $MAIN_ROOT . "members/console.php?cID=" . $arrLoginInfo['pmCID'] . "'>PM Inbox " . $arrLoginInfo['pmCountDisp'] . "</a></li>\n\t\t\t\t<li><a href='" . $MAIN_ROOT . "members/signout.php'>Sign Out</a></li>\n\t\t\t</ul>\n\t\t</div>\n\t";
    /*
    	<div class='loggedInIMG'></div>
    	<div class='menuLinks' style='padding-left: 8px'>
    		<b>Account Name:</b><br>
    		<a href='".$MAIN_ROOT."profile.php?mID=".$arrLoginInfo['memberID']."'>".$arrLoginInfo['memberUsername']."</a>
    		<hr style='width: 135px; margin: 6px 1px; padding: 0px; border: dotted whitesmoke 1px'>
    		<b>Rank:</b><br>
    		".$arrLoginInfo['memberRank']."
    		<hr style='width: 135px; margin: 6px 1px; padding: 0px; border: dotted whitesmoke 1px'>
    		<b>Member Options:</b><br>
    		<b>&middot;</b> <a href='".$MAIN_ROOT."members'>My Account</a><br>
    		<b>&middot;</b> <a href='".$MAIN_ROOT."members/console.php?cID=".$arrLoginInfo['pmCID']."'>PM Inbox ".$arrLoginInfo['pmCountDisp']."</a><br>
    		<b>&middot;</b> <a href='".$MAIN_ROOT."members/signout.php'>Sign Out</a><br>		
    	</div>
    
    ";
    */
    return $dispLoggedinBox;
}
开发者ID:bluethrust,项目名称:clanscriptsv4,代码行数:33,代码来源:_logindisplay.php

示例8: createPre

 public function createPre()
 {
     $member = new Member();
     $member->setIsActive(false);
     $member->save();
     return $member;
 }
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:7,代码来源:MemberTable.class.php

示例9: processForm

function processForm()
{
    $requiredFields = array("username", "first_name", "last_name", "email");
    $missingFields = array();
    $errorMessages = array();
    $member = new Member(array("username" => isset($_POST["username"]) ? preg_replace("/[^ \\'\\-a-zA-Z0-9]/", "", $_POST["username"]) : "", "first_name" => isset($_POST["first_name"]) ? preg_replace("/[^ \\'\\-a-zA-Z0-9]/", "", $_POST["first_name"]) : "", "last_name" => isset($_POST["last_name"]) ? preg_replace("/[^ \\'\\-a-zA-Z0-9]/", "", $_POST["last_name"]) : "", "email" => isset($_POST["email"]) ? preg_replace("/[^ \\@\\.\\-\\_a-zA-Z0-9]/", "", $_POST["email"]) : "", "update_timestamp" => date("Y-m-d H:i:s"), "create_timestamp" => date("Y-m-d H:i:s")));
    foreach ($requiredFields as $requiredField) {
        if (!$member->getValue($requiredField)) {
            $missingFields[] = $requiredField;
        }
    }
    if ($missingFields) {
        $errorMessages[] = '<p class="error">There were some missing fields in the form you submitted. Please complete the fields highlighted below and click Send Details to resend the form.</p>';
    }
    if (Member::getByEmailAddress($member->getValue("email"))) {
        $errorMessages[] = '<p class="error">A member with that email address already exists in the database. Please choose another email address, or contact the webmaster to retrieve your password.</p>';
    }
    if ($errorMessages) {
        var_dump($member);
        var_dump($requiredFields);
        var_dump($missingFields);
        displayForm($errorMessages, $missingFields, $member);
    } else {
        $member->insert();
        displayThanks();
    }
}
开发者ID:hoiwanjohnlouis,项目名称:eclipsePrototyping,代码行数:27,代码来源:register.php

示例10: view

 public function view()
 {
     $dao = DAO::getDAO('MemberDAO');
     if (isset($this->params[0]) && trim($this->params[0]) == 'remove') {
         // ex: requesting: /member/delete/2
         $id = trim(sanitizeString($this->params[1]));
         $dao->removeById($id);
     } else {
         if (isset($this->params[0]) && trim($this->params[0]) == 'add') {
             $randNum = mt_rand(0, 99999);
             $newMember = new Member(array('firstName' => 'First', 'lastName' => 'LastName', 'username' => "test{$randNum}", 'email' => "test{$randNum}@example.com", 'createTime' => dbDateTime()));
             // #TODO: implement UserDao.create($newUser) instead.
             if ($dao->countAll() > 30) {
                 // Demo mode: clean up if too many members
                 $dao->execute("DELETE FROM members");
                 $dao->execute("vacuum");
             }
             $dao->insertInto("firstName, lastName, username, email, createTime", $newMember->getFields());
         }
     }
     $members = $dao->getAll();
     $v = $this->smarty;
     $v->assign('title', 'Member List');
     $v->assign('inc_content', v('members.html'));
     $v->assign('members', $users);
     $v->assign('totalMembers', $dao->countAll());
     $this->display($v, v('index.html'));
 }
开发者ID:renduples,项目名称:alibtob,代码行数:28,代码来源:DatabaseTest.php

示例11: onAfterInit

 /**
  * If the REMOTE_USER is set and is in the Member table, log that member in. If
  * not, and Config::inst()->get('AuthRemoteUserExtension', 'auto_create_user') is set, add that
  * Member to the configured group, and log the new user in. Otherwise, do nothing.
  */
 public function onAfterInit()
 {
     if (isset($_SERVER['REMOTE_USER'])) {
         $unique_identifier = $_SERVER['REMOTE_USER'];
     } elseif (isset($_SERVER['REDIRECT_REMOTE_USER'])) {
         $unique_identifier = $_SERVER['REDIRECT_REMOTE_USER'];
     }
     if (isset($unique_identifier)) {
         $unique_identifier_field = Member::config()->unique_identifier_field;
         $member = Member::get()->filter($unique_identifier_field, $unique_identifier)->first();
         if ($member) {
             $member->logIn();
             $this->owner->redirectBack();
         } elseif (Config::inst()->get('AuthRemoteUserExtension', 'auto_create_user') && strlen(Config::inst()->get('AuthRemoteUserExtension', 'auto_user_group'))) {
             $group = Group::get()->filter('Title', Config::inst()->get('AuthRemoteUserExtension', 'auto_user_group'))->first();
             if ($group) {
                 $member = new Member();
                 $member->{$unique_identifier_field} = $unique_identifier;
                 $member->write();
                 $member->Groups()->add($group);
                 $member->logIn();
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:quinninteractive-silverstripe-auth-remote-user,代码行数:30,代码来源:AuthRemoteUserExtension.php

示例12: testAuthenticateByTempID

 /**
  * Test that a member can be authenticated via their temp id
  */
 public function testAuthenticateByTempID()
 {
     $member = new Member();
     $member->Email = 'test1@test.com';
     $member->PasswordEncryption = "sha1";
     $member->Password = "mypassword";
     $member->write();
     // Make form
     $controller = new Security();
     $form = new Form($controller, 'Form', new FieldList(), new FieldList());
     // If the user has never logged in, then the tempid should be empty
     $tempID = $member->TempIDHash;
     $this->assertEmpty($tempID);
     // If the user logs in then they have a temp id
     $member->logIn(true);
     $tempID = $member->TempIDHash;
     $this->assertNotEmpty($tempID);
     // Test correct login
     $result = MemberAuthenticator::authenticate(array('tempid' => $tempID, 'Password' => 'mypassword'), $form);
     $this->assertNotEmpty($result);
     $this->assertEquals($result->ID, $member->ID);
     $this->assertEmpty($form->Message());
     // Test incorrect login
     $form->clearMessage();
     $result = MemberAuthenticator::authenticate(array('tempid' => $tempID, 'Password' => 'notmypassword'), $form);
     $this->assertEmpty($result);
     $this->assertEquals('The provided details don&#039;t seem to be correct. Please try again.', $form->Message());
     $this->assertEquals('bad', $form->MessageType());
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:32,代码来源:MemberAuthenticatorTest.php

示例13: processForm

function processForm($values)
{
    $values["password"] = $values["password1"];
    $values["joinDate"] = date("Y-m-d");
    $member = new Member($values);
    $member->insert();
}
开发者ID:raynaldmo,项目名称:php-education,代码行数:7,代码来源:register.php

示例14: 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;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-traininglistingsandsignup,代码行数:34,代码来源:TrainingSignupForm.php

示例15: authenticate

 /**
  * Performs the login, but will also create and sync the Member record on-the-fly, if not found.
  *
  * @param array $data
  * @param Form $form
  * @return bool|Member|void
  * @throws SS_HTTPResponse_Exception
  */
 public static function authenticate($data, Form $form = null)
 {
     $service = Injector::inst()->get('LDAPService');
     $result = $service->authenticate($data['Username'], $data['Password']);
     $success = $result['success'] === true;
     if (!$success) {
         if ($form) {
             $form->sessionMessage($result['message'], 'bad');
         }
         return;
     }
     $data = $service->getUserByUsername($result['identity']);
     if (!$data) {
         if ($form) {
             $form->sessionMessage(_t('LDAPAuthenticator.PROBLEMFINDINGDATA', 'There was a problem retrieving your user data'), 'bad');
         }
         return;
     }
     // LDAPMemberExtension::memberLoggedIn() will update any other AD attributes mapped to Member fields
     $member = Member::get()->filter('GUID', $data['objectguid'])->limit(1)->first();
     if (!($member && $member->exists())) {
         $member = new Member();
         $member->GUID = $data['objectguid'];
         $member->write();
     }
     Session::clear('BackURL');
     return $member;
 }
开发者ID:andrewandante,项目名称:silverstripe-activedirectory,代码行数:36,代码来源:LDAPAuthenticator.php


注:本文中的Member类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。