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


PHP elgg_get_logged_in_user_guid函数代码示例

本文整理汇总了PHP中elgg_get_logged_in_user_guid函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_logged_in_user_guid函数的具体用法?PHP elgg_get_logged_in_user_guid怎么用?PHP elgg_get_logged_in_user_guid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: security_tools_usersettings_save_handler

/**
 * Listen to the usersettings save hook for some notifications to the user
 *
 * @param string $hook         usersettings:save
 * @param string $type         user
 * @param bool   $return_value not supplied for this hook
 * @param null   $params       not supplied for this hook
 *
 * @return void
 */
function security_tools_usersettings_save_handler($hook, $type, $return_value, $params)
{
    $user_guid = (int) get_input("guid");
    if (empty($user_guid)) {
        $user_guid = elgg_get_logged_in_user_guid();
    }
    if (empty($user_guid)) {
        return $return_value;
    }
    $user = get_user($user_guid);
    if (empty($user) || !$user->canEdit()) {
        return $return_value;
    }
    // passwords are different
    if (_elgg_set_user_password() === true) {
        // do we need to notify the user about a password change
        $setting = elgg_get_plugin_setting("mails_password_change", "security_tools");
        if ($setting != "no") {
            $site = elgg_get_site_entity();
            $subject = elgg_echo("security_tools:notify_user:password:subject");
            $message = elgg_echo("security_tools:notify_user:password:message", array($user->name, $site->name, $site->url));
            notify_user($user->getGUID(), $site->getGUID(), $subject, $message, null, "email");
        }
    }
    // email are also different
    $setting = elgg_get_plugin_setting("mails_verify_email_change", "security_tools");
    if ($setting != "no" && $user->getGUID() == elgg_get_logged_in_user_guid()) {
        // verify new email address
        security_tools_prepare_email_change();
    } else {
        // old way, or admin changes your email
        _elgg_set_user_email();
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:44,代码来源:hooks.php

示例2: au_landing_page_update

function au_landing_page_update($event, $type, $object)
{
    if (!elgg_instanceof($object, 'page') && elgg_instanceof($object, 'page_top')) {
        return true;
    }
    // only process this event once
    if (elgg_get_config('page_update_notify_sent_' . $object->guid)) {
        return true;
    }
    elgg_set_config('page_update_notify_sent_' . $object->guid, true);
    // get revision history for the page
    $revisions = $object->getAnnotations(array('annotation_name' => 'page', 'limit' => false));
    // create an array of unique users to notify, excluding the current user
    // and the object owner (as core notifies them)
    $users = array();
    foreach ($revisions as $revision) {
        if ($revision->owner_guid != $object->owner_guid && $revision->owner_guid != elgg_get_logged_in_user_guid()) {
            $users[] = $revision->owner_guid;
        }
    }
    $users = array_unique($users);
    // notify the users
    if (count($users)) {
        notify_user($users, elgg_get_logged_in_user_guid(), elgg_echo('au_landing:page:update:subject', array($object->title)), elgg_echo('au_landing:page:update:message', array($object->title, elgg_get_logged_in_user_entity()->name, $object->getURL())));
    }
}
开发者ID:AU-Landing-Project,项目名称:au_landing,代码行数:26,代码来源:events.php

示例3: tp_gd_watermark

/**
 * Use GD to apply watermark to image
 *
 * @param resource $image GD image resource
 */
function tp_gd_watermark($image)
{
    global $CONFIG;
    $watermark_text = elgg_get_plugin_setting('watermark_text', 'tidypics');
    if (!$watermark_text) {
        return;
    }
    // plugins can do their own watermark and return false to prevent this function from running
    if (trigger_plugin_hook('tp_watermark', 'gd', $image, true) === false) {
        return;
    }
    $owner = elgg_get_logged_in_user_guid();
    $watermark_text = tp_process_watermark_text($watermark_text, $owner);
    // transparent gray
    imagealphablending($image, true);
    $textcolor = imagecolorallocatealpha($image, 50, 50, 50, 60);
    // font and location
    $font = $CONFIG->pluginspath . "tidypics/fonts/LiberationSerif-Regular.ttf";
    $bbox = imagettfbbox(20, 0, $font, $watermark_text);
    $text_width = $bbox[2] - $bbox[0];
    $text_height = $bbox[1] - $bbox[7];
    $image_width = imagesx($image);
    $image_height = imagesy($image);
    $left = $image_width / 2 - $text_width / 2;
    $top = $image_height - 20;
    // write the text on the image
    imagettftext($image, 20, 0, $left, $top, $textcolor, $font, $watermark_text);
}
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:33,代码来源:watermark.php

示例4: deleteRequest

 /**
  * Listen to the delete of a membership request
  *
  * @param stirng            $event        the name of the event
  * @param stirng            $type         the type of the event
  * @param \ElggRelationship $relationship the relationship
  *
  * @return void
  */
 public static function deleteRequest($event, $type, $relationship)
 {
     if (!$relationship instanceof \ElggRelationship) {
         return;
     }
     if ($relationship->relationship !== 'membership_request') {
         // not a membership request
         return;
     }
     $action_pattern = '/action\\/groups\\/killrequest/i';
     if (!preg_match($action_pattern, current_page_url())) {
         // not in the action, so do nothing
         return;
     }
     $group = get_entity($relationship->guid_two);
     $user = get_user($relationship->guid_one);
     if (empty($user) || !$group instanceof \ElggGroup) {
         return;
     }
     if ($user->getGUID() === elgg_get_logged_in_user_guid()) {
         // user kills own request
         return;
     }
     $reason = get_input('reason');
     if (empty($reason)) {
         $body = elgg_echo('group_tools:notify:membership:declined:message', [$user->name, $group->name, $group->getURL()]);
     } else {
         $body = elgg_echo('group_tools:notify:membership:declined:message:reason', [$user->name, $group->name, $reason, $group->getURL()]);
     }
     $subject = elgg_echo('group_tools:notify:membership:declined:subject', [$group->name]);
     $params = ['object' => $group, 'action' => 'delete'];
     notify_user($user->getGUID(), $group->getGUID(), $subject, $body, $params);
 }
开发者ID:coldtrick,项目名称:group_tools,代码行数:42,代码来源:Membership.php

示例5: community_spam_profile_blacklist

/**
 * Filter profile fields by blacklist
 */
function community_spam_profile_blacklist()
{
    $blacklist = elgg_get_plugin_setting('profile_blacklist', 'community_spam_tools');
    $blacklist = explode(",", $blacklist);
    $blacklist = array_map('trim', $blacklist);
    foreach ($_REQUEST as $key => $value) {
        if (is_string($value)) {
            foreach ($blacklist as $word) {
                if (stripos($value, $word) !== false) {
                    ban_user(elgg_get_logged_in_user_guid(), "used '{$word}' on profile");
                    $user->automated_ban = true;
                    return false;
                }
            }
        }
    }
    // if the email address is a phrase, block
    $profile_fields = elgg_get_config('profile_fields');
    foreach ($profile_fields as $name => $type) {
        if ($type == 'email') {
            $value = get_input($name);
            if ($value && substr_count($value, ' ') > 1) {
                ban_user(elgg_get_logged_in_user_guid(), "Used multiple spaces in email field.");
                $user->automated_ban = true;
                return false;
            }
        }
    }
}
开发者ID:elgg,项目名称:community_spam_tools,代码行数:32,代码来源:start.php

示例6: customstyle_page_handler

function customstyle_page_handler($page)
{
    gatekeeper();
    elgg_set_context('customstyle');
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    $title = elgg_echo('customstyle');
    $base_dir = elgg_get_plugins_path() . 'customstyle/pages/customstyle';
    switch ($page[0]) {
        case 'colors':
            $body = elgg_view('customstyle/colors');
            break;
        case 'background':
            $body = elgg_view('customstyle/background');
            break;
        case 'personalize':
            $body = elgg_view('customstyle/default');
            break;
        default:
            $body = elgg_view('customstyle/default');
            break;
    }
    $params = array('content' => $body, 'title' => $title);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
    return true;
}
开发者ID:Ruthkaveke,项目名称:tumchat,代码行数:26,代码来源:start.php

示例7: bookmarks_init

/**
 * Bookmark init
 */
function bookmarks_init()
{
    $root = dirname(__FILE__);
    elgg_register_library('elgg:bookmarks', "{$root}/lib/bookmarks.php");
    // actions
    $action_path = "{$root}/actions/bookmarks";
    elgg_register_action('bookmarks/save', "{$action_path}/save.php");
    elgg_register_action('bookmarks/delete', "{$action_path}/delete.php");
    elgg_register_action('bookmarks/share', "{$action_path}/share.php");
    // menus
    elgg_register_menu_item('site', array('name' => 'bookmarks', 'text' => elgg_echo('bookmarks'), 'href' => 'bookmarks/all'));
    elgg_register_plugin_hook_handler('register', 'menu:page', 'bookmarks_page_menu');
    elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'bookmarks_owner_block_menu');
    elgg_register_page_handler('bookmarks', 'bookmarks_page_handler');
    elgg_extend_view('elgg.css', 'bookmarks/css');
    elgg_extend_view('elgg.js', 'bookmarks/js');
    elgg_register_widget_type('bookmarks', elgg_echo('bookmarks'), elgg_echo('bookmarks:widget:description'));
    if (elgg_is_logged_in()) {
        $user_guid = elgg_get_logged_in_user_guid();
        $address = urlencode(current_page_url());
        elgg_register_menu_item('extras', array('name' => 'bookmark', 'text' => elgg_view_icon('push-pin-alt'), 'href' => "bookmarks/add/{$user_guid}?address={$address}", 'title' => elgg_echo('bookmarks:this'), 'rel' => 'nofollow'));
    }
    // Register for notifications
    elgg_register_notification_event('object', 'bookmarks', array('create'));
    elgg_register_plugin_hook_handler('prepare', 'notification:create:object:bookmarks', 'bookmarks_prepare_notification');
    // Register bookmarks view for ecml parsing
    elgg_register_plugin_hook_handler('get_views', 'ecml', 'bookmarks_ecml_views_hook');
    // Register a URL handler for bookmarks
    elgg_register_plugin_hook_handler('entity:url', 'object', 'bookmark_set_url');
    // Register entity type for search
    elgg_register_entity_type('object', 'bookmarks');
    // Groups
    add_group_tool_option('bookmarks', elgg_echo('bookmarks:enablebookmarks'), true);
    elgg_extend_view('groups/tool_latest', 'bookmarks/group_module');
}
开发者ID:bhargavgarlapati,项目名称:Elgg,代码行数:38,代码来源:start.php

示例8: add_submenus

/**
 * Sets up submenus. Triggered on pagesetup.
 *
 */
function add_submenus()
{
    $plugins_base = elgg_get_site_url() . "plugins";
    if (elgg_get_context() == 'admin') {
        elgg_register_admin_menu_item('administer', 'statistics', 'community_plugins');
        elgg_register_admin_menu_item('administer', 'utilities', 'community_plugins');
        elgg_register_admin_menu_item('configure', 'community_plugins', 'settings');
        return;
    }
    if (elgg_get_context() != "plugins") {
        return;
    }
    $page_owner = elgg_get_page_owner_entity();
    if (elgg_is_logged_in() && elgg_get_page_owner_guid() == elgg_get_logged_in_user_guid()) {
        elgg_register_menu_item('page', array('href' => "{$plugins_base}/developer/{$page_owner->username}", 'name' => 'plugins:yours', 'text' => elgg_echo("plugins:yours", array(elgg_echo('plugins:types:')))));
    } else {
        if (elgg_get_page_owner_guid()) {
            $title = elgg_echo("plugins:user", array($page_owner->name, elgg_echo('plugins:types:')));
            elgg_register_menu_item('page', array('href' => "{$plugins_base}/developer/{$page_owner->username}", 'name' => 'plugins:user', 'text' => $title));
        }
    }
    elgg_register_menu_item('page', array('href' => '/plugins', 'name' => 'plugins:all', 'text' => elgg_echo('plugins:all')));
    // add upload link when viewing own plugin page
    if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
        elgg_register_menu_item('page', array('href' => "{$plugins_base}/new/project/{$page_owner->username}", 'name' => 'plugins:upload', 'text' => elgg_echo('plugins:upload')));
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:31,代码来源:events.php

示例9: bookmarks_init

/**
 * Bookmark init
 */
function bookmarks_init()
{
    $root = dirname(__FILE__);
    elgg_register_library('elgg:bookmarks', "{$root}/lib/bookmarks.php");
    // actions
    $action_path = "{$root}/actions/bookmarks";
    elgg_register_action('bookmarks/save', "{$action_path}/save.php");
    elgg_register_action('bookmarks/delete', "{$action_path}/delete.php");
    elgg_register_action('bookmarks/share', "{$action_path}/share.php");
    // menus
    elgg_register_menu_item('site', array('name' => 'bookmarks', 'text' => elgg_echo('bookmarks'), 'href' => 'bookmarks/all'));
    elgg_register_plugin_hook_handler('register', 'menu:page', 'bookmarks_page_menu');
    elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'bookmarks_owner_block_menu');
    elgg_register_page_handler('bookmarks', 'bookmarks_page_handler');
    elgg_extend_view('css/elgg', 'bookmarks/css');
    elgg_extend_view('js/elgg', 'bookmarks/js');
    elgg_register_widget_type('bookmarks', elgg_echo('bookmarks'), elgg_echo('bookmarks:widget:description'));
    if (elgg_is_logged_in()) {
        $user_guid = elgg_get_logged_in_user_guid();
        $address = urlencode(current_page_url());
        elgg_register_menu_item('extras', array('name' => 'bookmark', 'text' => elgg_view_icon('push-pin-alt'), 'href' => "bookmarks/add/{$user_guid}?address={$address}", 'title' => elgg_echo('bookmarks:this'), 'rel' => 'nofollow'));
    }
    // Register granular notification for this type
    register_notification_object('object', 'bookmarks', elgg_echo('bookmarks:new'));
    // Listen to notification events and supply a more useful message
    elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'bookmarks_notify_message');
    // Register a URL handler for bookmarks
    elgg_register_entity_url_handler('object', 'bookmarks', 'bookmark_url');
    // Register entity type for search
    elgg_register_entity_type('object', 'bookmarks');
    // Groups
    add_group_tool_option('bookmarks', elgg_echo('bookmarks:enablebookmarks'), true);
    elgg_extend_view('groups/tool_latest', 'bookmarks/group_module');
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:37,代码来源:start.php

示例10: isUserWaiting

 /**
  * Checks if a given user is waiting for this slot
  *
  * @param string $user_guid guid of the user
  *
  * @return ElggRelationship|false
  */
 public function isUserWaiting($user_guid = null)
 {
     if (empty($user_guid)) {
         $user_guid = elgg_get_logged_in_user_guid();
     }
     return check_entity_relationship($user_guid, EVENT_MANAGER_RELATION_SLOT_REGISTRATION_WAITINGLIST, $this->getGUID());
 }
开发者ID:pleio,项目名称:event_manager,代码行数:14,代码来源:EventSlot.php

示例11: startSession

 protected function startSession()
 {
     global $SUBSITE_MANAGER_CUSTOM_DOMAIN;
     if ($this->container_guid) {
         $container_guid = $this->container_guid;
     } else {
         $container_guid = elgg_get_logged_in_user_guid();
     }
     //Etherpad: Create an etherpad group for the elgg container
     $mappedGroup = $this->get_pad_client()->createGroupIfNotExistsFor($container_guid);
     $this->groupID = $mappedGroup->groupID;
     //Etherpad: Create an author(etherpad user) for logged in user
     $author = $this->get_pad_client()->createAuthorIfNotExistsFor(elgg_get_logged_in_user_entity()->username, elgg_get_logged_in_user_entity()->name);
     $this->authorID = $author->authorID;
     //Etherpad: Create session
     $validUntil = mktime(date("H"), date("i") + 5, 0, date("n"), date("j"), date("Y"));
     // 5 minutes in the future
     $session = $this->get_pad_client()->createSession($this->groupID, $this->authorID, $validUntil);
     $sessionID = $session->sessionID;
     if (empty($SUBSITE_MANAGER_CUSTOM_DOMAIN)) {
         $domain = ".pleio.nl";
         if (!setcookie('sessionID', $sessionID, $validUntil, '/', $domain)) {
             throw new Exception(elgg_echo('etherpad:error:cookies_required'));
         }
     } else {
         // using a custom domain, so need to do a trick
         $_SESSION["etherpad_session"] = $sessionID;
     }
     return $sessionID;
 }
开发者ID:smellems,项目名称:elggpad-lite,代码行数:30,代码来源:ElggPad.php

示例12: twitter_api_pagehandler

/**
 * Serves pages for twitter.
 *
 * @param array $page
 */
function twitter_api_pagehandler($page)
{
    if (!isset($page[0])) {
        forward();
    }
    switch ($page[0]) {
        case 'authorize':
            twitter_api_authorize();
            break;
        case 'revoke':
            twitter_api_revoke();
            break;
        case 'forward':
            twitter_api_forward();
            break;
        case 'login':
            twitter_api_login();
            break;
        case 'interstitial':
            gatekeeper();
            // only let twitter users do this.
            $guid = elgg_get_logged_in_user_guid();
            $twitter_name = elgg_get_plugin_user_setting('twitter_name', $guid, 'twitter_api');
            if (!$twitter_name) {
                register_error(elgg_echo('twitter_api:invalid_page'));
                forward();
            }
            $pages = dirname(__FILE__) . '/pages/twitter_api';
            include "{$pages}/interstitial.php";
            break;
        default:
            forward();
            break;
    }
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:40,代码来源:start.php

示例13: pool_entity_menu

/**
 * Set up entity menu for pool objects
 *
 * @param string $hook 'register'
 * @param string $type 'menu:entity'
 * @param ElggMenuItem[] $return
 * @param array $params
 * @return ElggMenuItem[]
 */
function pool_entity_menu($hook, $type, $return, $params)
{
    $handler = elgg_extract('handler', $params, false);
    if ($handler != 'task_pool') {
        return $return;
    }
    if (elgg_is_logged_in()) {
        $entity = $params['entity'];
        $user_guid = elgg_get_logged_in_user_guid();
        if ($entity->isMember($user_guid)) {
            $text = elgg_echo('pool:leave');
        } else {
            $text = elgg_echo('pool:join');
        }
        $return[] = ElggMenuItem::factory(array('name' => 'test', 'text' => "<span>{$text}</span>", 'href' => "action/pool/toggle_membership?pool_guid={$entity->guid}&user_guid={$user_guid}", 'priority' => 150, 'is_action' => true));
        if (elgg_is_admin_logged_in()) {
            $return[] = ElggMenuItem::factory(array('name' => 'edit', 'text' => elgg_echo('edit'), 'href' => "admin/pool/save?guid={$entity->guid}"));
            $return[] = ElggMenuItem::factory(array('name' => 'delete', 'text' => elgg_view_icon('delete'), 'href' => "action/pool/admin/delete?guid={$entity->guid}", 'is_action' => true, 'confirm' => elgg_echo('question:areyousure'), 'priority' => 200));
            if ($entity->countMembers()) {
                $return[] = ElggMenuItem::factory(array('name' => 'shift', 'text' => elgg_echo('pool:shift'), 'href' => "action/pool/shift?guid={$entity->guid}", 'priority' => 150, 'is_action' => true, 'confirm' => elgg_echo('question:areyousure')));
            }
        }
    }
    return $return;
}
开发者ID:juho-jaakkola,项目名称:elgg-pool,代码行数:34,代码来源:start.php

示例14: handleUploads

 /**
  * dropzone/upload action handler
  * @return array
  */
 public function handleUploads()
 {
     $subtype = get_input('subtype');
     if (!$subtype) {
         $subtype = elgg_get_plugin_setting('default_upload_subtype', 'hypeDropzone', 'file');
     }
     $uploads = $this->saveUploadedFiles('dropzone', ['owner_guid' => elgg_get_logged_in_user_guid(), 'container_guid' => get_input('container_guid') ?: ELGG_ENTITIES_ANY_VALUE, 'subtype' => $subtype, 'access_id' => ACCESS_PRIVATE, 'origin' => get_input('origin', 'dropzone')]);
     $output = array();
     foreach ($uploads as $upload) {
         $messages = array();
         $success = true;
         if ($upload->error) {
             $messages[] = $upload->error;
             $success = false;
             ${$guid} = false;
         } else {
             $file = $upload->file;
             $guid = $file->guid;
             $html = elgg_view('input/hidden', array('name' => get_input('input_name', 'guids[]'), 'value' => $file->guid));
         }
         $file_output = array('messages' => $messages, 'success' => $success, 'guid' => $guid, 'html' => $html);
         $output[] = elgg_trigger_plugin_hook('upload:after', 'dropzone', array('upload' => $upload), $file_output);
     }
     return $output;
 }
开发者ID:hypejunction,项目名称:hypedropzone,代码行数:29,代码来源:DropzoneService.php

示例15: dbvalidate_fix_bad_entities

function dbvalidate_fix_bad_entities()
{
    $db_prefix = elgg_get_config('dbprefix');
    $guid = elgg_get_logged_in_user_guid();
    $query = "UPDATE {$db_prefix}entities e LEFT JOIN {$db_prefix}entities o ON e.owner_guid = o.guid" . " SET e.owner_guid = {$guid}" . " WHERE (e.type = 'object' OR e.type='group') AND (o.guid IS NULL OR o.guid = 0)";
    update_data($query);
}
开发者ID:iionly,项目名称:dbvalidator,代码行数:7,代码来源:start.php


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