本文整理汇总了PHP中ElggUser::getGUID方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggUser::getGUID方法的具体用法?PHP ElggUser::getGUID怎么用?PHP ElggUser::getGUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggUser
的用法示例。
在下文中一共展示了ElggUser::getGUID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_validation_reminder_mail
/**
* Send validation reminder to a specified user with
* some parameters.
*
* @param ElggUser $user User to send the reminder to
* @param int $enddate The end date in a unix timestamp
* @param int $pastdays The days we've passed since the validation
*/
function send_validation_reminder_mail($user, $enddate, $pastdays)
{
$daysleft = $enddate - $pastdays;
$site = elgg_get_site_entity();
$code = uservalidationbyemail_generate_code($user->getGUID(), $user->email);
$link = $site->url . 'uservalidationbyemail/confirm?u=' . $user->getGUID() . '&c=' . $code;
$subject = elgg_echo('validation_reminder:validate:token:subject', array($user->name, $site->name), $user->language);
$body = elgg_echo('validation_reminder:validate:token:body', array($user->name, $pastdays, $site->name, $user->token, $link, $daysleft, $site->name, $site->url), $user->language);
// Send validation email
notify_user($user->guid, $site->guid, $subject, $body, array(), 'email');
}
示例2: is_blocked
/**
* Is $blocked_user blocked by $blocking_user?
*
* @param ElggUser $blocked_user
* @param ElggUser $blocking_user
* @return type bool
*/
function is_blocked(\ElggUser $blocked_user, \ElggUser $blocking_user)
{
if (!$blocked_user instanceof \ElggUser || !$blocking_user instanceof \ElggUser) {
return false;
}
return (bool) check_entity_relationship($blocking_user->getGUID(), 'blocked', $blocked_user->getGUID());
}
示例3: group_tools_invite_user
function group_tools_invite_user(ElggGroup $group, ElggUser $user, $text = "", $resend = false)
{
$result = false;
if (!empty($user) && $user instanceof ElggUser && !empty($group) && $group instanceof ElggGroup && ($loggedin_user = elgg_get_logged_in_user_entity())) {
// Create relationship
$relationship = add_entity_relationship($group->getGUID(), "invited", $user->getGUID());
if ($relationship || $resend) {
// Send email
$url = elgg_get_site_url() . "groups/invitations/" . $user->username;
$subject = elgg_echo("groups:invite:subject", array($user->name, $group->name));
$msg = elgg_echo("group_tools:groups:invite:body", array($user->name, $loggedin_user->name, $group->name, $text, $url));
if ($res = notify_user($user->getGUID(), $group->getOwnerGUID(), $subject, $msg)) {
$result = true;
}
}
}
return $result;
}
示例4: customizations_purge_messages
/**
* Delete messages from a user who is being deleted
*
* @param string $event
* @param string $type
* @param ElggUser $user
*/
function customizations_purge_messages($event, $type, $user)
{
// make sure we delete them all
$entity_disable_override = access_get_show_hidden_status();
access_show_hidden_entities(true);
$messages = elgg_get_entities_from_metadata(array('type' => 'object', 'subtype' => 'messages', 'metadata_name' => 'fromId', 'metadata_value' => $user->getGUID(), 'limit' => 0));
if ($messages) {
foreach ($messages as $e) {
$e->delete();
}
}
access_show_hidden_entities($entity_disable_override);
}
示例5: publication_login_check
/**
* Updates author's list when an invited author registers
*
* @param string $event
* @param string $object_type
* @param ElggUser $object
*/
function publication_login_check($event, $object_type, $object)
{
if (empty($object->firstpublication) || empty($object->exauthor_name)) {
return;
}
$exauthor_name = $object->exauthor_name;
$pub = get_entity($object->firstpublication);
if (empty($pub) || !$pub instanceof Publication) {
return;
}
add_entity_relationship($pub->getGUID(), 'author', $object->getGUID());
unset($object->firstpubication);
unset($object->exauthor_name);
$authors = $pub->authors;
$authors = explode(',', $authors);
foreach ($authors as $key => $value) {
if ($value == $exauthor_name) {
$authors[$key] = $object->getGUID();
}
}
$authors = implode(',', $authors);
$pub->authors = $authors;
}
示例6: __construct
/**
* Create a notification event
*
* @param \ElggData $object The object of the event (\ElggEntity)
* @param string $action The name of the action (default: create)
* @param \ElggUser $actor The user that caused the event (default: logged in user)
*
* @throws \InvalidArgumentException
*/
public function __construct(\ElggData $object, $action, \ElggUser $actor = null)
{
if (elgg_instanceof($object)) {
$this->object_type = $object->getType();
$this->object_subtype = $object->getSubtype();
$this->object_id = $object->getGUID();
} else {
$this->object_type = $object->getType();
$this->object_subtype = $object->getSubtype();
$this->object_id = $object->id;
}
if ($actor == null) {
$this->actor_guid = _elgg_services()->session->getLoggedInUserGuid();
} else {
$this->actor_guid = $actor->getGUID();
}
$this->action = $action;
}
示例7: __construct
/**
* Create a notification event
*
* @param \ElggData $object The object of the event (\ElggEntity)
* @param string $action The name of the action (default: create)
* @param \ElggUser $actor The user that caused the event (default: logged in user)
*
* @throws \InvalidArgumentException
*/
public function __construct(\ElggData $object, $action, \ElggUser $actor = null)
{
if (elgg_instanceof($object)) {
$this->object_type = $object->getType();
$this->object_subtype = $object->getSubtype();
$this->object_id = $object->getGUID();
} else {
$this->object_type = $object->getType();
$this->object_subtype = $object->getSubtype();
$this->object_id = $object->id;
}
if ($actor == null) {
$this->actor_guid = elgg_get_logged_in_user_guid();
} else {
$this->actor_guid = $actor->getGUID();
}
$this->action = $action;
}
示例8: __construct
/**
* Create a notification event
*
* @param ElggData $object The object of the event (ElggEntity, ElggAnnotation, ElggRelationship)
* @param string $action The name of the action (default: create)
* @param ElggUser $actor The user that caused the event (default: logged in user)
* @throws InvalidArgumentException
*/
public function __construct($object, $action, $actor = null)
{
if (!$object instanceof ElggData) {
throw new InvalidArgumentException('$object is not an instance of ElggData');
}
if (elgg_instanceof($object)) {
$this->object_type = $object->getType();
$this->object_subtype = $object->getSubtype();
$this->object_id = $object->getGUID();
} else {
$this->object_type = $object->getType();
$this->object_subtype = $object->getSubtype();
$this->object_id = $object->id;
}
if ($actor == null) {
$this->actor_guid = elgg_get_logged_in_user_guid();
} else {
$this->actor_guid = $actor->getGUID();
}
$this->action = $action;
}
示例9: notificationsEnabledForGroup
/**
* Check if the user is receiving notifications from the group
*
* @param \ElggUser $user the user to check
* @param \ElggGroup $group the group to check for
*
* @return bool
*/
public static function notificationsEnabledForGroup(\ElggUser $user, \ElggGroup $group)
{
if (!$user instanceof \ElggUser || !$group instanceof \ElggGroup) {
return false;
}
$subscriptions = elgg_get_subscriptions_for_container($group->getGUID());
if (!is_array($subscriptions)) {
return false;
}
if (!empty($subscriptions[$user->getGUID()])) {
return true;
}
return false;
}
示例10: has_access_to_entity
/**
* Can a user access an entity.
*
* @warning If a logged in user doesn't have access to an entity, the
* core engine will not load that entity.
*
* @tip This is mostly useful for checking if a user other than the logged in
* user has access to an entity that is currently loaded.
*
* @todo This function would be much more useful if we could pass the guid of the
* entity to test access for. We need to be able to tell whether the entity exists
* and whether the user has access to the entity.
*
* @param ElggEntity $entity The entity to check access for.
* @param ElggUser $user Optionally user to check access for. Defaults to
* logged in user (which is a useless default).
*
* @return bool
* @link http://docs.elgg.org/Access
*/
function has_access_to_entity($entity, $user = null)
{
global $CONFIG;
if (!isset($user)) {
$access_bit = get_access_sql_suffix("e");
} else {
$access_bit = get_access_sql_suffix("e", $user->getGUID());
}
$query = "SELECT guid from {$CONFIG->dbprefix}entities e WHERE e.guid = " . $entity->getGUID();
// Add access controls
$query .= " AND " . $access_bit;
if (get_data($query)) {
return true;
} else {
return false;
}
}
示例11: twitter_api_update_user_avatar
/**
* Pull in the latest avatar from twitter.
*
* @param ElggUser $user
* @param string $file_location
*/
function twitter_api_update_user_avatar($user, $file_location)
{
// twitter's images have a few suffixes:
// _normal
// _reasonably_small
// _mini
// the twitter app here returns _normal. We want standard, so remove the suffix.
// @todo Should probably check that it's an image file.
$file_location = str_replace('_normal.jpg', '.jpg', $file_location);
$icon_sizes = elgg_get_config('icon_sizes');
$filehandler = new ElggFile();
$filehandler->owner_guid = $user->getGUID();
foreach ($icon_sizes as $size => $dimensions) {
$image = get_resized_image_from_existing_file($file_location, $dimensions['w'], $dimensions['h'], $dimensions['square']);
$filehandler->setFilename("profile/{$user->guid}{$size}.jpg");
$filehandler->open('write');
$filehandler->write($image);
$filehandler->close();
}
// update user's icontime
$user->icontime = time();
}
示例12: owner_gatekeeper_match_group
/**
* Check if page owner and user are a member of the same group
*
* @param ElggUser $page_owner the current page owner
* @param ElggUser $user the user to check with
*
* @return bool
*/
function owner_gatekeeper_match_group(ElggUser $page_owner, ElggUser $user)
{
if (!$page_owner instanceof ElggUser || !$user instanceof ElggUser) {
return false;
}
$options = ['type' => 'group', 'limit' => false, 'callback' => function ($row) {
return (int) $row->guid;
}, 'relationship' => 'member', 'relationship_guid' => $page_owner->getGUID()];
// page owners groups
$page_owner_group_guids = elgg_get_entities_from_relationship($options);
// users groups
$options['relationship_guid'] = $user->getGUID();
$user_group_guids = elgg_get_entities_from_relationship($options);
// same groups
$matching_guids = array_intersect($page_owner_group_guids, $user_group_guids);
return !empty($matching_guids);
}
示例13: group_tools_get_membership_information
/**
* Get the time_created from the group membership relation
*
* @param ElggUser $user the user to check
* @param ElggGroup $group the group to check
*
* @return int
*/
function group_tools_get_membership_information(ElggUser $user, ElggGroup $group)
{
$result = 0;
if (!empty($user) && !empty($group)) {
$query = "SELECT *";
$query .= " FROM " . elgg_get_config("dbprefix") . "entity_relationships";
$query .= " WHERE guid_one = " . $user->getGUID();
$query .= " AND guid_two = " . $group->getGUID();
$query .= " AND relationship = 'member'";
$row = get_data_row($query);
if (!empty($row)) {
$result = $row->time_created;
}
}
return $result;
}
示例14: uservalidationbyemail_check_manual_login
/**
* Prevent a manual code login with login().
*
* @param string $event
* @param string $type
* @param ElggUser $user
* @return bool
*
* @throws LoginException
*/
function uservalidationbyemail_check_manual_login($event, $type, $user)
{
$access_status = access_get_show_hidden_status();
access_show_hidden_entities(TRUE);
if ($user instanceof ElggUser && !$user->isEnabled() && !$user->validated) {
// send new validation email
uservalidationbyemail_request_validation($user->getGUID());
// restore hidden entities settings
access_show_hidden_entities($access_status);
// throw error so we get a nice error message
throw new LoginException(elgg_echo('uservalidationbyemail:login:fail'));
}
access_show_hidden_entities($access_status);
}
示例15: subsite_manager_get_invited_subsites
function subsite_manager_get_invited_subsites(ElggUser $user)
{
$result = false;
if (!empty($user) && $user instanceof Elgguser) {
// based on email adres
$options = array("type" => "site", "subtype" => Subsite::SUBTYPE, "limit" => false, "site_guids" => false, "joins" => array("JOIN " . elgg_get_config("dbprefix") . "private_settings s ON e.guid = s.entity_guid"), "wheres" => array("(s.name = 'membership_invitation' AND s.value LIKE '%" . sanitise_string($user->email) . "%')"));
$subsites_email = elgg_get_entities($options);
// based on relationship
$options = array("type" => "site", "subtype" => Subsite::SUBTYPE, "limit" => false, "site_guids" => false, "relationship" => "membership_invitation", "relationship_guid" => $user->getGUID());
$subsites_relations = elgg_get_entities_from_relationship($options);
// make result
if (!empty($subsites_email) && !empty($subsites_relations)) {
$result = array_merge($subsites_email, $subsites_relations);
} elseif (!empty($subsites_email)) {
$result = $subsites_email;
} elseif (!empty($subsites_relations)) {
$result = $subsites_relations;
}
}
return $result;
}