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


PHP User_group::getByID方法代码示例

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


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

示例1: join

 /**
  * Method to add a user to a group.
  * In most cases, you should call Profile->joinGroup() instead.
  *
  * @param integer $group_id   Group to add to
  * @param integer $profile_id Profile being added
  * 
  * @return Group_member new membership object
  */
 static function join($group_id, $profile_id)
 {
     $member = new Group_member();
     $member->group_id = $group_id;
     $member->profile_id = $profile_id;
     $member->created = common_sql_now();
     $member->uri = self::newUri(Profile::getByID($profile_id), User_group::getByID($group_id), $member->created);
     $result = $member->insert();
     if (!$result) {
         common_log_db_error($member, 'INSERT', __FILE__);
         // TRANS: Exception thrown when joining a group fails.
         throw new Exception(_("Group join failed."));
     }
     return $member;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:24,代码来源:Group_member.php

示例2: figureOutScope

 public static function figureOutScope(Profile $actor, array $groups, $scope = null)
 {
     $scope = is_null($scope) ? self::defaultScope() : intval($scope);
     // For private streams
     try {
         $user = $actor->getUser();
         // FIXME: We can't do bit comparison with == (Legacy StatusNet thing. Let's keep it for now.)
         if ($user->private_stream && ($scope === Notice::PUBLIC_SCOPE || $scope === Notice::SITE_SCOPE)) {
             $scope |= Notice::FOLLOWER_SCOPE;
         }
     } catch (NoSuchUserException $e) {
         // TODO: Not a local user, so we don't know about scope preferences... yet!
     }
     // Force the scope for private groups
     foreach ($groups as $group_id) {
         try {
             $group = User_group::getByID($group_id);
             if ($group->force_scope) {
                 $scope |= Notice::GROUP_SCOPE;
                 break;
             }
         } catch (Exception $e) {
             common_log(LOG_ERR, 'Notice figureOutScope threw exception: ' . $e->getMessage());
         }
     }
     return $scope;
 }
开发者ID:a780201,项目名称:gnu-social,代码行数:27,代码来源:Notice.php

示例3: initGroupMemberURI

function initGroupMemberURI()
{
    printfnq("Ensuring all group memberships have a URI...");
    $mem = new Group_member();
    $mem->whereAdd('uri IS NULL');
    if ($mem->find()) {
        while ($mem->fetch()) {
            try {
                $mem->decache();
                $mem->query(sprintf('update group_member set uri = "%s" ' . 'where profile_id = %d ' . 'and group_id = %d ', Group_member::newUri(Profile::getByID($mem->profile_id), User_group::getByID($mem->group_id), $mem->created), $mem->profile_id, $mem->group_id));
            } catch (Exception $e) {
                common_log(LOG_ERR, "Error updated membership URI: " . $e->getMessage());
            }
        }
    }
    printfnq("DONE.\n");
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:17,代码来源:upgrade.php

示例4: doPreparation

 protected function doPreparation()
 {
     $this->group = User_group::getByID($this->arg('id'));
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:4,代码来源:groupbyid.php


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