本文整理汇总了PHP中get_loggedin_userid函数的典型用法代码示例。如果您正苦于以下问题:PHP get_loggedin_userid函数的具体用法?PHP get_loggedin_userid怎么用?PHP get_loggedin_userid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_loggedin_userid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: odt_editor_page_handler
/**
* Dispatches odt_editor pages.
* URLs take the form of
* Save as: odt_editor/saveas/<guid>
*
* @param array $page
* @return bool
*/
function odt_editor_page_handler($page)
{
$odt_editor_pages_dir = elgg_get_plugins_path() . 'odt_editor/pages';
$page_type = $page[0];
switch ($page_type) {
case 'saveas':
set_input('guid', $page[1]);
include "{$odt_editor_pages_dir}/odt_editor/saveas.php";
break;
case 'create':
$container = get_entity($page[1]);
if (!$container) {
$container = get_loggedin_userid();
}
// show new document in WebODF editor page
// 0 as indicator for new document
set_input('guid', 0);
set_input('container_guid', $page[1]);
include "{$odt_editor_pages_dir}/file/odt_editor.php";
$result = false;
break;
case 'gettemplate':
include "{$odt_editor_pages_dir}/odt_editor/gettemplate.php";
break;
default:
return false;
}
return true;
}
示例2: blog_get_page_content_read
/**
* Returns HTML for a blog post.
*
* @param int $guid of a blog entity.
* @return string html
*/
function blog_get_page_content_read($owner_guid = NULL, $guid = NULL)
{
$content = elgg_view('page_elements/content_header', array('context' => $context, 'type' => 'blog'));
if ($guid) {
$blog = get_entity($guid);
if (!elgg_instanceof($blog, 'object', 'blog') && $blog->status == 'final') {
$content .= elgg_echo('blog:error:post_not_found');
} else {
elgg_push_breadcrumb($blog->title, $blog->getURL());
$content .= elgg_view_entity($blog, TRUE);
}
} else {
$options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => FALSE, 'order_by_metadata' => array('name' => 'publish_date', 'direction' => 'DESC', 'as' => 'int'));
if ($owner_guid) {
$options['owner_guid'] = $owner_guid;
}
// show all posts for admin or users looking at their own blogs
// show only published posts for other users.
if (!(isadminloggedin() || isloggedin() && $owner_guid == get_loggedin_userid())) {
$options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published'), array('name' => 'publish_date', 'operand' => '<', 'value' => time()));
}
$content .= elgg_list_entities_from_metadata($options);
}
return array('content' => $content);
}
示例3: getUnreadMessages
function getUnreadMessages()
{
$userId = get_loggedin_userid();
$limit = 5;
// Get the user's inbox, this will be all messages where the 'toId' field matches their guid
$messages = get_entities_from_metadata_multi(array("toId" => $userId, "readYet" => 0), "object", "messages", $userId, $limit, 0);
return $messages;
}
示例4: testElggEntityAttributes
/**
* Tests the protected attributes
*/
public function testElggEntityAttributes()
{
$test_attributes = array();
$test_attributes['guid'] = '';
$test_attributes['type'] = '';
$test_attributes['subtype'] = '';
$test_attributes['owner_guid'] = get_loggedin_userid();
$test_attributes['container_guid'] = get_loggedin_userid();
$test_attributes['site_guid'] = 0;
$test_attributes['access_id'] = ACCESS_PRIVATE;
$test_attributes['time_created'] = '';
$test_attributes['time_updated'] = '';
$test_attributes['enabled'] = 'yes';
$test_attributes['tables_split'] = 1;
$test_attributes['tables_loaded'] = 0;
$this->assertIdentical($this->entity->expose_attributes(), $test_attributes);
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:20,代码来源:entities.php
示例5: groups_from_members_submenus
function groups_from_members_submenus()
{
global $CONFIG;
$page_owner = page_owner_entity();
// Submenu items for all group pages
if ($page_owner instanceof ElggGroup && get_context() == 'groups' && get_loggedin_userid() != $page_owner->getOwner()) {
if (isloggedin() && !isadminloggedin()) {
$context = get_context();
set_context('groupsfrommembers');
if ($page_owner->canEdit()) {
add_submenu_item(elgg_echo('groups:invite'), $CONFIG->wwwroot . "mod/groupsfrommembers/invite.php?group_guid={$page_owner->getGUID()}", '1groupsactions');
if (!$page_owner->isPublicMembership()) {
add_submenu_item(elgg_echo('groups:membershiprequests'), $CONFIG->wwwroot . "mod/groups/membershipreq.php?group_guid={$page_owner->getGUID()}", '1groupsactions');
}
}
set_context($context);
}
}
}
示例6: testElggSiteConstructor
/**
* A basic test that will be called and fail.
*/
public function testElggSiteConstructor()
{
$attributes = array();
$attributes['guid'] = '';
$attributes['type'] = 'site';
$attributes['subtype'] = '';
$attributes['owner_guid'] = get_loggedin_userid();
$attributes['container_guid'] = get_loggedin_userid();
$attributes['site_guid'] = 0;
$attributes['access_id'] = ACCESS_PRIVATE;
$attributes['time_created'] = '';
$attributes['time_updated'] = '';
$attributes['enabled'] = 'yes';
$attributes['tables_split'] = 2;
$attributes['tables_loaded'] = 0;
$attributes['name'] = '';
$attributes['description'] = '';
$attributes['url'] = '';
$this->assertIdentical($this->site->expose_attributes(), $attributes);
}
示例7: gatekeeper
<?php
/**
* Join a group action.
*
* @package ElggGroups
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.com/
*/
// Load configuration
global $CONFIG;
gatekeeper();
$user_guid = get_input('user_guid', get_loggedin_userid());
$group_guid = get_input('group_guid');
$user = get_entity($user_guid);
$group = get_entity($group_guid);
if ($user instanceof ElggUser && $group instanceof ElggGroup) {
if ($group->isPublicMembership()) {
if ($group->join($user)) {
system_message(elgg_echo("groups:joined"));
// Remove any invite or join request flags
remove_entity_relationship($group->guid, 'invited', $user->guid);
remove_entity_relationship($user->guid, 'membership_request', $group->guid);
// add to river
add_to_river('river/group/create', 'join', $user->guid, $group->guid);
forward($group->getURL());
exit;
} else {
register_error(elgg_echo("groups:cantjoin"));
示例8: gatekeeper
* @link http://elgg.com/
*/
// Load configuration
global $CONFIG;
gatekeeper();
$user_guid = get_input('user_guid');
if (!is_array($user_guid)) {
$user_guid = array($user_guid);
}
$dgroup_guid = get_input('dgroup_guid');
if (sizeof($user_guid)) {
foreach ($user_guid as $u_id) {
$user = get_entity($u_id);
$dgroup = get_entity($dgroup_guid);
if ($user && $dgroup) {
if (get_loggedin_userid() == $dgroup->owner_guid) {
if (!check_entity_relationship($dgroup->guid, 'invited', $user->guid)) {
if ($user->isFriend()) {
// Create relationship
add_entity_relationship($dgroup->guid, 'invited', $user->guid);
// Send email
if (notify_user($user->getGUID(), $dgroup->owner_guid, sprintf(elgg_echo('dgroups:invite:subject'), $user->name, $dgroup->name), sprintf(elgg_echo('dgroups:invite:body'), $user->name, $dgroup->name, "{$CONFIG->url}action/dgroups/join?user_guid={$user->guid}&dgroup_guid={$dgroup->guid}"), NULL)) {
system_message(elgg_echo("dgroups:userinvited"));
} else {
register_error(elgg_echo("dgroups:usernotinvited"));
}
} else {
register_error(elgg_echo("dgroups:usernotinvited"));
}
} else {
register_error(elgg_echo("dgroups:useralreadyinvited"));
示例9: pageSetup_izap_videos
/**
* setups the submenus
*
* @global <type> $CONFIG
*/
function pageSetup_izap_videos()
{
global $CONFIG;
// get the page owner
$pageowner = page_owner_entity();
// if page owner is user and context is izap_videos
if ($pageowner instanceof ElggUser && get_context() == 'videos') {
if ($pageowner != get_loggedin_user()) {
add_submenu_item(sprintf(elgg_echo('izap_videos:user'), $pageowner->name), $CONFIG->wwwroot . 'pg/videos/list/' . $pageowner->username, 'USER_IZAPVIDEOS');
add_submenu_item(sprintf(elgg_echo('izap_videos:userfrnd'), $pageowner->name), $CONFIG->wwwroot . 'pg/videos/friends/' . $pageowner->username, 'USER_IZAPVIDEOS');
add_submenu_item(sprintf(elgg_echo('izap_videos:user_favorites'), $pageowner->name), $CONFIG->wwwroot . 'pg/videos/favorites/' . $pageowner->username, 'USER_IZAPVIDEOS');
}
// for loggedin users only
if (isloggedin()) {
if ($pageowner instanceof ElggUser) {
add_submenu_item(elgg_echo('izap_videos:add'), $CONFIG->wwwroot . 'pg/videos/add/' . get_loggedin_user()->username, 'IZAPVIDEOS');
}
}
}
// for all
if (get_context() == GLOBAL_IZAP_VIDEOS_PAGEHANDLER) {
if (isloggedin()) {
add_submenu_item(sprintf(elgg_echo('izap_videos:videos'), get_loggedin_user()->name), $CONFIG->wwwroot . 'pg/videos/list/' . get_loggedin_user()->username, 'MY_IZAPVIDEOS');
add_submenu_item(sprintf(elgg_echo('izap_videos:frnd'), get_loggedin_user()->name), $CONFIG->wwwroot . 'pg/videos/friends/' . get_loggedin_user()->username, 'MY_IZAPVIDEOS');
add_submenu_item(elgg_echo('izap_videos:my_favorites'), $CONFIG->wwwroot . 'pg/videos/favorites/' . get_loggedin_user()->username, 'MY_IZAPVIDEOS');
}
add_submenu_item(elgg_echo('izap_videos:all'), $CONFIG->wwwroot . 'pg/videos/all', 'IZAPVIDEOS');
}
// if the page owner is group and context is group
if ($pageowner instanceof ElggGroup && (get_context() == 'groups' || get_context() == 'videos') && ($pageowner->izap_videos_enable == 'yes' || empty($pageowner->izap_videos_enable))) {
if (can_write_to_container(get_loggedin_userid(), $pageowner->guid, 'izap_videos')) {
add_submenu_item(elgg_echo('izap_videos:addgroupVideo'), $CONFIG->wwwroot . 'pg/videos/add/' . $pageowner->username, 'IZAPVIDEOS');
}
add_submenu_item(sprintf(elgg_echo('izap_videos:user'), $pageowner->name), $CONFIG->wwwroot . 'pg/videos/list/' . $pageowner->username, 'IZAPVIDEOS');
}
// if the context is admin and is admin logged in
if (get_context() == 'admin' && isadminloggedin()) {
add_submenu_item(elgg_echo('izap_videos:adminSettings'), $CONFIG->wwwroot . 'pg/videos/adminSettings/' . get_loggedin_user()->username . '?option=settings', 'IZAPADMIN');
}
}
示例10: isFriend
/**
* Determines whether or not this user is a friend of the currently logged in user
*
* @return true|false
*/
function isFriend()
{
return user_is_friend(get_loggedin_userid(), $this->getGUID());
}
示例11: get_user_notification_settings
/**
* Get the notification settings for a given user.
*
* @param int $user_guid The user id
* @return stdClass
*/
function get_user_notification_settings($user_guid = 0)
{
$user_guid = (int) $user_guid;
if ($user_guid == 0) {
$user_guid = get_loggedin_userid();
}
$all_metadata = get_metadata_for_entity($user_guid);
if ($all_metadata) {
$prefix = "notification:method:";
$return = new stdClass();
foreach ($all_metadata as $meta) {
$name = substr($meta->name, strlen($prefix));
$value = $meta->value;
if (strpos($meta->name, $prefix) === 0) {
$return->{$name} = $value;
}
}
return $return;
}
return false;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:27,代码来源:notification.php
示例12: get_input
<?php
/**
* Action for adding a wire post
*
*/
// don't filter since we strip and filter escapes some characters
$body = get_input('body', '', false);
$access_id = ACCESS_PUBLIC;
$method = 'site';
$parent_guid = (int) get_input('parent_guid');
// make sure the post isn't blank
if (empty($body)) {
register_error(elgg_echo("thewire:blank"));
forward(REFERER);
}
$guid = thewire_save_post($body, get_loggedin_userid(), $access_id, $parent_guid, $method);
if (!$guid) {
register_error(elgg_echo("thewire:error"));
forward(REFERER);
}
// Send response to original poster if not already registered to receive notification
if ($parent_guid) {
thewire_send_response_notification($guid, $parent_guid, $user);
$parent = get_entity($parent_guid);
forward("thewire/thread/{$parent->wire_thread}");
}
system_message(elgg_echo("thewire:posted"));
forward(REFERER);
示例13: find_plugin_usersettings
/**
* Find the plugin settings for a user.
*
* @param string $plugin_name Plugin name.
* @param int $user_guid The guid who's settings to retrieve.
* @return array of settings in an associative array minus prefix.
*/
function find_plugin_usersettings($plugin_name = "", $user_guid = 0)
{
$plugin_name = sanitise_string($plugin_name);
$user_guid = (int) $user_guid;
if (!$plugin_name) {
$plugin_name = get_plugin_name();
}
if ($user_guid == 0) {
$user_guid = get_loggedin_userid();
}
// Get metadata for user
$all_metadata = get_all_private_settings($user_guid);
//get_metadata_for_entity($user_guid);
if ($all_metadata) {
$prefix = "plugin:settings:{$plugin_name}:";
$return = new stdClass();
foreach ($all_metadata as $key => $meta) {
$name = substr($key, strlen($prefix));
$value = $meta;
if (strpos($key, $prefix) === 0) {
$return->{$name} = $value;
}
}
return $return;
}
return false;
}
示例14: sitepages_page_handler
/**
* Serve out views for site pages.
*
* @param unknown_type $page
* @return unknown_type
*/
function sitepages_page_handler($page)
{
global $CONFIG;
// for the owner block.
if ($logged_in_guid = get_loggedin_userid()) {
set_page_owner($logged_in_guid);
}
// sanity checking.
// on bad params we'll forward so people will bookmark the correct URLs
// @todo valid page names need to be pulled out into some sort of config var or admin option.
$default_page = 'About';
$action = isset($page[0]) ? $page[0] : FALSE;
$page_type = isset($page[1]) ? $page[1] : FALSE;
switch ($action) {
case 'edit':
$title = elgg_echo('sitepages');
$content = sitepages_get_edit_section_content($page_type);
break;
case 'read':
$title = elgg_echo('sitepages:' . strtolower($page_type));
$content = sitepages_get_page_content($page_type);
break;
default:
forward("{$CONFIG->site->url}pg/sitepages/read/{$default_page}");
break;
}
page_draw($title, $content);
}
示例15: import
/**
* Import data from an parsed xml data array.
*
* @param array $data
* @param int $version
*/
public function import(ODD $data)
{
if (!$data instanceof ODDEntity) {
throw new InvalidParameterException(elgg_echo('InvalidParameterException:UnexpectedODDClass'));
}
// Set type and subtype
$this->attributes['type'] = $data->getAttribute('class');
$this->attributes['subtype'] = $data->getAttribute('subclass');
// Set owner
$this->attributes['owner_guid'] = get_loggedin_userid();
// Import as belonging to importer.
// Set time
$this->attributes['time_created'] = strtotime($data->getAttribute('published'));
$this->attributes['time_updated'] = time();
return true;
}