當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Group_member::delete方法代碼示例

本文整理匯總了PHP中Group_member::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group_member::delete方法的具體用法?PHP Group_member::delete怎麽用?PHP Group_member::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Group_member的用法示例。


在下文中一共展示了Group_member::delete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: blockProfile

 static function blockProfile($group, $profile, $blocker)
 {
     // Insert the block
     $block = new Group_block();
     $block->query('BEGIN');
     $block->group_id = $group->id;
     $block->blocked = $profile->id;
     $block->blocker = $blocker->id;
     $result = $block->insert();
     if (!$result) {
         common_log_db_error($block, 'INSERT', __FILE__);
         return null;
     }
     // Delete membership if any
     $member = new Group_member();
     $member->group_id = $group->id;
     $member->profile_id = $profile->id;
     if ($member->find(true)) {
         $result = $member->delete();
         if (!$result) {
             common_log_db_error($member, 'DELETE', __FILE__);
             return null;
         }
     }
     // Commit, since both have been done
     $block->query('COMMIT');
     return $block;
 }
開發者ID:himmelex,項目名稱:NTW,代碼行數:28,代碼來源:Group_block.php

示例2: handle

 /**
  * Handle the request
  *
  * Save the new message
  *
  * @param array $args $_REQUEST data (unused)
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         $this->clientError(_('This method requires a POST.'), 400, $this->format);
         return;
     }
     if (empty($this->user)) {
         $this->clientError(_('No such user.'), 404, $this->format);
         return;
     }
     if (empty($this->group)) {
         $this->clientError(_('Group not found.'), 404, $this->format);
         return false;
     }
     $member = new Group_member();
     $member->group_id = $this->group->id;
     $member->profile_id = $this->auth_user->id;
     if (!$member->find(true)) {
         $this->serverError(_('You are not a member of this group.'));
         return;
     }
     $result = $member->delete();
     if (!$result) {
         common_log_db_error($member, 'DELETE', __FILE__);
         $this->serverError(sprintf(_('Could not remove user %1$s from group %2$s.'), $this->user->nickname, $this->group->nickname));
         return;
     }
     switch ($this->format) {
         case 'xml':
             $this->showSingleXmlGroup($this->group);
             break;
         case 'json':
             $this->showSingleJsonGroup($this->group);
             break;
         default:
             $this->clientError(_('API method not found.'), 404, $this->format);
             break;
     }
 }
開發者ID:Br3nda,項目名稱:StatusNet,代碼行數:49,代碼來源:apigroupleave.php

示例3: handle

 /**
  * Handle the request
  *
  * On POST, add the current user to the group
  *
  * @param array $args unused
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     $cur = common_current_user();
     $member = new Group_member();
     $member->group_id = $this->group->id;
     $member->profile_id = $cur->id;
     if (!$member->find(true)) {
         $this->serverError(_('Could not find membership record.'));
         return;
     }
     $result = $member->delete();
     if (!$result) {
         common_log_db_error($member, 'INSERT', __FILE__);
         $this->serverError(sprintf(_('Could not remove user %s to group %s'), $cur->nickname, $this->group->nickname));
     }
     if ($this->boolean('ajax')) {
         $this->startHTML('text/xml;charset=utf-8');
         $this->elementStart('head');
         $this->element('title', null, sprintf(_('%s left group %s'), $cur->nickname, $this->group->nickname));
         $this->elementEnd('head');
         $this->elementStart('body');
         $jf = new JoinForm($this, $this->group);
         $jf->show();
         $this->elementEnd('body');
         $this->elementEnd('html');
     } else {
         common_redirect(common_local_url('groupmembers', array('nickname' => $this->group->nickname)));
     }
 }
開發者ID:Br3nda,項目名稱:laconica,代碼行數:39,代碼來源:leavegroup.php


注:本文中的Group_member::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。