/** * 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); }
/** * 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; }
/** * */ 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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()); } } } } } } }
/** * 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; }
/** * 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); } } } } } }
/** * 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); } }
/** * 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'); } }
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; }
<?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>';
* **/ ?> /* *************************************** 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;
} // Make sure the message field, send to field and title are not blank if (!$body || !$subject) { register_error(elgg_echo("messages:blank")); forward("messages/compose"); } // Otherwise, encrypt and 'send' the message elgg_load_library('elggpg'); elgg_load_library('elggpg:send:override'); if (elgg_get_plugin_user_setting('encrypt_site_messages', elgg_get_logged_in_user_guid(), 'elggpg') == 'yes') { $body_from = elggpg_encrypt($body, elgg_get_logged_in_user_entity(), false); } if (!$body_from) { $body_from = $body; } if (elgg_get_plugin_user_setting('encrypt_site_messages', $user->guid, 'elggpg') == 'yes') { $body_to = elggpg_encrypt($body, $user, false); } if (!$body_to) { $body_to = $body; } // override of messages send to be able to save versions encrypted for both users $result = messages_send_override($subject, $body_to, $body_from, $recipient_guid, 0, $reply); // Save 'send' the message if (!$result) { register_error(elgg_echo("messages:error")); forward("messages/compose"); } elgg_clear_sticky_form('messages'); system_message(elgg_echo("messages:posted")); forward('messages/inbox/' . elgg_get_logged_in_user_entity()->username);
<!-- Google Analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); </script> <!-- End Google Analytics --> <script src="//tinymce.cachefly.net/4.2/tinymce.min.js"></script> <script> <?php $minds = array("LoggedIn" => Minds\Core\Session::isLoggedIn() ? true : false, "Admin" => Minds\Core\Session::isAdmin() ? true : false, "cdn_url" => Minds\Core\Config::_()->get('cdn_url') ?: Minds\Core\Config::_()->cdn_url, "site_url" => Minds\Core\Config::_()->get('site_url') ?: Minds\Core\Config::_()->site_url, "socket_server" => Minds\Core\Config::_()->get('sockets-server-uri') ?: 'ha-socket-io-us-east-1.minds.com:3030', "navigation" => Minds\Core\Navigation\Manager::export()); if (Minds\Core\Session::isLoggedIn()) { $minds['user'] = Minds\Core\Session::getLoggedinUser()->export(); $minds['user']['chat'] = (bool) elgg_get_plugin_user_setting('option', Minds\Core\Session::getLoggedinUser()->guid, 'gatherings') == 1 ? true : false; $minds['wallet'] = array('balance' => Minds\Helpers\Counters::get(Minds\Core\Session::getLoggedinUser()->guid, 'points', false)); } ?> window.Minds = <?php echo json_encode($minds); ?> ; System.import('app') .catch(function(){console.error(e,'Report this error at https://github.com/minds/front')}); </script> </body> </html>
<?php if (!HYPEFORUM_USER_SIGNATURE) { return true; } $entity = elgg_extract('entity', $vars); $signature = elgg_get_plugin_user_setting('hypeforum_signature', $entity->guid, 'hypeForum'); if ($signature) { echo elgg_view('output/longtext', array('value' => $signature, 'class' => 'hj-forum-user-signature')); }
<?php /** * User settings for Twitter API */ $user = elgg_get_logged_in_user_entity(); $user_guid = $user->getGUID(); $twitter_name = elgg_get_plugin_user_setting('twitter_name', $user_guid, 'twitter_api'); $access_key = elgg_get_plugin_user_setting('access_key', $user_guid, 'twitter_api'); $access_secret = elgg_get_plugin_user_setting('access_secret', $user_guid, 'twitter_api'); $site_name = elgg_get_site_entity()->name; echo '<div>' . elgg_echo('twitter_api:usersettings:description', array($site_name)) . '</div>'; if (!$access_key || !$access_secret) { // send user off to validate account $request_link = twitter_api_get_authorize_url(null, false); echo '<div>' . elgg_echo('twitter_api:usersettings:request', array($request_link, $site_name)) . '</div>'; } else { // if this user logged in through twitter and never set up an email address, don't // let them disassociate their account. if ($user->email) { $url = elgg_get_site_url() . "twitter_api/revoke"; echo '<div>' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '</div>'; echo '<div>' . sprintf(elgg_echo('twitter_api:usersettings:revoke'), $url) . '</div>'; } else { echo elgg_echo('twitter_api:usersettings:cannot_revoke', array(elgg_normalize_url('twitter_api/interstitial'))); } }
/** * Update the Elgg profile with LinkedIn data * * @param int $user_guid the user_guid of the profile to update * * @return void */ function socialink_linkedin_sync_profile_metadata($user_guid = 0) { global $CONFIG; if (empty($user_guid)) { $user_guid = elgg_get_logged_in_user_guid(); } // can we get a user if (($user = get_user($user_guid)) && socialink_linkedin_is_connected($user_guid)) { // does the user allow sync if (elgg_get_plugin_user_setting("linkedin_sync_allow", $user->getGUID(), "socialink") != "no") { // get configured fields and network fields if (($configured_fields = socialink_get_configured_network_fields("linkedin")) && ($network_fields = socialink_get_network_fields("linkedin"))) { // ask the api for all fields if ($api_result = socialink_linkedin_get_profile_information($user->getGUID())) { $api_result = json_decode($api_result); // check settings for each field foreach ($configured_fields as $setting_name => $profile_field) { $setting = "linkedin_sync_" . $setting_name; if (elgg_get_plugin_user_setting($setting, $user->getGUID(), "socialink") != "no") { $api_setting = $network_fields[$setting_name]; // get the correct value from api result if (stristr($api_setting, "->")) { $temp_fields = explode("->", $api_setting); $temp_result = $api_result; for ($i = 0; $i < count($temp_fields); $i++) { $temp_result = $temp_result->{$temp_fields}[$i]; } } else { $temp_result = $api_result->{$api_setting}; } // are we dealing with a tags profile field type if (!empty($CONFIG->profile) && is_array($CONFIG->profile)) { if (array_key_exists($profile_field, $CONFIG->profile) && $CONFIG->profile[$profile_field] == "tags") { $temp_result = string_to_tag_array($temp_result); } } // check if the user has this metadata field, to get access id $params = array("guid" => $user->getGUID(), "metadata_name" => $profile_field, "limit" => false); if ($metadata = elgg_get_metadata($params)) { if (is_array($metadata)) { $access_id = $metadata[0]->access_id; } else { $access_id = $metadata->access_id; } } else { $access_id = get_default_access($user); } // remove metadata to set new values elgg_delete_metadata($params); // make new metadata field if (!empty($temp_result)) { if (is_array($temp_result)) { foreach ($temp_result as $index => $temp_value) { if ($index > 0) { $multiple = true; } else { $multiple = false; } create_metadata($user->getGUID(), $profile_field, $temp_value, 'text', $user->getGUID(), $access_id, $multiple); } } else { create_metadata($user->getGUID(), $profile_field, $temp_result, 'text', $user->getGUID(), $access_id); } } } } } } // sync profile icon, only if the user has no icon if (empty($user->icontime)) { socialink_linkedin_sync_profile_icon($user->getGUID()); } } } }
<?php /** * Elgg sent messages page * * @package ElggMessages */ gatekeeper(); $page_owner = elgg_get_page_owner_entity(); if (!$page_owner) { register_error(elgg_echo()); forward(); } elgg_push_breadcrumb(elgg_echo('messages:sent')); elgg_register_title_button(); $title = elgg_echo('messages:sentmessages', array($page_owner->name)); $offset = (int) get_input('offset', 0); // Get limit $limit = elgg_get_plugin_user_setting("limit", $page_owner->guid, "messages"); if (!$limit) { $limit = 15; } $messages = elgg_get_entities_from_metadata(array('type' => 'object', 'subtype' => 'messages', 'metadata_name' => 'fromId', 'metadata_value' => $page_owner->guid, 'owner_guid' => $page_owner->guid, 'limit' => $limit, 'offset' => $offset)); $count = elgg_get_entities_from_metadata(array('type' => 'object', 'subtype' => 'messages', 'metadata_name' => 'fromId', 'metadata_value' => $page_owner->guid, 'owner_guid' => $page_owner->guid, 'count' => true)); $body_vars = array('folder' => 'sent', 'messages' => $messages, 'count' => $count, 'offset' => $offset, 'limit' => $limit); $content = elgg_view_form('messages/process', array(), $body_vars); $sidebar = elgg_view('messages/sidebar'); $body = elgg_view_layout('content', array('content' => $content, 'title' => $title, 'filter' => '', 'sidebar' => $sidebar)); echo elgg_view_page($title, $body);
/** * Prevents users from joining a subgroup if they're not a member of the parent * * @param type $event * @param type $type * @param ElggRelationship $object * @return boolean */ function au_subgroups_join_group($event, $type, $object) { if ($object instanceof ElggRelationship) { $user = get_entity($object->guid_one); $group = get_entity($object->guid_two); $parent = au_subgroups_get_parent_group($group); // use temp global config to decide if we should prevent joining // prevent joining if not a member of the parent group // except during a subgroup move invitation $au_subgroups_ignore_join = elgg_get_config('au_subgroups_ignore_join'); if ($parent && !$au_subgroups_ignore_join) { // cover the case of moved subgroups // user will have been invited, and have a plugin setting saying which other groups to join $invited = check_entity_relationship($group->guid, 'invited', $user->guid); $children_to_join = elgg_get_plugin_user_setting('invitation_' . $group->guid, $user->guid, 'au_subgroups'); if (!empty($children_to_join)) { $children_to_join = unserialize($children_to_join); } if ($invited) { elgg_set_config('au_subgroups_ignore_join', true); // we have been invited in through the back door by a subgroup move // join this user to all parent groups fo this group if (au_subgroups_join_parents_recursive($group, $user)) { // we're in, now lets rejoin the children if (is_array($children_to_join)) { $children_guids = au_subgroups_get_all_children_guids($group); foreach ($children_to_join as $child) { if (in_array($child, $children_guids)) { $child_group = get_entity($child); $child_group->join($user); } } } // delete plugin setting elgg_set_plugin_user_setting('invitation_' . $group->guid, '', $user->guid, 'au_subgroups'); } else { // something went wrong with joining the groups // lets stop everything now return false; } } elseif (!$parent->isMember($user)) { register_error(elgg_echo('au_subgroups:error:notparentmember')); return false; } } } }
<?php /** * Messages folder view (inbox, sent) * * Provides form body for mass deleting messages * * @uses $vars['messages'] List of messages * @uses $vars['count'] Count of messages * @uses $vars['offset'] Offset on queries of messages * @uses $vars['limit'] Limit on queries of messages * */ $messages = $vars['messages']; // Show excerpt $excerpt = elgg_get_plugin_user_setting("excerpt", $user_guid, "messages"); if (!$excerpt) { $excerpt = false; } // Set up pagination $pagination = elgg_view('navigation/pagination', array('base_url' => $_SERVER['REQUEST_URI'], 'offset' => $vars['offset'], 'count' => $vars['count'], 'limit' => $vars['limit'])); echo $pagination; echo '<table class="elgg-table">'; echo '<tr>'; if ($vars['folder'] == "inbox") { echo "<th class='msg-list-owner'>" . elgg_echo('messages:from') . "</th>"; } elseif ($vars['folder'] == "find") { echo "<th class='msg-list-owner'>" . elgg_echo('messages:who') . "</th>"; } else { echo "<th class='msg-list-owner'>" . elgg_echo('messages:to') . "</th>"; }
register_error(elgg_echo('activity_tabs:invalid:id')); forward('activity', 'activity_tabs_invalid_id'); } if ($subtype) { $selector = "type={$type}&subtype={$subtype}"; } else { $selector = "type={$type}"; } if ($type != 'all') { $options['type'] = $type; if ($subtype) { $options['subtype'] = $subtype; } } // deal with the special case of group access collection $display = elgg_get_plugin_user_setting('group_' . $id . '_display', elgg_get_logged_in_user_guid(), PLUGIN_ID); if ($page_type == 'group' && $display != 'group') { $page_type = 'collection'; $id = get_entity($id)->group_acl; } switch ($page_type) { case 'user': $title = elgg_echo('activity_tabs:user'); $page_filter = 'activity_tab'; $options['subject_guid'] = $id; break; case 'group': $db_prefix = elgg_get_config('dbprefix'); $title = elgg_echo('activity_tabs:group'); $page_filter = 'activity_tab'; $options['joins'] = array("JOIN {$db_prefix}entities e ON e.guid = rv.object_guid");
<?php /** * Renders a list of discussions, optionally filtered by container type * * @uses $vars['container_type'] Container type filter to apply */ $options = array('type' => 'object', 'subtype' => 'discussion', 'order_by' => 'e.last_action desc', 'limit' => elgg_extract('limit', $vars, max(20, elgg_get_config('default_limit'))), 'full_view' => false, 'no_results' => elgg_echo('discussion:none'), 'preload_owners' => true, 'preload_containers' => true, 'list_id' => 'discussions-all', 'base_url' => elgg_normalize_url('discussion/all'), 'pagination_type' => 'infinite', 'pagination' => elgg_extract('pagination', $vars)); $container_type = elgg_extract('container_type', $vars); if ($container_type) { $dbprefix = elgg_get_config('dbprefix'); $container_type = sanitize_string($container_type); $options['joins'][] = "JOIN {$dbprefix}entities ce ON ce.guid = e.container_guid"; $options['wheres'][] = "ce.type = '{$container_type}'"; } $enable_sort = elgg_get_plugin_setting('enable_sort', 'hypeDiscussions'); $sort = elgg_get_plugin_user_setting('sort_discussions', 0, 'hypeDiscussions', 'last_action::desc'); if ($enable_sort) { $sort = get_input('sort', $sort); } echo elgg_view('lists/objects', ['show_filter' => $enable_sort, 'filter_target' => elgg_get_logged_in_user_entity(), 'show_search' => $enable_sort, 'show_sort' => $enable_sort, 'sort_options' => ['last_action::desc', 'last_action::asc', 'time_created::desc', 'time_created::asc', 'responses_count::desc', 'likes_count::desc'], 'sort' => $sort, 'options' => $options]);
<?php $user = $vars['user']; $enable_chat = elgg_get_plugin_user_setting('enableChat', $user->getGUID(), 'elggchat'); if (empty($enable_chat)) { $enable_chat = "yes"; } $allow_contact_from = elgg_get_plugin_user_setting('allow_contact_from', $user->getGUID(), 'elggchat'); if (empty($allow_contact_from)) { $allow_contact_from = "friends"; } $show_offline_user = elgg_get_plugin_user_setting('show_offline_user', $user->getGUID(), 'elggchat'); if (empty($show_offline_user)) { $show_offline_user = "******"; } echo "<div class='mbm'>" . elgg_echo('elggchat:usersettings:enable_chat'); echo elgg_view('input/select', array('name' => 'params[enableChat]', 'options_values' => array('yes' => elgg_echo("option:yes"), 'no' => elgg_echo("option:no")), 'value' => $enable_chat)) . "</div>"; echo "<div class='mbm'>" . elgg_echo('elggchat:usersettings:allow_contact_from'); echo elgg_view('input/select', array('name' => 'params[allow_contact_from]', 'options_values' => array('all' => elgg_echo("elggchat:usersettings:allow_contact_from:all"), 'friends' => elgg_echo("elggchat:usersettings:allow_contact_from:friends"), 'none' => elgg_echo("elggchat:usersettings:allow_contact_from:none")), 'value' => $allow_contact_from)) . "</div>"; echo "<div class='mbm'>" . elgg_echo('elggchat:usersettings:show_offline_user'); echo elgg_view('input/select', array('name' => 'params[show_offline_user]', 'options_values' => array('yes' => elgg_echo("option:yes"), 'no' => elgg_echo("option:no")), 'value' => $show_offline_user)) . "</div>"; echo "<div class='elgg-foot'>" . elgg_view('input/hidden', array('name' => 'guid', 'value' => $user->guid)); echo elgg_view('input/submit', array('value' => elgg_echo('save'))) . "</div>";
<?php $folder = elgg_extract("entity", $vars); $full_view = elgg_extract("full_view", $vars, false); $time_preference = "date"; if ($user_time_preference = elgg_get_plugin_user_setting('bookmark_tools_time_display', null, "bookmark_tools")) { $time_preference = $user_time_preference; } elseif ($site_time_preference = elgg_get_plugin_setting("bookmark_tools_default_time_display", "bookmark_tools")) { $time_preference = $site_time_preference; } if ($time_preference == 'date') { $friendlytime = date(elgg_echo("friendlytime:date_format"), $folder->time_created); } else { $friendlytime = elgg_view_friendly_time($folder->time_created); } $title = $folder->title; $entity_menu = ""; if (!elgg_in_context("widgets")) { $entity_menu = elgg_view_menu("entity", array("entity" => $folder, "handler" => "bookmark_tools/bmfolder", "sort_by" => "priority", "class" => "elgg-menu-hz")); } if ($full_view) { // full view $icon = elgg_view_entity_icon($folder, "small"); $owner_link = elgg_view("output/url", array("text" => $folder->getOwnerEntity()->name, "href" => $folder->getOwnerEntity()->getURL())); $owner_text = elgg_echo("byline", array($owner_link)); $subtitle = "{$owner_text} {$friendlytime}"; $params = array("entity" => $folder, "metadata" => $entity_menu, "tags" => elgg_view("output/tags", array("value" => $folder->tags)), "subtitle" => $subtitle); $params = $params + $vars; $summary = elgg_view("object/elements/summary", $params); echo elgg_view("object/elements/full", array("entity" => $folder, "title" => false, "icon" => $icon, "summary" => $summary, "body" => elgg_view("output/longtext", array("value" => $folder->description)))); } else {
<?php /** * Infinite scroll plugin settings */ $logged_in_user = elgg_get_logged_in_user_guid(); // set default value if (!($pagination_type = elgg_get_plugin_user_setting('pagination_type', $logged_in_user, 'infinite_scroll'))) { $pagination_type = 'automatic'; } echo '<div>'; echo elgg_echo('infinite_scroll:settings:pagination_type'); echo ' '; echo elgg_view('input/dropdown', array('name' => 'params[pagination_type]', 'options_values' => array('classic' => elgg_echo('infinite_scroll:settings:pagination:classic'), 'button' => elgg_echo('infinite_scroll:settings:pagination:button'), 'automatic' => elgg_echo('infinite_scroll:settings:pagination:automatic')), 'value' => $pagination_type)); echo '</div>';
/** * Get a user specific setting for a plugin. * * @param string $name The name. * @param int $user_guid Guid of owning user * @param string $plugin_id Optional plugin name, if not specified * it is detected from where you are calling. * * @deprecated 1.8 Use elgg_get_plugin_user_setting() or ElggPlugin->getUserSetting() * @return mixed */ function get_plugin_usersetting($name, $user_guid = 0, $plugin_id = "") { elgg_deprecated_notice('get_plugin_usersetting() is deprecated by elgg_get_plugin_user_setting()', 1.8); return elgg_get_plugin_user_setting($name, $user_guid, $plugin_id); }
/** * Get tweets for a user. * * @param int $user_id The Elgg user GUID * @param array $options */ function twitter_api_fetch_tweets($user_guid, $options = array()) { // check admin settings $consumer_key = elgg_get_plugin_setting('consumer_key', 'twitter_api'); $consumer_secret = elgg_get_plugin_setting('consumer_secret', 'twitter_api'); if (!($consumer_key && $consumer_secret)) { return FALSE; } // check user settings $access_key = elgg_get_plugin_user_setting('access_key', $user_guid, 'twitter_api'); $access_secret = elgg_get_plugin_user_setting('access_secret', $user_guid, 'twitter_api'); if (!($access_key && $access_secret)) { return FALSE; } // fetch tweets $api = new TwitterOAuth($consumer_key, $consumer_secret, $access_key, $access_secret); return $api->get('statuses/user_timeline', $options); }