本文整理汇总了PHP中elgg_get_plugin_user_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_plugin_user_setting函数的具体用法?PHP elgg_get_plugin_user_setting怎么用?PHP elgg_get_plugin_user_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_get_plugin_user_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_friends_can_view_friends
/**
* Determines if $viewer has access to $user's friends list
*
* @param ElggUser $user User whose friends are to be displayed
* @param ElggUser $viewer Viewer
* @return bool
*/
function user_friends_can_view_friends(ElggUser $user, ElggUser $viewer = null)
{
if (!isset($viewer)) {
$viewer = elgg_get_logged_in_user_entity();
}
$permission = false;
if ($viewer && elgg_check_access_overrides($viewer->guid)) {
$permission = true;
}
$setting = elgg_get_plugin_user_setting('friend_list_visibility', $user->guid, 'user_friends');
if (!isset($setting)) {
$setting = elgg_get_plugin_setting('friend_list_visibility', 'user_friends', ACCESS_PUBLIC);
}
switch ((int) $setting) {
case ACCESS_PRIVATE:
$permission = $viewer && $user->canEdit($viewer->guid);
break;
case ACCESS_FRIENDS:
$permission = $viewer && $user->isFriendsWith($viewer->guid);
break;
case ACCESS_LOGGED_IN:
$permission = $viewer;
break;
case ACCESS_PUBLIC:
$permission = true;
break;
}
$params = array('viewer' => $viewer, 'user' => $user);
return elgg_trigger_plugin_hook('permissions_check:view_friends_list', 'user', $params, $permission);
}
示例2: admin_tools_is_admin_user
/**
* Check if the user is an admin
*
* @param ElggUser $user the user to check (default: current user)
*
* @return bool
*/
function admin_tools_is_admin_user(ElggUser $user = null)
{
// no param, check current logged in user
if (empty($user)) {
$user = elgg_get_logged_in_user_entity();
}
// no user to check
if (!$user instanceof ElggUser) {
return false;
}
// user is admin
if ($user->isAdmin()) {
return true;
}
// is user a hidden admin?
$setting = elgg_get_plugin_user_setting('switched_admin', $user->getGUID(), 'admin_tools');
if (empty($setting)) {
return false;
}
// validate setting
if (admin_tools_validate_switch_admin_secret($setting, $user)) {
return true;
}
return false;
}
示例3: setUp
/**
*
*/
public function setUp($hook, $type, $menu, $params)
{
if (!elgg_is_logged_in()) {
return $menu;
}
$user = elgg_get_logged_in_user_entity();
if (!$user->isAdmin() && $user->role !== 'curator') {
return $menu;
}
$entity = $params['entity'];
if (elgg_get_plugin_user_setting('not_exposable', $entity->owner_guid, 'expozeum') == false) {
// We don't want to feature users, sites nor groups
if (!elgg_instanceof($entity, 'object', 'hjalbumimage')) {
return $menu;
}
if ($entity->expozeum) {
$action = 'unexpozeum';
$icon = 'eye-alt';
//$text = 'unexpozeum';
} else {
$action = 'expozeum';
$icon = 'eye';
//$text = 'expozeum';
}
$menu[] = ElggMenuItem::factory(array('name' => 'expozeum', 'text' => elgg_view_icon($icon), 'href' => "action/expozeum_content/{$action}?guid={$entity->guid}", 'is_action' => true));
return $menu;
}
return $menu;
}
示例4: containerPermissionsCheck
/**
* Allow users to post on each other's walls
* Container here is the wall, and can be a user or group
*
* @param string $hook Equals 'container_permissions_check'
* @param string $type Equals 'object'
* @param boolean $return Current permission
* @param array $params Additional params
* @return boolean Filtered permission
*/
public function containerPermissionsCheck($hook, $type, $return, $params)
{
$container = elgg_extract('container', $params);
$user = elgg_extract('user', $params);
$subtype = elgg_extract('subtype', $params);
if ($subtype !== Post::SUBTYPE) {
return $return;
}
if (!$container instanceof ElggUser) {
return $return;
}
if (!$user instanceof ElggUser) {
return $return;
}
if ($container->isFriend($user)) {
return true;
} else {
$third_party_wall_global = elgg_get_plugin_setting('third_party_wall', 'hypeWall');
$third_party_wall_user = elgg_get_plugin_user_setting('third_party_wall', $container->guid, 'hypeWall');
if ($third_party_wall_global && $third_party_wall_user) {
return true;
}
}
return $return;
}
示例5: socialink_wordpress_is_connected
/**
* Check if the user is connected to a Wordpress account
*
* @param int $user_guid the user_guid to check
*
* @return bool
*/
function socialink_wordpress_is_connected($user_guid = 0)
{
$result = false;
if (empty($user_guid)) {
$user_guid = elgg_get_logged_in_user_guid();
}
if (!empty($user_guid) && ($keys = socialink_wordpress_available())) {
$oauth_token = elgg_get_plugin_user_setting("wordpress_oauth_token", $user_guid, "socialink");
$oauth_secret = elgg_get_plugin_user_setting("wordpress_oauth_secret", $user_guid, "socialink");
if (!empty($oauth_token) && !empty($oauth_secret)) {
$result = $keys;
$result["oauth_token"] = $oauth_token;
$result["oauth_secret"] = $oauth_secret;
}
}
return $result;
}
示例6: messages_gatekeeper
/**
* Make sure non-friends messages can't be sent to people who has selected
* to receive messages from friends only
*
* uses $recipient_guid
* @return bool
*/
function messages_gatekeeper($recipient_guid)
{
$loggedin_guid = elgg_get_logged_in_user_guid();
$result = "ok";
if (!($send_to = get_user($recipient_guid))) {
return "error";
}
if (!$send_to instanceof ElggUser) {
return "error";
}
// Only relevant if you have activated friendsonly option in plugin settings
if (elgg_get_plugin_setting('enableprivacy', 'messages') == 'yes') {
if (elgg_get_plugin_user_setting('friendsonly', $loggedin_guid, 'messages') == 'yes') {
if ($recipient_guid) {
if (!$send_to->isFriend()) {
$result = "warning";
}
}
}
if (elgg_get_plugin_user_setting('friendsonly', $send_to->guid, 'messages') == 'yes') {
if ($recipient_guid) {
if (!$send_to->isFriend()) {
$result = "reject";
}
}
}
}
// Only relevant if you have notfriends plugin enabled
if (elgg_is_active_plugin('notfriends')) {
if (notfriends_check($send_to->guid)) {
$result = "blocked";
}
if (notfriends_check_inverse($send_to->guid)) {
$result = "blocked";
}
}
// Admin override
if (elgg_is_admin_logged_in()) {
if ($result != 'ok') {
$result = 'override';
}
}
return $result;
}
示例7: site_announcements_is_editor
/**
* Check if a user is an editor
*
* @param ElggUser $user (optional) the user to check, defaults to loggedin user
*
* @return bool
*/
function site_announcements_is_editor(ElggUser $user = null)
{
if (empty($user) || !$user instanceof ElggUser) {
$user = elgg_get_logged_in_user_entity();
}
if (empty($user)) {
return false;
}
// admins are always editors
if ($user->isAdmin()) {
return true;
}
// check normal users
$setting = elgg_get_plugin_user_setting('editor', $user->getGUID(), 'site_announcements');
if (!empty($setting)) {
return true;
}
return false;
}
示例8: socialink_create_object_handler
/**
* listen to the object creation event
*
* @param string $event the name of the event
* @param string $entity_type the type of the event
* @param ElggObject $entity supplied entity
*
* @return void
*/
function socialink_create_object_handler($event, $entity_type, $entity)
{
if (!empty($entity) && elgg_instanceof($entity, "object", "thewire")) {
if ($networks = socialink_get_available_networks()) {
foreach ($networks as $network) {
$setting = elgg_get_plugin_user_setting("thewire_post_" . $network, $entity->getOwner(), "socialink");
if ($setting == "yes") {
$connected = "socialink_" . $network . "_is_connected";
if (is_callable($connected) && call_user_func($connected)) {
$post_message = "socialink_" . $network . "_post_message";
if (is_callable($post_message)) {
call_user_func($post_message, $entity->description, $entity->getOwner());
}
}
}
}
}
}
}
示例9: container_permissions_check
/**
* Allow users to post on each other's walls
* Container here is the wall, and can be a user or group
* @param type $hook
* @param type $type
* @param type $return
* @param type $params
* @return boolean
*/
function container_permissions_check($hook, $type, $return, $params)
{
$container = elgg_extract('container', $params);
$user = elgg_extract('user', $params);
$subtype = elgg_extract('subtype', $params);
if ($subtype !== 'hjwall') {
return $return;
}
if (elgg_instanceof($container, 'user') && elgg_instanceof($user, 'user')) {
if ($container->isFriend($user)) {
return true;
} else {
$third_party_wall_global = elgg_get_plugin_setting('third_party_wall', PLUGIN_ID);
$third_party_wall_user = elgg_get_plugin_user_setting('third_party_wall', $container->guid, PLUGIN_ID);
if ($third_party_wall_global && $third_party_wall_user) {
return true;
}
}
}
return $return;
}
示例10: thewire_tools_create_object_event_handler
/**
* This functions performs actions when a wire post is created
*
* @param string $event 'create'
* @param string $type 'object'
* @param ElggObject $object the ElggObject created
*
* @return void
*/
function thewire_tools_create_object_event_handler($event, $type, $object)
{
if (elgg_instanceof($object, "object", "thewire")) {
//send out notification to users mentioned in a wire post
$usernames = array();
if (preg_match_all("/\\@([A-Za-z0-9\\_\\.\\-]+)/i", $object->description, $usernames)) {
$usernames = array_unique($usernames[0]);
foreach ($usernames as $username) {
$username = str_ireplace("@", "", $username);
$user = get_user_by_username($username);
if (!empty($user) && $user->getGUID() != $object->getOwnerGUID()) {
$user_setting = elgg_get_plugin_user_setting("notify_mention", $user->getGUID(), "thewire_tools");
if ($user_setting === "yes") {
$subject = elgg_echo("thewire_tools:notify:mention:subject");
$message = elgg_echo("thewire_tools:notify:mention:message", array($user->name, $object->getOwnerEntity()->name, elgg_get_site_url() . "thewire/search/@" . $user->username));
notify_user($user->getGUID(), $object->getOwner(), $subject, $message);
}
}
}
}
}
}
示例11: checkFixedWidgets
/**
* Updates fixed widgets on profile and dashboard
*
* @param string $hook_name name of the hook
* @param string $entity_type type of the hook
* @param unknown $return_value return value
* @param unknown $params hook parameters
*
* @return void
*/
public static function checkFixedWidgets($hook_name, $entity_type, $return_value, $params)
{
$context = elgg_get_context();
if (!in_array($context, ['profile', 'dashboard'])) {
// only check things if you are viewing a profile or dashboard page
return;
}
$page_owner_guid = elgg_get_page_owner_guid();
if (empty($page_owner_guid)) {
return;
}
$fixed_ts = elgg_get_plugin_setting($context . '_fixed_ts', 'widget_manager');
if (empty($fixed_ts)) {
// there should always be a fixed ts, so fix it now. This situation only occurs after activating widget_manager the first time.
$fixed_ts = time();
elgg_set_plugin_setting($context . '_fixed_ts', $fixed_ts, 'widget_manager');
}
// get the ts of the profile/dashboard you are viewing
$user_fixed_ts = elgg_get_plugin_user_setting($context . '_fixed_ts', $page_owner_guid, 'widget_manager');
if ($user_fixed_ts < $fixed_ts) {
widget_manager_update_fixed_widgets($context, $page_owner_guid);
}
}
示例12: infinite_scroll_init
/**
* Initialize the infinite scroll plugin.
*
*/
function infinite_scroll_init()
{
if (elgg_get_plugin_user_setting('pagination_type') != 'classic') {
elgg_register_ajax_view('infinite_scroll/list');
// Extend the main css view
elgg_extend_view('css/elgg', 'infinite_scroll/css');
// register the infinite scroll's JavaScript
$infinite_scroll_js = elgg_get_simplecache_url('js', 'infinite_scroll/infinite_scroll');
elgg_register_simplecache_view('js/infinite_scroll/infinite_scroll');
elgg_register_js('elgg.infinite_scroll', $infinite_scroll_js);
if (elgg_get_plugin_user_setting('pagination_type') == 'automatic') {
// Register javascript needed for automatic pagination
$js_url = 'mod/infinite_scroll/vendors/jquery-waypoints/waypoints.min.js';
elgg_register_js('jquery-waypoints', $js_url);
$automatic_pagination_js = elgg_get_simplecache_url('js', 'infinite_scroll/automatic_pagination');
elgg_register_simplecache_view('js/infinite_scroll/automatic_pagination');
elgg_register_js('elgg.infinite_scroll.automatic_pagination', $automatic_pagination_js);
}
$new_items_js = elgg_get_simplecache_url('js', 'infinite_scroll/new_items');
elgg_register_simplecache_view('js/infinite_scroll/new_items');
elgg_register_js('elgg.infinite_scroll.new_items', $new_items_js);
elgg_extend_view('navigation/pagination', 'infinite_scroll/initialize_js');
}
}
示例13: private_profiles_pm_intercept
function private_profiles_pm_intercept($hook, $type, $result, $params)
{
$subject = strip_tags(get_input('subject'));
$body = get_input('body');
$recipient_username = get_input('recipient_username');
$original_msg_guid = (int) get_input('original_guid');
elgg_make_sticky_form('messages');
$user = get_user_by_username($recipient_username);
if (!$user || elgg_is_admin_logged_in() || $user->isAdmin()) {
return $result;
}
$logged_in_user = elgg_get_logged_in_user_entity();
$custom_access_setting = elgg_get_plugin_setting('custom_access_setting', 'private_profiles');
if (!$custom_access_setting) {
$custom_access_setting = 'yes';
}
if ($custom_access_setting == 'no') {
$default_messages_setting = elgg_get_plugin_setting('default_messages_setting', 'private_profiles');
if (!$default_messages_setting) {
$default_messages_setting = 'friends';
}
if ($default_messages_setting == 'yes' || $default_messages_setting == 'friends' && ($logged_in_user && $logged_in_user->isFriendOf($user->getGUID()))) {
return $result;
}
} else {
$user_messages_setting = elgg_get_plugin_user_setting('user_messages_setting', $user->getGUID(), 'private_profiles');
if (!$user_messages_setting) {
$default_messages_setting = elgg_get_plugin_setting('default_messages_setting', 'private_profiles');
if (!$default_messages_setting) {
$default_messages_setting = 'friends';
}
$user_messages_setting = $default_messages_setting;
}
if ($user_messages_setting == 'yes' || $user_messages_setting == 'friends' && ($logged_in_user && $logged_in_user->isFriendOf($user->getGUID()))) {
return $result;
}
}
register_error(elgg_echo('private_profiles:sending_denied'));
forward("messages/compose");
return false;
}
示例14: elgg_view
<?php
/**
* @package Deyan
* @author Angel Gabriel
* @web http://angelgabriel.tk
* @mail angel.wrt@gmail.com
*
* @form deyan/panel
*
* Shows an checkbox option to show an avatar in user menu on panel
*
**/
// Use avatar on user menu?
echo '<div>';
echo elgg_view("input/checkboxes", array(
'options' => array(elgg_echo('deyan:panel:avatar') => elgg_echo('deyan:panel:avatar')),
'name' => 'avatar_panel',
'value' => (elgg_get_plugin_user_setting('avatar_panel', $vars['user']->guid, 'deyan') ? elgg_echo('deyan:panel:avatar') : ""),
));
echo '</div>';
echo "<div class=\"clearfloat\">";
echo elgg_view('input/submit', array('value' => elgg_echo('save')));
echo '</div>';
示例15: if
*
**/
?>
/* ***************************************
BACKGROUND
*****************************************/
body {
background: <?php echo $vars['theme']['background']; ?>;
}
/* ***************************************
WINDOWS SCROLL
*****************************************/
.elgg-main {
<?php if(elgg_get_plugin_user_setting('window_scroll', $vars['user']->guid, 'deyan') == 1) {
echo " height: 500px; overflow: auto;";
}
else {
echo " min-height: 500px;";
}?>
}
/* ***************************************
AVATAR Panel
*****************************************/
.deyan-panel-avatar {
width: 30px;
height: 30px;
border-radius: 5px;
margin-top: -8px;