本文整理汇总了PHP中ElggGroup::getOwnerGUID方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggGroup::getOwnerGUID方法的具体用法?PHP ElggGroup::getOwnerGUID怎么用?PHP ElggGroup::getOwnerGUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggGroup
的用法示例。
在下文中一共展示了ElggGroup::getOwnerGUID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: group_tools_add_user
function group_tools_add_user(ElggGroup $group, ElggUser $user, $text = "")
{
$result = false;
if (!empty($user) && $user instanceof ElggUser && !empty($group) && $group instanceof ElggGroup && ($loggedin_user = elgg_get_logged_in_user_entity())) {
if ($group->join($user)) {
// Remove any invite or join request flags
remove_entity_relationship($group->getGUID(), "invited", $user->getGUID());
remove_entity_relationship($user->getGUID(), "membership_request", $group->getGUID());
// notify user
$subject = elgg_echo("group_tools:groups:invite:add:subject", array($group->name));
$msg = elgg_echo("group_tools:groups:invite:add:body", array($user->name, $loggedin_user->name, $group->name, $text, $group->getURL()));
if (notify_user($user->getGUID(), $group->getOwnerGUID(), $subject, $msg)) {
$result = true;
}
}
}
return $result;
}
示例2: 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'));
}
}
}
示例3: group_tools_add_user
/**
* Add a user to a group
*
* @param ElggGroup $group the group to add the user to
* @param ElggUser $user the user to be added
* @param string $text (optional) extra text for the notification
*
* @return boolean true if successfull
*/
function group_tools_add_user(ElggGroup $group, ElggUser $user, $text = "")
{
$result = false;
$loggedin_user = elgg_get_logged_in_user_entity();
if (!empty($user) && $user instanceof ElggUser && !empty($group) && $group instanceof ElggGroup && !empty($loggedin_user)) {
// make sure all goes well
$ia = elgg_set_ignore_access(true);
if ($group->join($user)) {
// Remove any invite or join request flags
remove_entity_relationship($group->getGUID(), "invited", $user->getGUID());
remove_entity_relationship($user->getGUID(), "membership_request", $group->getGUID());
// notify user
$subject = elgg_echo("group_tools:groups:invite:add:subject", array($group->name));
$msg = elgg_echo("group_tools:groups:invite:add:body", array($user->name, $loggedin_user->name, $group->name, $text, $group->getURL()));
$params = array("group" => $group, "inviter" => $loggedin_user, "invitee" => $user);
$msg = elgg_trigger_plugin_hook("invite_notification", "group_tools", $params, $msg);
if (notify_user($user->getGUID(), $group->getOwnerGUID(), $subject, $msg, array(), "email")) {
$result = true;
}
}
// restore access
elgg_set_ignore_access($ia);
}
return $result;
}
示例4: foreach
$thumb->setMimeType('image/jpeg');
foreach ($sizes as $size) {
$thumb->setFilename("{$prefix}{$size}.jpg");
$thumb->open("write");
$thumb->write($thumbs[$size]);
$thumb->close();
}
$group->icontime = time();
}
}
// owner transfer
$old_owner_guid = $is_new_group ? 0 : $group->owner_guid;
$new_owner_guid = (int) get_input('owner_guid');
if (!$is_new_group && $new_owner_guid && $new_owner_guid != $old_owner_guid) {
// who can transfer
$admin_transfer = elgg_get_plugin_setting("admin_transfer", "group_tools");
$transfer_allowed = false;
if ($admin_transfer == "admin" && elgg_is_admin_logged_in()) {
$transfer_allowed = true;
} elseif ($admin_transfer == "owner" && ($group->getOwnerGUID() == $user->getGUID() || elgg_is_admin_logged_in())) {
$transfer_allowed = true;
}
if ($transfer_allowed) {
// get the new owner
$new_owner = get_user($new_owner_guid);
// transfer the group to the new owner
group_tools_transfer_group_ownership($group, $new_owner);
}
}
system_message(elgg_echo("groups:saved"));
forward($group->getUrl());
示例5: 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'));
}
}
}
示例6: group_tools_can_assign_group_admin
/**
* Check if the group allows admins (not owner) to assign other admins
*
* @param ElggGroup $group the group to check
*
* @return bool
*/
function group_tools_can_assign_group_admin(ElggGroup $group)
{
if (!$group instanceof ElggGroup) {
return false;
}
$user_guid = elgg_get_logged_in_user_guid();
if (empty($user_guid)) {
return false;
}
if (!group_tools_multiple_admin_enabled()) {
return false;
}
if ($group->getOwnerGUID() === $user_guid || elgg_is_admin_logged_in()) {
return true;
} elseif ($group->group_multiple_admin_allow_enable === 'yes' && $group->canEdit($user_guid)) {
return true;
}
return false;
}