当前位置: 首页>>代码示例>>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;未经允许,请勿转载。