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


PHP ElggGroup::isMember方法代码示例

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


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

示例1: groups_register_profile_buttons

/**
 * Registers the buttons for title area of the group profile page
 *
 * @param ElggGroup $group
 */
function groups_register_profile_buttons($group)
{
    $actions = array();
    // group owners
    if ($group->canEdit()) {
        // edit and invite
        $url = elgg_get_site_url() . "groups/edit/{$group->getGUID()}";
        $actions[$url] = 'groups:edit';
        $url = elgg_get_site_url() . "groups/invite/{$group->getGUID()}";
        $actions[$url] = 'groups:invite';
    }
    // group members
    if ($group->isMember(elgg_get_logged_in_user_entity())) {
        if ($group->getOwnerGUID() != elgg_get_logged_in_user_guid()) {
            // leave
            $url = elgg_get_site_url() . "action/groups/leave?group_guid={$group->getGUID()}";
            $url = elgg_add_action_tokens_to_url($url);
            $actions[$url] = 'groups:leave';
        }
    } elseif (elgg_is_logged_in()) {
        // join - admins can always join.
        $url = elgg_get_site_url() . "action/groups/join?group_guid={$group->getGUID()}";
        $url = elgg_add_action_tokens_to_url($url);
        if ($group->isPublicMembership() || $group->canEdit()) {
            $actions[$url] = 'groups:join';
        } else {
            // request membership
            $actions[$url] = 'groups:joinrequest';
        }
    }
    if ($actions) {
        foreach ($actions as $url => $text) {
            elgg_register_menu_item('title', array('name' => $text, 'href' => $url, 'text' => elgg_echo($text), 'link_class' => 'elgg-button elgg-button-action'));
        }
    }
}
开发者ID:thehereward,项目名称:Elgg,代码行数:41,代码来源:groups.php

示例2: foreach

    }
}
// Group membership - should these be treated with same constants as access permissions?
$is_public_membership = get_input('membership') == ACCESS_PUBLIC;
$group->membership = $is_public_membership ? ACCESS_PUBLIC : ACCESS_PRIVATE;
$group->setContentAccessMode(get_input('content_access_mode'));
if ($is_new_group) {
    $group->access_id = ACCESS_PUBLIC;
}
$old_owner_guid = $is_new_group ? 0 : $group->owner_guid;
$new_owner_guid = (int) get_input('owner_guid');
$owner_has_changed = false;
$old_icontime = null;
if (!$is_new_group && $new_owner_guid && $new_owner_guid != $old_owner_guid) {
    // verify new owner is member and old owner/admin is logged in
    if ($group->isMember(get_user($new_owner_guid)) && ($old_owner_guid == $user->guid || $user->isAdmin())) {
        $group->owner_guid = $new_owner_guid;
        $group->container_guid = $new_owner_guid;
        $metadata = elgg_get_metadata(array('guid' => $group_guid, 'limit' => false));
        if ($metadata) {
            foreach ($metadata as $md) {
                if ($md->owner_guid == $old_owner_guid) {
                    $md->owner_guid = $new_owner_guid;
                    $md->save();
                }
            }
        }
        // @todo Remove this when #4683 fixed
        $owner_has_changed = true;
        $old_icontime = $group->icontime;
    }
开发者ID:tjcaverly,项目名称:Elgg,代码行数:31,代码来源:edit.php

示例3: foreach

//$dgroup->pages_enable = get_input('pages_enable', 'yes');
//$dgroup->forum_enable = get_input('forum_enable', 'yes');
// Set dgroup tool options
if (isset($CONFIG->dgroup_tool_options)) {
    foreach ($CONFIG->dgroup_tool_options as $dgroup_option) {
        $dgroup_option_toggle_name = $dgroup_option->name . "_enable";
        if ($dgroup_option->default_on) {
            $dgroup_option_default_value = 'yes';
        } else {
            $dgroup_option_default_value = 'no';
        }
        $dgroup->{$dgroup_option_toggle_name} = get_input($dgroup_option_toggle_name, $dgroup_option_default_value);
    }
}
$dgroup->save();
if (!$dgroup->isMember($user)) {
    $dgroup->join($user);
}
// Creator always a member
// Now see if we have a file icon
if (isset($_FILES['icon']) && substr_count($_FILES['icon']['type'], 'image/')) {
    $prefix = "dgroups/" . $dgroup->guid;
    $filehandler = new ElggFile();
    $filehandler->owner_guid = $dgroup->owner_guid;
    $filehandler->setFilename($prefix . ".jpg");
    $filehandler->open("write");
    $filehandler->write(get_uploaded_file('icon'));
    $filehandler->close();
    $thumbtiny = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(), 25, 25, true);
    $thumbsmall = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(), 40, 40, true);
    $thumbmedium = get_resized_image_from_existing_file($filehandler->getFilenameOnFilestore(), 100, 100, true);
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:edit.php

示例4: groups_register_profile_buttons

/**
 * Registers the buttons for title area of the group profile page
 *
 * @param ElggGroup $group
 */
function groups_register_profile_buttons($group)
{
    $user = elgg_get_logged_in_user_entity();
    $actions = array();
    // group owners
    if ($group->canEdit()) {
        // local groups except town groups cannot be edited (except by admins)
        if ($group->grouptype != 'local' || $group->grouptype == 'local' && $group->localtype == 'town' || $user->isAdmin()) {
            $url = elgg_get_site_url() . "groups/edit/{$group->getGUID()}";
            $actions[$url] = 'groups:edit';
        }
        // local groups except town groups cannot use invitation system
        if ($group->grouptype != 'local' || $group->grouptype == 'local' && $group->localtype == 'town') {
            $url = elgg_get_site_url() . "groups/invite/{$group->getGUID()}";
            $actions[$url] = 'groups:invite';
        }
    }
    // add a button to allow adding town groups (only for group members)
    if ($group->grouptype == 'local' && $group->localtype == 'departemental' && $group->isMember(elgg_get_logged_in_user_entity())) {
        $url = elgg_get_site_url() . "groups/local/add/{$group->getGUID()}";
        $actions[$url] = 'localgroups:addtown';
    }
    // group members (not for local groups except town group)
    if ($group->grouptype == 'local' && $group->localtype == 'town' || $group->grouptype != 'local') {
        if ($group->isMember(elgg_get_logged_in_user_entity())) {
            if ($group->getOwnerGUID() != elgg_get_logged_in_user_guid()) {
                // leave
                $url = elgg_get_site_url() . "action/groups/leave?group_guid={$group->getGUID()}";
                $url = elgg_add_action_tokens_to_url($url);
                $actions[$url] = 'groups:leave';
            }
        } elseif (elgg_is_logged_in()) {
            // join - admins can always join.
            $url = elgg_get_site_url() . "action/groups/join?group_guid={$group->getGUID()}";
            $url = elgg_add_action_tokens_to_url($url);
            if ($group->isPublicMembership() || $group->canEdit()) {
                $actions[$url] = 'groups:join';
            } else {
                // request membership
                $actions[$url] = 'groups:joinrequest';
            }
        }
    }
    if ($actions) {
        foreach ($actions as $url => $text) {
            elgg_register_menu_item('title', array('name' => $text, 'href' => $url, 'text' => elgg_echo($text), 'link_class' => 'elgg-button elgg-button-action'));
        }
    }
}
开发者ID:remy40,项目名称:gvrs,代码行数:54,代码来源:groups.php

示例5: event_manager_can_create_group_events

/**
 * Checks if a certain user can create group events
 *
 * @param $group Group to check rights for
 * @param $user  User to check rights for
 *
 * @return bool
 */
function event_manager_can_create_group_events(\ElggGroup $group, $user = null)
{
    if (empty($user)) {
        $user = elgg_get_logged_in_user_entity();
    }
    if (!$group instanceof \ElggGroup || !$user instanceof \ElggUser) {
        return false;
    }
    $who_create_group_events = elgg_get_plugin_setting('who_create_group_events', 'event_manager');
    // group_admin, members
    switch ($who_create_group_events) {
        case 'group_admin':
            return $group->canEdit($user->guid);
        case 'members':
            if ($group->isMember($user)) {
                return true;
            } else {
                return $group->canEdit($user->guid);
            }
    }
    return false;
}
开发者ID:coldtrick,项目名称:event_manager,代码行数:30,代码来源:functions.php

示例6: group_tools_group_mail_members_enabled

/**
 * Check if group mail is enabled for members
 *
 * @param ElggGroup $group The group to check (can be empty to check plugin setting)
 *
 * @return bool
 */
function group_tools_group_mail_members_enabled(ElggGroup $group = null)
{
    static $mail_members_enabled;
    if (!isset($mail_members_enabled)) {
        $mail_members_enabled = false;
        $setting = elgg_get_plugin_setting('mail_members', 'group_tools');
        if ($setting === 'yes') {
            $mail_members_enabled = true;
        }
    }
    // quick return if mail members is not allowed
    if (!group_tools_group_mail_enabled()) {
        return false;
    }
    if (!$mail_members_enabled) {
        return false;
    }
    if (empty($group) || !$group instanceof ElggGroup) {
        return true;
    }
    if ($group->canEdit()) {
        // group owners and admin can mail
        return true;
    }
    if ($group->isMember() && $group->mail_members_enable === 'yes') {
        return true;
    }
    return false;
}
开发者ID:coldtrick,项目名称:group_tools,代码行数:36,代码来源:functions.php


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