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


PHP elgg_unset_plugin_user_setting函数代码示例

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


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

示例1: removeAdmin

 /**
  * listen to the remove admin event to unset the toggle admin flag
  *
  * @param string     $event  the event
  * @param string     $type   the type of the event
  * @param ElggEntity $entity the affected entity
  *
  * @return void
  */
 public static function removeAdmin($event, $type, $entity)
 {
     if (!$entity instanceof \ElggUser) {
         return;
     }
     elgg_unset_plugin_user_setting('switched_admin', $entity->getGUID(), 'admin_tools');
 }
开发者ID:coldtrick,项目名称:admin_tools,代码行数:16,代码来源:Admin.php

示例2: saveUserNotificationsSettings

 /**
  * Save the wire_tools preferences for the user
  *
  * @param string $hook         the name of the hook
  * @param stirng $type         the type of the hook
  * @param array  $return_value the current return value
  * @param array  $params       supplied values
  *
  * @return void
  */
 public static function saveUserNotificationsSettings($hook, $type, $return_value, $params)
 {
     $NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethods();
     if (empty($NOTIFICATION_HANDLERS) || !is_array($NOTIFICATION_HANDLERS)) {
         return;
     }
     $user_guid = (int) get_input('guid');
     if (empty($user_guid)) {
         return;
     }
     $user = get_user($user_guid);
     if (empty($user) || !$user->canEdit()) {
         return;
     }
     $methods = [];
     foreach ($NOTIFICATION_HANDLERS as $method) {
         $setting = get_input("thewire_tools_{$method}");
         if (!empty($setting)) {
             $methods[] = $method;
         }
     }
     if (!empty($methods)) {
         elgg_set_plugin_user_setting('notification_settings', implode(',', $methods), $user->getGUID(), 'thewire_tools');
     } else {
         elgg_unset_plugin_user_setting('notification_settings', $user->getGUID(), 'thewire_tools');
     }
     // set flag for correct fallback behaviour
     elgg_set_plugin_user_setting('notification_settings_saved', '1', $user->getGUID(), 'thewire_tools');
 }
开发者ID:coldtrick,项目名称:thewire_tools,代码行数:39,代码来源:Notifications.php

示例3: get_input

 */
$user_guid = (int) get_input('user_guid');
if (empty($user_guid) || $user_guid != elgg_get_logged_in_user_guid()) {
    register_error(elgg_echo('actionunauthorized'));
    forward(REFERER);
}
$user = get_user($user_guid);
if (empty($user)) {
    forward(REFERER);
}
if (!admin_tools_is_admin_user($user)) {
    register_error(elgg_echo('actionunauthorized'));
    forward(REFERER);
}
if ($user->isAdmin()) {
    // make the user a normal user
    $secret = admin_tools_make_switch_admin_secret($user);
    if (!empty($secret)) {
        $user->removeAdmin();
        elgg_set_plugin_user_setting('switched_admin', $secret, $user->getGUID(), 'admin_tools');
        system_message(elgg_echo('admin_tools:action:toggle_admin:success:user'));
    } else {
        register_error(elgg_echo('save:fail'));
    }
} else {
    // make the user an admin
    $user->makeAdmin();
    elgg_unset_plugin_user_setting('switched_admin', $user->getGUID(), 'admin_tools');
    system_message(elgg_echo('admin_tools:action:toggle_admin:success:admin'));
}
forward(REFERER);
开发者ID:coldtrick,项目名称:admin_tools,代码行数:31,代码来源:toggle_admin.php

示例4: simplesaml_save_authentication_attributes

/**
 * Save the authenticaion attributes provided by the Service Provider (SP) for later use.
 *
 * @param ElggUser    $user        the user to store the attributes for
 * @param string      $saml_source the name of the Service Provider which provided the attributes
 * @param array|false $attributes  the attributes to save, false to remove all attributes
 *
 * @return void
 */
function simplesaml_save_authentication_attributes(ElggUser $user, $saml_source, $attributes = false)
{
    if (!empty($user) && elgg_instanceof($user, "user") && !empty($saml_source) && simplesaml_is_enabled_source($saml_source)) {
        // remove the current attrributes
        elgg_unset_plugin_user_setting($saml_source . "_attributes", $user->getGUID(), "simplesaml");
        // are we allowed to save the attributes
        if (elgg_get_plugin_setting($saml_source . "_save_attributes", "simplesaml")) {
            // save settings
            if (!empty($attributes) && is_array($attributes)) {
                // filter some keys out of the attributes
                unset($attributes["elgg:firstname"]);
                unset($attributes["elgg:lastname"]);
                unset($attributes["elgg:email"]);
                unset($attributes["elgg:external_id"]);
                unset($attributes["elgg:username"]);
                unset($attributes["elgg:auto_link"]);
                elgg_set_plugin_user_setting($saml_source . "_attributes", json_encode($attributes), $user->getGUID(), "simplesaml");
            }
        }
    }
}
开发者ID:pleio,项目名称:simplesaml,代码行数:30,代码来源:functions.php

示例5: get_input

<?php

$tags = get_input('tags');
$user_guid = (int) get_input('user_guid');
if (empty($user_guid)) {
    register_error(elgg_echo('error:missing_data'));
    forward(REFERER);
}
$user = get_user($user_guid);
if (empty($user) || !elgg_instanceof($user, 'user')) {
    register_error(elgg_echo('error:missing_data'));
    forward(REFERER);
}
if (!$user->canEdit()) {
    register_error(elgg_echo('noaccess'));
    forward(REFERER);
}
if (empty($tags)) {
    elgg_unset_plugin_user_setting('notifications', $user->getGUID(), 'tags_tools');
} else {
    elgg_set_plugin_user_setting('notifications', json_encode($tags), $user->getGUID(), 'tag_tools');
}
system_message(elgg_echo('save:success'));
forward(REFERER);
开发者ID:coldtrick,项目名称:tag_tools,代码行数:24,代码来源:edit.php

示例6: content_subscriptions_notifications_settings_save_hook

/**
 * Save the content subscriptions preferences for the user
 *
 * @param string $hook         the name of the hook
 * @param stirng $type         the type of the hook
 * @param array  $return_value the current return value
 * @param array  $params       supplied values
 *
 * @return void
 */
function content_subscriptions_notifications_settings_save_hook($hook, $type, $return_value, $params)
{
    $NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethods();
    if (empty($NOTIFICATION_HANDLERS) || !is_array($NOTIFICATION_HANDLERS)) {
        return;
    }
    $user_guid = (int) get_input("guid");
    if (empty($user_guid)) {
        return;
    }
    $user = get_user($user_guid);
    if (empty($user) || !$user->canEdit()) {
        return;
    }
    $methods = array();
    foreach ($NOTIFICATION_HANDLERS as $method) {
        $setting = get_input("content_subscriptions_" . $method);
        if (!empty($setting)) {
            $methods[] = $method;
        }
    }
    if (!empty($methods)) {
        elgg_set_plugin_user_setting("notification_settings", implode(",", $methods), $user->getGUID(), "content_subscriptions");
    } else {
        elgg_unset_plugin_user_setting("notification_settings", $user->getGUID(), "content_subscriptions");
    }
    // set flag for correct fallback behaviour
    elgg_set_plugin_user_setting("notification_settings_saved", "1", $user->getGUID(), "content_subscriptions");
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:39,代码来源:hooks.php

示例7: facebook_connect_revoke

/**
 * Used to Remove facebook access for the currently logged in user.
 *
 * @access public
 * @return void
 */
function facebook_connect_revoke()
{
    // unregister user's access tokens
    elgg_unset_plugin_user_setting('uid');
    elgg_unset_plugin_user_setting('access_token');
    $user = get_loggedin_user();
    system_message(elgg_echo('facebook_connect:revoke:success'));
    forward('settings/plugins/' . $user->username . '/facebook_connect', 'facebook_connect');
}
开发者ID:rohit1290,项目名称:Facebook-Login-1.9-1.12,代码行数:15,代码来源:facebook_connect.php

示例8: twitter_api_revoke

/**
 * Remove twitter access for the currently logged in user.
 */
function twitter_api_revoke()
{
    // unregister user's access tokens
    elgg_unset_plugin_user_setting('twitter_name', 0, 'twitter_api');
    elgg_unset_plugin_user_setting('access_key', 0, 'twitter_api');
    elgg_unset_plugin_user_setting('access_secret', 0, 'twitter_api');
    system_message(elgg_echo('twitter_api:revoke:success'));
    forward('settings/plugins', 'twitter_api');
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:12,代码来源:twitter_api.php

示例9: set_time_limit

<?php

set_time_limit(0);
$options = array('type' => 'user', 'plugin_id' => 'elgg_social_login', 'plugin_user_setting_names' => array('uid'), 'limit' => 0);
$users = new ElggBatch('elgg_get_entities_from_plugin_user_settings', $options);
foreach ($users as $user) {
    $setting = elgg_get_plugin_user_setting('uid', $user->guid, 'elgg_social_login');
    list($provider, $uid) = explode('_', $setting);
    // Check to see if another record has been created with elgg_hybridauth
    $elgg_hybridauth_options = array('type' => 'user', 'plugin_id' => 'elgg_hybridauth', 'plugin_user_setting_name_value_pairs' => array("{$provider}:uid" => $uid), 'limit' => 0);
    $elgg_hybridauth_users = elgg_get_entities_from_plugin_user_settings($elgg_hybridauth_options);
    if ($elgg_hybridauth_users) {
        $elgg_hybridauth_user = $elgg_hybridauth_users[0];
        if ($user->time_created < $elgg_hybridauth_user->time_created) {
            // elgg_social_login user was created earlier, so give that user the ability to login in with this provider uid
            elgg_unset_plugin_user_setting("{$provider}:uid", $elgg_hybridauth_user->guid, 'elgg_hybridauth');
        }
    } else {
        elgg_set_plugin_user_setting("{$provider}:uid", $uid, $user->guid, 'elgg_hybridauth');
    }
    // keep a backup record
    elgg_unset_plugin_user_setting('uid', $user->guid, 'elgg_social_login');
    elgg_set_plugin_user_setting('elgg_social_login_uid', "{$provider}_{$uid}", 'elgg_hybridauth');
    $i++;
}
system_message(elgg_echo('hybridauth:admin:elgg_social_login:action', array($i)));
forward(REFERER);
开发者ID:n8b,项目名称:VMN,代码行数:27,代码来源:elgg_social_login.php

示例10: simplesaml_save_authentication_attributes

/**
 * Save the authenticaion attributes provided by the Service Provider (SP) for later use.
 *
 * @param ElggUser    $user        the user to store the attributes for
 * @param string      $saml_source the name of the Service Provider which provided the attributes
 * @param array|false $attributes  the attributes to save, false to remove all attributes
 *
 * @return void
 */
function simplesaml_save_authentication_attributes(ElggUser $user, $saml_source, $attributes = false)
{
    if (!$user instanceof ElggUser || empty($saml_source) || !simplesaml_is_enabled_source($saml_source)) {
        return;
    }
    // remove the current attributes
    elgg_unset_plugin_user_setting("{$saml_source}_attributes", $user->getGUID(), 'simplesaml');
    if (empty($attributes)) {
        // no new attributes to save
        return;
    }
    // are we allowed to save the attributes
    if (elgg_get_plugin_setting("{$saml_source}_save_attributes", 'simplesaml')) {
        // filter some keys out of the attributes
        unset($attributes["elgg:firstname"]);
        unset($attributes["elgg:lastname"]);
        unset($attributes["elgg:email"]);
        unset($attributes["elgg:external_id"]);
        unset($attributes["elgg:username"]);
        unset($attributes["elgg:auto_link"]);
        // save attributes
        elgg_set_plugin_user_setting("{$saml_source}_attributes", json_encode($attributes), $user->getGUID(), 'simplesaml');
    }
}
开发者ID:coldtrick,项目名称:simplesaml,代码行数:33,代码来源:functions.php

示例11: facebook_api_revoke

/**
 * Remove facebook access for the currently logged in user.
 */
function facebook_api_revoke()
{
    // unregister user's access tokens
    elgg_unset_plugin_user_setting('uid');
    elgg_unset_plugin_user_setting('access_token');
    system_message(elgg_echo('facebook_api:revoke:success'));
    forward('settings/plugins', 'facebook_api');
}
开发者ID:lweddewer,项目名称:facebook_api,代码行数:11,代码来源:facebook_api.php

示例12: elgg_get_logged_in_user_entity

<?php
/**
  Save Custom Background
*/

$user = elgg_get_logged_in_user_entity();
    
$avatar = get_input('avatar_panel');
	if ($avatar) {
		elgg_set_plugin_user_setting('avatar_panel', 1, $user->guid, 'deyan');
	} else {
		elgg_unset_plugin_user_setting('avatar_panel', $user->guid, 'deyan');
	}
	
开发者ID:redvabel,项目名称:Deyan-Shell,代码行数:13,代码来源:panel.php

示例13: set_time_limit

set_time_limit(0);
$providers = unserialize(elgg_get_plugin_setting('providers', 'elgg_hybridauth'));
foreach ($providers as $provider => $settings) {
    // Let's check to see if social_connect was used previoiusly to authenticate users
    $options = array('type' => 'user', 'plugin_id' => 'social_connect', 'plugin_user_setting_names' => array("{$provider}/uid"), 'limit' => 0);
    $users = new ElggBatch('elgg_get_entities_from_plugin_user_settings', $options);
    if ($users) {
        foreach ($users as $user) {
            $uid = elgg_get_plugin_user_setting("{$provider}/uid", $user->guid, 'social_connect');
            // Check to see if another record has been created with elgg_hybridauth
            $elgg_hybridauth_options = array('type' => 'user', 'plugin_id' => 'elgg_hybridauth', 'plugin_user_setting_name_value_pairs' => array("{$provider}:uid" => $uid), 'limit' => 0);
            $elgg_hybridauth_users = elgg_get_entities_from_plugin_user_settings($elgg_hybridauth_options);
            if ($elgg_hybridauth_users) {
                $elgg_hybridauth_user = $elgg_hybridauth_users[0];
                if ($user->time_created < $elgg_hybridauth_user->time_created) {
                    // elgg_social_login user was created earlier, so give that user the ability to login in with this provider uid
                    elgg_unset_plugin_user_setting("{$provider}:uid", $elgg_hybridauth_user->guid, 'elgg_hybridauth');
                }
            } else {
                elgg_set_plugin_user_setting("{$provider}:uid", $uid, $user->guid, 'elgg_hybridauth');
            }
            // keep a backup record
            elgg_unset_plugin_user_setting("{$provider}/uid", $user->guid, 'social_connect');
            elgg_set_plugin_user_setting("social_connect_{$provider}/uid", $uid, 'elgg_hybridauth');
            $i++;
        }
    }
}
system_message(elgg_echo('hybridauth:admin:social_connect:action', array($i)));
forward(REFERER);
开发者ID:n8b,项目名称:VMN,代码行数:30,代码来源:social_connect.php

示例14: foreach

    foreach ($users as $user) {
        $setting = elgg_get_plugin_user_setting("notify_mention", $user->getGUID(), "thewire_tools");
        if ($setting == "yes") {
            $notification_settings = get_user_notification_settings($user->getGUID());
            if (!empty($notification_settings)) {
                $notification_settings = (array) $notification_settings;
                $methods = array();
                foreach ($notification_settings as $method => $value) {
                    if ($value == "yes") {
                        $methods[] = $method;
                    }
                }
                if (!empty($methods)) {
                    elgg_set_plugin_user_setting("notification_settings", implode(",", $methods), $user->getGUID(), "thewire_tools");
                }
            }
        }
        if (!elgg_unset_plugin_user_setting("notify_mention", $user->getGUID(), "thewire_tools")) {
            $error_count++;
        } else {
            $success_count++;
        }
    }
}
access_show_hidden_entities($access_status);
// replace events and hooks
_elgg_services()->events = $original_events;
_elgg_services()->hooks = $original_hooks;
_elgg_services()->db->enableQueryCache();
// Give some feedback for the UI
echo json_encode(array("numSuccess" => $success_count, "numErrors" => $error_count));
开发者ID:Twizanex,项目名称:thewire_tools,代码行数:31,代码来源:mentions.php

示例15: get_input

<?php

$user_guid = (int) get_input('user_guid');
$user = get_user($user_guid);
if (empty($user)) {
    register_error(elgg_echo('error:missing_data'));
    forward(REFERER);
}
if ($user->isAdmin()) {
    register_error(elgg_echo('site_announcements:action:toggle_editor:error:is_admin', array($user->name)));
    forward(REFERER);
}
if (site_announcements_is_editor($user)) {
    elgg_unset_plugin_user_setting('editor', $user->getGUID(), 'site_announcements');
    system_message(elgg_echo('site_announcements:action:toggle_editor:unmake', array($user->name)));
} else {
    elgg_set_plugin_user_setting('editor', time(), $user->getGUID(), 'site_announcements');
    system_message(elgg_echo('site_announcements:action:toggle_editor:make', array($user->name)));
}
forward(REFERER);
开发者ID:lorea,项目名称:Hydra-dev,代码行数:20,代码来源:toggle_editor.php


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