function bp_forums_directory_forums_setup() { global $bp; if (bp_is_forums_component() && (!bp_current_action() || 'tag' == bp_current_action() && bp_action_variables()) && !bp_current_item()) { if (!bp_forums_has_directory()) { return false; } if (!bp_forums_is_installed_correctly()) { bp_core_add_message(__('The forums component has not been set up yet.', 'buddypress'), 'error'); bp_core_redirect(bp_get_root_domain()); } bp_update_is_directory(true, 'forums'); do_action('bbpress_init'); // Check to see if the user has posted a new topic from the forums page. if (isset($_POST['submit_topic']) && bp_is_active('forums')) { check_admin_referer('bp_forums_new_topic'); $bp->groups->current_group = groups_get_group(array('group_id' => $_POST['topic_group_id'])); if (!empty($bp->groups->current_group->id)) { // Auto join this user if they are not yet a member of this group if (!is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member($bp->loggedin_user->id, $bp->groups->current_group->id)) { groups_join_group($bp->groups->current_group->id); } $error_message = ''; $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id'); if (!empty($forum_id)) { if (empty($_POST['topic_title'])) { $error_message = __('Please provide a title for your forum topic.', 'buddypress'); } else { if (empty($_POST['topic_text'])) { $error_message = __('Forum posts cannot be empty. Please enter some text.', 'buddypress'); } } if ($error_message) { bp_core_add_message($error_message, 'error'); $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum'; } else { if (!($topic = groups_new_group_forum_topic($_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id))) { bp_core_add_message(__('There was an error when creating the topic', 'buddypress'), 'error'); $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum'; } else { bp_core_add_message(__('The topic was created successfully', 'buddypress')); $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic->topic_slug . '/'; } } bp_core_redirect($redirect); } else { bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error'); bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink())); } } else { bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error'); bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink())); } } do_action('bp_forums_directory_forums_setup'); bp_core_load_template(apply_filters('bp_forums_template_directory_forums_setup', 'forums/index')); } }
/** * Show the capabilities settings template * * @since BuddyPress (1.6) * * @return If we shouldn't be here */ function bp_settings_screen_capabilities() { if (bp_action_variables()) { bp_do_404(); return; } // Load the template bp_core_load_template(apply_filters('bp_settings_screen_capabilities', 'members/single/settings/capabilities')); }
/** * Handles the saving of xprofile field visibilities * * @since BuddyPress (1.9) */ function bp_xprofile_action_settings() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Bail if no submit action if (!isset($_POST['xprofile-settings-submit'])) { return; } // Bail if not in settings if (!bp_is_user_settings_profile()) { return; } // 404 if there are any additional action variables attached if (bp_action_variables()) { bp_do_404(); return; } // Nonce check check_admin_referer('bp_xprofile_settings'); do_action('bp_xprofile_settings_before_save'); /** Save ******************************************************************/ // Only save if there are field ID's being posted if (!empty($_POST['field_ids'])) { // Get the POST'ed field ID's $posted_field_ids = explode(',', $_POST['field_ids']); // Backward compatibility: a bug in BP 2.0 caused only a single // group's field IDs to be submitted. Look for values submitted // in the POST request that may not appear in 'field_ids', and // add them to the list of IDs to save. foreach ($_POST as $posted_key => $posted_value) { preg_match('/^field_([0-9]+)_visibility$/', $posted_key, $matches); if (!empty($matches[1]) && !in_array($matches[1], $posted_field_ids)) { $posted_field_ids[] = $matches[1]; } } // Save the visibility settings foreach ($posted_field_ids as $field_id) { $visibility_level = 'public'; if (!empty($_POST['field_' . $field_id . '_visibility'])) { $visibility_level = $_POST['field_' . $field_id . '_visibility']; } xprofile_set_field_visibility_level($field_id, bp_displayed_user_id(), $visibility_level); } } /** Other *****************************************************************/ do_action('bp_xprofile_settings_after_save'); // Redirect to the root domain bp_core_redirect(bp_displayed_user_domain() . bp_get_settings_slug() . '/profile'); }
/** * Stores some handy information in the $bp global * * @package BuddyPress Docs * @since 1.0-beta */ function setup_globals() { global $bp; $bp->bp_docs->format_notification_function = 'bp_docs_format_notifications'; $bp->bp_docs->slug = BP_DOCS_SLUG; // This info is loaded here because it needs to happen after BP core globals are // set up $this->slugstocheck = bp_action_variables() ? bp_action_variables() : array(); $this->slugstocheck[] = bp_current_component(); $this->slugstocheck[] = bp_current_action(); // Todo: You only need this if you need top level access: example.com/docs /* Register this in the active components array */ //$bp->active_components[ $bp->wiki->slug ] = $bp->wiki->id; }
function breadcrumb_bp_current_item($item) { $params = array('bp_component' => bp_current_component(), 'bp_item' => bp_current_item(), 'bp_action' => bp_current_action(), 'bp_action_variables' => bp_action_variables()); switch (bp_current_component()) { case false: return $item; break; case 'groups': return new Breadcrumb_BP_Component_Group($item, $params); break; default: return new Breadcrumb_BP_Component($item, $params); } }
/** * Show the capabilities settings template * * @since BuddyPress (1.6.0) */ function bp_settings_screen_capabilities() { if (bp_action_variables()) { bp_do_404(); return; } /** * Filters the template file path to use for the capabilities settings screen. * * @since BuddyPress (1.6.0) * * @param string $value Directory path to look in for the template file. */ bp_core_load_template(apply_filters('bp_settings_screen_capabilities', 'members/single/settings/capabilities')); }
/** * Sets up and displays the screen output for the sub nav item "portfolio/add" */ function bp_portfolio_screen_add() { global $bp; if (bp_action_variables()) { bp_do_404(); return; } messages_remove_callback_values(); if (isset($_POST['add'])) { // Check the nonce if (!wp_verify_nonce($_POST['_wpnonce'], 'project_form_nonce')) { bp_core_add_message(__('There was an error recording the project, please try again', 'bp-portfolio'), 'error'); bp_core_load_template(apply_filters('bp_portfolio_template_personal', BP_PORTFOLIO_TEMPLATE . '/personal')); } if (empty($_POST['title-input']) or empty($_POST['url-input']) or empty($_POST['description'])) { bp_core_add_message(__('All fields are required', 'bp-portfolio'), 'error'); } else { // Check the url if (!preg_match("/(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/", $_POST['url-input'])) { bp_core_add_message(__('Url must be a valid URL.', 'bp-portfolio'), 'error'); bp_core_load_template(apply_filters('bp_portfolio_template_add', BP_PORTFOLIO_TEMPLATE . '/add')); } // Check description size if (strlen($_POST['description']) > BP_PORTFOLIO_DESC_MAX_SIZE) { $_POST['description'] = substr($_POST['description'], 0, BP_PORTFOLIO_DESC_MAX_SIZE); } // Save the item $posts = array('author_id' => bp_loggedin_user_id(), 'title' => $_POST['title-input'], 'description' => $_POST['description'], 'url' => $_POST['url-input']); // Is that a capture has been sent ? if (isset($_FILES['screenshot-input']) and $_FILES['screenshot-input']['error'] == 0) { $posts['screenshot'] = $_FILES['screenshot-input']; } if ($item = bp_portfolio_save_item($posts)) { bp_core_add_message(__('Project has been saved', 'bp-portfolio')); bp_core_redirect(bp_core_get_user_domain(bp_loggedin_user_id()) . bp_get_portfolio_slug()); } else { bp_core_add_message(__('There was an error recording the project, please try again', 'bp-portfolio'), 'error'); } } } do_action('bp_portfolio_add_screen'); // Displaying Content bp_core_load_template(apply_filters('bp_portfolio_template_add', BP_PORTFOLIO_TEMPLATE . '/add')); }
/** * Handles the saving of xprofile field visibilities * * @since BuddyPress (1.9) */ function bp_xprofile_action_settings() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Bail if no submit action if (!isset($_POST['xprofile-settings-submit'])) { return; } // Bail if not in settings if (!bp_is_user_settings_profile()) { return; } // 404 if there are any additional action variables attached if (bp_action_variables()) { bp_do_404(); return; } // Nonce check check_admin_referer('bp_xprofile_settings'); do_action('bp_xprofile_settings_before_save'); /** Save ******************************************************************/ // Only save if there are field ID's being posted if (!empty($_POST['field_ids'])) { // Get the POST'ed field ID's $posted_field_ids = explode(',', $_POST['field_ids']); // Save the visibility settings foreach ($posted_field_ids as $field_id) { $visibility_level = 'public'; if (!empty($_POST['field_' . $field_id . '_visibility'])) { $visibility_level = $_POST['field_' . $field_id . '_visibility']; } xprofile_set_field_visibility_level($field_id, bp_displayed_user_id(), $visibility_level); } } /** Other *****************************************************************/ do_action('bp_xprofile_settings_after_save'); // Redirect to the root domain bp_core_redirect(bp_displayed_user_domain() . bp_get_settings_slug() . '/profile'); }
function bebop_manage_provider() { global $bp; if (bp_is_current_component('bebop') && bp_is_current_action('bebop-accounts')) { $query_string = bp_action_variables(); if (!empty($query_string)) { $provider = $query_string[0]; } if (!empty($provider)) { global $bp; $extension = bebop_extensions::bebop_get_extension_config_by_name(strtolower($provider)); if (isset($_POST['submit'])) { check_admin_referer('bebop_' . $extension['name'] . '_user_settings'); if (isset($_POST['bebop_' . $extension['name'] . '_active_for_user'])) { bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_active_for_user', $_POST['bebop_' . $extension['name'] . '_active_for_user']); bp_core_add_message(sprintf(__('Settings for %1$s have been saved.', 'bebop'), $extension['display_name'])); } if (!empty($_POST['bebop_' . $extension['name'] . '_username'])) { $new_name = stripslashes($_POST['bebop_' . $extension['name'] . '_username']); if (bebop_tables::add_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_username', $new_name, $check_meta_value = true)) { bebop_tables::add_to_first_importers_list($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_' . $new_name . '_do_initial_import', $new_name); bp_core_add_message(sprintf(__('%1$s has been added to the %2$s feed.', 'bebop'), $new_name, $extension['display_name'])); } else { bp_core_add_message(sprintf(__('%1$s already exists in the %2$s feed; you cannot add it again.', 'bebop'), $new_name, $extension['display_name']), __('error', 'bebop')); } } //Try and add a new RSS feed. if (!empty($_POST['bebop_' . $extension['name'] . '_newfeedname']) && !empty($_POST['bebop_' . $extension['name'] . '_newfeedurl'])) { if (filter_var($_POST['bebop_' . $extension['name'] . '_newfeedurl'], FILTER_VALIDATE_URL)) { $insert_url = $_POST['bebop_' . $extension['name'] . '_newfeedurl']; $new_name = str_replace(' ', '_', stripslashes(strip_tags($_POST['bebop_' . $extension['name'] . '_newfeedname']))); if (bebop_tables::add_user_meta($bp->loggedin_user->id, $extension['name'] . '_' . $new_name, $new_name, strip_tags($insert_url))) { bebop_tables::add_to_first_importers_list($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_' . $new_name . '_do_initial_import', $new_name); bp_core_add_message(__('Feed successfully added.', 'bebop')); } else { bp_core_add_message(__('This feed already exists, you cannot add it again.', 'bebop'), __('error', 'bebop')); } } else { bp_core_add_message(__('That feed cannot be added as it is not a valid URL.', 'bebop'), __('error', 'bebop')); } } // //Extension authors: use this hook to add your own data saves. do_action('bebop_user_settings_pre_edit_save', $extension); bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action()); } //End if ( isset( $_POST['submit'] ) ) { //Twitter Oauth stuff if (isset($_GET['oauth_token'])) { //Handle the oAuth requests $OAuth = new bebop_oauth(); $OAuth->set_request_token_url($extension['request_token_url']); $OAuth->set_access_token_url($extension['access_token_url']); $OAuth->set_authorize_url($extension['authorize_url']); $OAuth->set_parameters(array('oauth_verifier' => $_GET['oauth_verifier'])); $OAuth->set_callback_url($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action() . '/' . $extension['name']); $OAuth->set_consumer_key(bebop_tables::get_option_value('bebop_' . $extension['name'] . '_consumer_key')); $OAuth->set_consumer_secret(bebop_tables::get_option_value('bebop_' . $extension['name'] . '_consumer_secret')); $OAuth->set_request_token(bebop_tables::get_user_meta_value($bp->loggedin_user->id, 'bebop_' . $extension['name'] . '_oauth_token_temp')); $OAuth->set_request_token_secret(bebop_tables::get_user_meta_value($bp->loggedin_user->id, 'bebop_' . $extension['name'] . '_oauth_token_secret_temp')); $accessToken = $OAuth->access_token(); bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_oauth_token', $accessToken['oauth_token']); bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_oauth_token_secret', $accessToken['oauth_token_secret']); bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_active_for_user', 1); bebop_tables::add_to_first_importers_list($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_do_initial_import', 1); bp_core_add_message(sprintf(__('You have successfully authenticated your %1$s account.', 'bebop'), $extension['display_name'])); bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action()); } //Facebook oAuth stuff. if (isset($_REQUEST['code'])) { $app_id = bebop_tables::get_option_value('bebop_' . $extension['name'] . '_consumer_key'); $app_secret = bebop_tables::get_option_value('bebop_' . $extension['name'] . '_consumer_secret'); $my_url = urlencode($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action() . '/' . $extension['name'] . '?scope=read_stream'); if ($_SESSION['facebook_state'] == $_GET['state']) { $code = $_GET['code']; $accessTokenUrl = str_replace('APP_ID', $app_id, $extension['access_token_url']); $accessTokenUrl = str_replace('REDIRECT_URI', $my_url, $accessTokenUrl); $accessTokenUrl = str_replace('APP_SECRET', $app_secret, $accessTokenUrl); $accessTokenUrl = str_replace('CODE', $code, $accessTokenUrl); $response = file_get_contents($accessTokenUrl); parse_str($response, $params); //extend access token $extendedAccessTokenUrl = str_replace('APP_ID', $app_id, $extension['extend_access_token_url']); $extendedAccessTokenUrl = str_replace('APP_SECRET', $app_secret, $extendedAccessTokenUrl); $extendedAccessTokenUrl = str_replace('SHORT_TOKEN', $params['access_token'], $extendedAccessTokenUrl); $response2 = file_get_contents($extendedAccessTokenUrl); parse_str($response2, $params2); //save the extended access token if (isset($params['access_token'])) { bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_oauth_token', $params2['access_token']); bebop_tables::update_user_meta($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_active_for_user', 1); bebop_tables::add_to_first_importers_list($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_do_initial_import', 1); bp_core_add_message(sprintf(__('You have successfully authenticated your %1$s account.', 'bebop'), $extension['display_name'])); bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action()); unset($_SESSION['facebook_state']); } } } //delete a user's feed if (isset($_GET['delete_feed'])) { $feed_name = str_replace(' ', '_', stripslashes(urldecode($_GET['delete_feed']))); $check_feed = bebop_tables::get_user_meta_value($bp->loggedin_user->id, $feed_name); if (!empty($check_feed)) { if (filter_var($check_feed, FILTER_VALIDATE_URL)) { if (bebop_tables::remove_user_meta($bp->loggedin_user->id, $feed_name)) { bebop_tables::delete_from_first_importers($bp->loggedin_user->id, $extension['name'], 'bebop_' . $extension['name'] . '_' . $feed_name . '_do_initial_import'); bp_core_add_message(__('Feed successfully deleted.', 'bebop')); //bp_core_redirect( $bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action() ); } else { bp_core_add_message(__('We could not delete that feed.', 'bebop'), __('error', 'bebop')); bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action()); } } } } //resets the user's data - twitter if (isset($_GET['reset'])) { bebop_tables::remove_user_meta($bp->loggedin_user->id, 'bebop_' . $extension['name'] . '_username'); } //resets the user's data - other if (isset($_GET['remove_username'])) { $username = stripslashes($_GET['remove_username']); if (bebop_tables::remove_user_meta_value($bp->loggedin_user->id, $username)) { bp_core_add_message(sprintf(__('%1$s has been removed from your %2$s feed.', 'bebop'), $username, $extension['display_name'])); bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action()); } else { bp_core_add_message(__('We could not delete that feed.', 'bebop'), __('error', 'bebop')); bp_core_redirect($bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action()); } } //Extension authors: use this hook to add your own removal functionality. do_action('bebop_admin_settings_pre_remove', $extension); } //End if ( !empty( $provider ) ) { } //End if ( bp_is_current_component( 'bebop' ) && bp_is_current_action('bebop-accounts' ) ) { }
/** * Implementation of BP_Component::setup_globals() * * Creates globals required by BP_Component. * Registers post_type and taxonomy names in component global. * Sets up the 'slugstocheck', which are used when enqueuing styles and scripts. * * @since 1.2 * @see BP_Docs_Component::enqueue_scripts() * @see BP_Docs_Component::enqueue_styles() */ function setup_globals($args = array()) { global $bp_docs; // Set up the $globals array to be passed along to parent::setup_globals() $globals = array('slug' => bp_docs_get_docs_slug(), 'root_slug' => isset($bp->pages->{$this->id}->slug) ? $bp->pages->{$this->id}->slug : bp_docs_get_docs_slug(), 'has_directory' => false, 'notification_callback' => 'bp_docs_format_notifications', 'search_string' => __('Search Docs...', 'buddypress')); // Let BP_Component::setup_globals() do its work. parent::setup_globals($globals); // Stash tax and post type names in the $bp global for use in template tags $this->post_type_name = $bp_docs->post_type_name; $this->associated_item_tax_name = $bp_docs->associated_item_tax_name; $this->access_tax_name = $bp_docs->access_tax_name; // This info is loaded here because it needs to happen after BP core globals are // set up $this->slugstocheck = bp_action_variables() ? bp_action_variables() : array(); $this->slugstocheck[] = bp_current_component(); $this->slugstocheck[] = bp_current_action(); $this->set_current_item_type(); $this->set_current_view(); }
/** * Show the xprofile settings template * * @since BuddyPress (2.0.0) */ function bp_xprofile_screen_settings() { // Redirect if no privacy settings page is accessible if (bp_action_variables() || !bp_is_active('xprofile')) { bp_do_404(); return; } /** * Filters the template to load for the XProfile settings screen. * * @since BuddyPress (2.0.0) * * @param string $template Path to the XProfile change avatar template to load. */ bp_core_load_template(apply_filters('bp_settings_screen_xprofile', '/members/single/settings/profile')); }
/** * Set up canonical stack for this component. * * @since BuddyPress (2.1.0) */ public function setup_canonical_stack() { $bp = buddypress(); /** Default Profile Component *****************************************/ if (defined('BP_DEFAULT_COMPONENT') && BP_DEFAULT_COMPONENT) { $bp->default_component = BP_DEFAULT_COMPONENT; } else { if (bp_is_active('activity') && isset($bp->pages->activity)) { $bp->default_component = bp_get_activity_slug(); } else { $bp->default_component = 'xprofile' === $bp->profile->id ? 'profile' : $bp->profile->id; } } /** Canonical Component Stack *****************************************/ if (bp_displayed_user_id()) { $bp->canonical_stack['base_url'] = bp_displayed_user_domain(); if (bp_current_component()) { $bp->canonical_stack['component'] = bp_current_component(); } if (bp_current_action()) { $bp->canonical_stack['action'] = bp_current_action(); } if (!empty($bp->action_variables)) { $bp->canonical_stack['action_variables'] = bp_action_variables(); } // Looking at the single member root/home, so assume the default if (!bp_current_component()) { $bp->current_component = $bp->default_component; // The canonical URL will not contain the default component } elseif (bp_is_current_component($bp->default_component) && !bp_current_action()) { unset($bp->canonical_stack['component']); } // if we're on a spammer's profile page, only users with the 'bp_moderate' cap // can view subpages on the spammer's profile // // users without the cap trying to access a spammer's subnav page will get // redirected to the root of the spammer's profile page. this occurs by // by removing the component in the canonical stack. if (bp_is_user_spammer(bp_displayed_user_id()) && !bp_current_user_can('bp_moderate')) { unset($bp->canonical_stack['component']); } } }
/** * Handles the uploading and cropping of a user avatar. Displays the change avatar page. * * @package BuddyPress XProfile * @uses bp_is_my_profile() Checks to make sure the current user being viewed equals the logged in user * @uses bp_core_load_template() Looks for and loads a template file within the current member theme (folder/filename) */ function xprofile_screen_change_avatar() { global $bp; if (!bp_is_my_profile() && !is_super_admin()) { return false; } if (bp_action_variables()) { bp_do_404(); return; } $bp->avatar_admin->step = 'upload-image'; if (!empty($_FILES)) { // Check the nonce check_admin_referer('bp_avatar_upload'); // Pass the file to the avatar upload handler if (bp_core_avatar_handle_upload($_FILES, 'xprofile_avatar_upload_dir')) { $bp->avatar_admin->step = 'crop-image'; // Make sure we include the jQuery jCrop file for image cropping add_action('nxt_print_scripts', 'bp_core_add_jquery_cropper'); } } // If the image cropping is done, crop the image and save a full/thumb version if (isset($_POST['avatar-crop-submit'])) { // Check the nonce check_admin_referer('bp_avatar_cropstore'); if (!bp_core_avatar_handle_crop(array('item_id' => $bp->displayed_user->id, 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h']))) { bp_core_add_message(__('There was a problem cropping your avatar, please try uploading it again', 'buddypress'), 'error'); } else { bp_core_add_message(__('Your new avatar was uploaded successfully!', 'buddypress')); do_action('xprofile_avatar_uploaded'); } } do_action('xprofile_screen_change_avatar'); bp_core_load_template(apply_filters('xprofile_template_change_avatar', 'members/single/home')); }
/** * Show the xprofile settings template * * @since BuddyPress (2.0.0) */ function bp_xprofile_screen_settings() { // Redirect if no privacy settings page is accessible if (bp_action_variables() || !bp_is_active('xprofile')) { bp_do_404(); return; } // Load the template bp_core_load_template(apply_filters('bp_settings_screen_xprofile', '/members/single/settings/profile')); }
/* * IMPORTANT - PLEASE READ ************************************************************************** * All the mechanics to control this plugin are automatically generated from the extension name. * * You do not need to modify this page, unless you wish to add additional customisable parameters * * for the extension. Removing/changing any of the pre defined functions will cause import errors, * * and possible other unexpected or unwanted behaviour. * * For information on bebop_tables:: functions, please see bebop/core/bebop-tables.php * * ************************************************************************************************** */ global $bp; /* * '$extension' controls content on this page and is set to whatever admin-settings.php file is being viewed. * i.e. if you extension name is 'my_extension', the value of $extension will be 'my_extension'. * The extension has to exist if this page is being included. */ $query_string = bp_action_variables(); if (!empty($query_string)) { $provider = $query_string[0]; } $extension = bebop_extensions::bebop_get_extension_config_by_name(strtolower($provider)); //put some options into variables $active = 'bebop_' . $extension['name'] . '_active_for_user'; //the active boolean name ${$active} = bebop_tables::get_user_meta_value($bp->loggedin_user->id, 'bebop_' . $extension['name'] . '_active_for_user'); //the value of the boolean if (bebop_tables::get_option_value('bebop_' . $extension['name'] . '_provider') == 'on') { echo '<h5>' . sprintf(__('%1$s Settings', 'bebop'), $extension['display_name']) . '</h5> <p>' . sprintf(__('Generic settings for %1$s. Here you can select whether content is actively imported into WordPress.', 'bebop'), $extension['display_name']) . '</p>'; echo '<form id="settings_form" action="' . $bp->loggedin_user->domain . bp_current_component() . '/' . bp_current_action() . '/' . $extension['name'] . '" method="post">'; echo '<label>' . sprintf(__('Enable %1$s import', 'bebop'), $extension['display_name']) . ':</label> <input type="radio" name="bebop_' . $extension['name'] . '_active_for_user" id="bebop_' . $extension['name'] . '_active_for_user" value="1"';
/** * Check to see whether the current page matches a given action_variable. * * Along with bp_is_current_component() and bp_is_current_action(), this function is mostly used * to help determine when to use a given screen function. * * In BP parlance, action_variables are an array made up of the URL chunks appearing after the * current_action in a URL. For example, * http://example.com/groups/my-group/admin/group-settings * $action_variables[0] is 'group-settings'. * * @package BuddyPress * @since 1.5 * * @param str $action_variable The action_variable being tested against * @param int $position The array key you're testing against. If you don't provide a $position, * the function will return true if the $action_variable is found *anywhere* in the action * variables array. * @return bool */ function bp_is_action_variable($action_variable = '', $position = false) { $is_action_variable = false; if (false !== $position) { // When a $position is specified, check that slot in the action_variables array if ($action_variable) { $is_action_variable = $action_variable == bp_action_variable($position); } else { // If no $action_variable is provided, we are essentially checking to see // whether the slot is empty $is_action_variable = !bp_action_variable($position); } } else { // When no $position is specified, check the entire array $is_action_variable = in_array($action_variable, (array) bp_action_variables()); } return apply_filters('bp_is_action_variable', $is_action_variable, $action_variable, $position); }
/** * Render the markup for the Messages section of Settings > Notifications. * * @since BuddyPress (1.0.0) */ function messages_screen_notification_settings() { if (bp_action_variables()) { bp_do_404(); return; } if (!($new_messages = bp_get_user_meta(bp_displayed_user_id(), 'notification_messages_new_message', true))) { $new_messages = 'yes'; } ?> <table class="notification-settings" id="messages-notification-settings"> <thead> <tr> <th class="icon"></th> <th class="title"><?php _e('Messages', 'buddypress'); ?> </th> <th class="yes"><?php _e('Yes', 'buddypress'); ?> </th> <th class="no"><?php _e('No', 'buddypress'); ?> </th> </tr> </thead> <tbody> <tr id="messages-notification-settings-new-message"> <td></td> <td><?php _e('A member sends you a new message', 'buddypress'); ?> </td> <td class="yes"><input type="radio" name="notifications[notification_messages_new_message]" value="yes" <?php checked($new_messages, 'yes', true); ?> /></td> <td class="no"><input type="radio" name="notifications[notification_messages_new_message]" value="no" <?php checked($new_messages, 'no', true); ?> /></td> </tr> <?php /** * Fires inside the closing </tbody> tag for messages screen notification settings. * * @since BuddyPress (1.0.0) */ do_action('messages_screen_notification_settings'); ?> </tbody> </table> <?php }
/** * Are we looking at something that needs old forum theme compatibility? * * @since 1.7.0 */ public function is_legacy_forum() { // Bail if not looking at a group. if (!bp_is_forums_component()) { return; } // Forum Directory. if ((!bp_current_action() || 'tag' == bp_current_action() && bp_action_variables()) && !bp_current_item()) { if (!bp_forums_has_directory()) { return false; } if (!bp_forums_is_installed_correctly()) { bp_core_add_message(__('The forums component has not been set up yet.', 'buddypress'), 'error'); bp_core_redirect(bp_get_root_domain()); } bp_update_is_directory(true, 'forums'); do_action('bp_forums_directory_forums_setup'); add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post')); add_filter('bp_replace_the_content', array($this, 'directory_content')); } }
/** * Enqueue scripts * * @package CollabPress * @subpackage CP BP * @since 1.2 */ function enqueue_scripts() { // Scripts should be loaded on the groups tab, or on the group admin subtab if (bp_is_current_action($this->slug) || in_array($this->slug, (array) bp_action_variables()) || bp_is_current_action('calendar')) { wp_enqueue_script('cp-bp', COLLABPRESS_PLUGIN_URL . 'includes/js/bp.js', array('jquery')); // collabpress_dashboard_page::cp_admin_scripts(); } }
/** * Set up canonical stack for this component. * * @since BuddyPress (2.1.0) */ public function setup_canonical_stack() { if (!bp_is_groups_component()) { return; } if (empty($this->current_group)) { return; } $this->default_extension = apply_filters('bp_groups_default_extension', defined('BP_GROUPS_DEFAULT_EXTENSION') ? BP_GROUPS_DEFAULT_EXTENSION : 'home'); if (!bp_current_action()) { buddypress()->current_action = $this->default_extension; } // Prepare for a redirect to the canonical URL buddypress()->canonical_stack['base_url'] = bp_get_group_permalink($this->current_group); if (bp_current_action()) { buddypress()->canonical_stack['action'] = bp_current_action(); } if (!empty(buddypress()->action_variables)) { buddypress()->canonical_stack['action_variables'] = bp_action_variables(); } // When viewing the default extension, the canonical URL should not have // that extension's slug, unless more has been tacked onto the URL via // action variables if (bp_is_current_action($this->default_extension) && empty(buddypress()->action_variables)) { unset(buddypress()->canonical_stack['action']); } }
/** * Handle the display of a group's Admin pages. */ function groups_screen_group_admin() { if (!bp_is_groups_component() || !bp_is_current_action('admin')) { return false; } if (bp_action_variables()) { return false; } bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/edit-details/'); }
/** * Setup globals * * The BP_GROUPS_SLUG constant is deprecated, and only used here for * backwards compatibility. * * @since BuddyPress (1.5) * @global BuddyPress $bp The one true BuddyPress instance */ function setup_globals() { global $bp; // Define a slug, if necessary if (!defined('BP_GROUPS_SLUG')) { define('BP_GROUPS_SLUG', $this->id); } // Global tables for messaging component $global_tables = array('table_name' => $bp->table_prefix . 'bp_groups', 'table_name_members' => $bp->table_prefix . 'bp_groups_members', 'table_name_groupmeta' => $bp->table_prefix . 'bp_groups_groupmeta'); // All globals for messaging component. // Note that global_tables is included in this array. $globals = array('slug' => BP_GROUPS_SLUG, 'root_slug' => isset($bp->pages->groups->slug) ? $bp->pages->groups->slug : BP_GROUPS_SLUG, 'has_directory' => true, 'notification_callback' => 'groups_format_notifications', 'search_string' => __('Search Groups...', 'buddypress'), 'global_tables' => $global_tables); parent::setup_globals($globals); /** Single Group Globals **********************************************/ // Are we viewing a single group? if (bp_is_groups_component() && ($group_id = BP_Groups_Group::group_exists(bp_current_action()))) { $bp->is_single_item = true; $current_group_class = apply_filters('bp_groups_current_group_class', 'BP_Groups_Group'); $this->current_group = apply_filters('bp_groups_current_group_object', new $current_group_class($group_id)); // When in a single group, the first action is bumped down one because of the // group name, so we need to adjust this and set the group name to current_item. $bp->current_item = bp_current_action(); $bp->current_action = bp_action_variable(0); array_shift($bp->action_variables); // Using "item" not "group" for generic support in other components. if (bp_current_user_can('bp_moderate')) { bp_update_is_item_admin(true, 'groups'); } else { bp_update_is_item_admin(groups_is_user_admin(bp_loggedin_user_id(), $this->current_group->id), 'groups'); } // If the user is not an admin, check if they are a moderator if (!bp_is_item_admin()) { bp_update_is_item_mod(groups_is_user_mod(bp_loggedin_user_id(), $this->current_group->id), 'groups'); } // Is the logged in user a member of the group? if (is_user_logged_in() && groups_is_user_member(bp_loggedin_user_id(), $this->current_group->id)) { $this->current_group->is_user_member = true; } else { $this->current_group->is_user_member = false; } // Should this group be visible to the logged in user? if ('public' == $this->current_group->status || $this->current_group->is_user_member) { $this->current_group->is_visible = true; } else { $this->current_group->is_visible = false; } // If this is a private or hidden group, does the user have access? if ('private' == $this->current_group->status || 'hidden' == $this->current_group->status) { if ($this->current_group->is_user_member && is_user_logged_in() || bp_current_user_can('bp_moderate')) { $this->current_group->user_has_access = true; } else { $this->current_group->user_has_access = false; } } else { $this->current_group->user_has_access = true; } // Set current_group to 0 to prevent debug errors } else { $this->current_group = 0; } // Illegal group names/slugs $this->forbidden_names = apply_filters('groups_forbidden_names', array('my-groups', 'create', 'invites', 'send-invites', 'forum', 'delete', 'add', 'admin', 'request-membership', 'members', 'settings', 'avatar', $this->slug, $this->root_slug)); // If the user was attempting to access a group, but no group by that name was found, 404 if (bp_is_groups_component() && empty($this->current_group) && bp_current_action() && !in_array(bp_current_action(), $this->forbidden_names)) { bp_do_404(); return; } if (bp_is_groups_component() && !empty($this->current_group)) { $this->default_extension = apply_filters('bp_groups_default_extension', defined('BP_GROUPS_DEFAULT_EXTENSION') ? BP_GROUPS_DEFAULT_EXTENSION : 'home'); if (!bp_current_action()) { $bp->current_action = $this->default_extension; } // Prepare for a redirect to the canonical URL $bp->canonical_stack['base_url'] = bp_get_group_permalink($this->current_group); if (bp_current_action()) { $bp->canonical_stack['action'] = bp_current_action(); } if (!empty($bp->action_variables)) { $bp->canonical_stack['action_variables'] = bp_action_variables(); } // When viewing the default extension, the canonical URL should not have // that extension's slug, unless more has been tacked onto the URL via // action variables if (bp_is_current_action($this->default_extension) && empty($bp->action_variables)) { unset($bp->canonical_stack['action']); } } // Group access control if (bp_is_groups_component() && !empty($this->current_group)) { if (!$this->current_group->user_has_access) { // Hidden groups should return a 404 for non-members. // Unset the current group so that you're not redirected // to the default group tab if ('hidden' == $this->current_group->status) { $this->current_group = 0; $bp->is_single_item = false; bp_do_404(); return; // Skip the no_access check on home and membership request pages } elseif (!bp_is_current_action('home') && !bp_is_current_action('request-membership')) { // Off-limits to this user. Throw an error and redirect to the group's home page if (is_user_logged_in()) { bp_core_no_access(array('message' => __('You do not have access to this group.', 'buddypress'), 'root' => bp_get_group_permalink($bp->groups->current_group), 'redirect' => false)); // User does not have access, and does not get a message } else { bp_core_no_access(); } } } // Protect the admin tab from non-admins if (bp_is_current_action('admin') && !bp_is_item_admin()) { bp_core_no_access(array('message' => __('You are not an admin of this group.', 'buddypress'), 'root' => bp_get_group_permalink($bp->groups->current_group), 'redirect' => false)); } } // Preconfigured group creation steps $this->group_creation_steps = apply_filters('groups_create_group_steps', array('group-details' => array('name' => __('Details', 'buddypress'), 'position' => 0), 'group-settings' => array('name' => __('Settings', 'buddypress'), 'position' => 10))); // If avatar uploads are not disabled, add avatar option if (!(int) bp_get_option('bp-disable-avatar-uploads')) { $this->group_creation_steps['group-avatar'] = array('name' => __('Avatar', 'buddypress'), 'position' => 20); } // If friends component is active, add invitations if (bp_is_active('friends')) { $this->group_creation_steps['group-invites'] = array('name' => __('Invites', 'buddypress'), 'position' => 30); } // Groups statuses $this->valid_status = apply_filters('groups_valid_status', array('public', 'private', 'hidden')); // Auto join group when non group member performs group activity $this->auto_join = defined('BP_DISABLE_AUTO_GROUP_JOIN') && BP_DISABLE_AUTO_GROUP_JOIN ? false : true; }
/** * Load the page for a single activity item. * * @since 1.2.0 * * @uses bp_is_activity_component() * @uses bp_activity_get_specific() * @uses bp_current_action() * @uses bp_action_variables() * @uses bp_do_404() * @uses bp_is_active() * @uses groups_get_group() * @uses groups_is_user_member() * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_access' hook. * @uses do_action() To call the 'bp_activity_screen_single_activity_permalink' hook. * @uses bp_core_add_message() * @uses is_user_logged_in() * @uses bp_core_redirect() * @uses site_url() * @uses esc_url() * @uses bp_get_root_domain() * @uses bp_get_activity_root_slug() * @uses bp_core_load_template() * @uses apply_filters() To call the 'bp_activity_template_profile_activity_permalink' hook. */ function bp_activity_screen_single_activity_permalink() { $bp = buddypress(); // No displayed user or not viewing activity component. if (!bp_is_activity_component()) { return false; } if (!bp_current_action() || !is_numeric(bp_current_action())) { return false; } // Get the activity details. $activity = bp_activity_get_specific(array('activity_ids' => bp_current_action(), 'show_hidden' => true, 'spam' => 'ham_only')); // 404 if activity does not exist if (empty($activity['activities'][0]) || bp_action_variables()) { bp_do_404(); return; } else { $activity = $activity['activities'][0]; } // Default access is true. $has_access = true; // If activity is from a group, do an extra cap check. if (isset($bp->groups->id) && $activity->component == $bp->groups->id) { // Activity is from a group, but groups is currently disabled. if (!bp_is_active('groups')) { bp_do_404(); return; } // Check to see if the group is not public, if so, check the // user has access to see this activity. if ($group = groups_get_group(array('group_id' => $activity->item_id))) { // Group is not public. if ('public' != $group->status) { // User is not a member of group. if (!groups_is_user_member(bp_loggedin_user_id(), $group->id)) { $has_access = false; } } } } /** * Filters the access permission for a single activity view. * * @since 1.2.0 * * @param array $access Array holding the current $has_access value and current activity item instance. */ $has_access = apply_filters_ref_array('bp_activity_permalink_access', array($has_access, &$activity)); /** * Fires before the loading of a single activity template file. * * @since 1.2.0 * * @param BP_Activity_Activity $activity Object representing the current activity item being displayed. * @param bool $has_access Whether or not the current user has access to view activity. */ do_action('bp_activity_screen_single_activity_permalink', $activity, $has_access); // Access is specifically disallowed. if (false === $has_access) { // User feedback. bp_core_add_message(__('You do not have access to this activity.', 'buddypress'), 'error'); // Redirect based on logged in status. if (is_user_logged_in()) { $url = bp_loggedin_user_domain(); } else { $url = sprintf(site_url('wp-login.php?redirect_to=%s'), urlencode(esc_url_raw(bp_activity_get_permalink((int) bp_current_action())))); } bp_core_redirect($url); } /** * Filters the template to load for a single activity screen. * * @since 1.0.0 * * @param string $template Path to the activity template to load. */ bp_core_load_template(apply_filters('bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink')); }
/** * Set up canonical stack for this component. * * @since BuddyPress (2.1.0) */ public function setup_canonical_stack() { if (!bp_is_groups_component()) { return; } if (empty($this->current_group)) { return; } /** * Filters the default groups extension. * * @since BuddyPress (1.6.0) * * @param string $value BP_GROUPS_DEFAULT_EXTENSION constant if defined, * else 'home'. */ $this->default_extension = apply_filters('bp_groups_default_extension', defined('BP_GROUPS_DEFAULT_EXTENSION') ? BP_GROUPS_DEFAULT_EXTENSION : 'home'); $bp = buddypress(); if (!bp_current_action()) { $bp->current_action = $this->default_extension; } // Prepare for a redirect to the canonical URL $bp->canonical_stack['base_url'] = bp_get_group_permalink($this->current_group); if (bp_current_action()) { $bp->canonical_stack['action'] = bp_current_action(); } if (!empty($bp->action_variables)) { $bp->canonical_stack['action_variables'] = bp_action_variables(); } // When viewing the default extension, the canonical URL should not have // that extension's slug, unless more has been tacked onto the URL via // action variables if (bp_is_current_action($this->default_extension) && empty($bp->action_variables)) { unset($bp->canonical_stack['action']); } }
function settings_ui() { if (bp_action_variables()) { bp_do_404(); return; } // Load the template bp_core_load_template(apply_filters('bp_settings_screen_delete_account', 'members/single/plugins')); }
/** * Check to see whether the current page matches a given action_variable. * * Along with bp_is_current_component() and bp_is_current_action(), this * function is mostly used to help determine when to use a given screen * function. * * In BP parlance, action_variables are an array made up of the URL chunks * appearing after the current_action in a URL. For example, * http://example.com/groups/my-group/admin/group-settings * $action_variables[0] is 'group-settings'. * * @since 1.5.0 * * @param string $action_variable The action_variable being tested against. * @param int|bool $position Optional. The array key you're testing against. If you * don't provide a $position, the function will return true if the * $action_variable is found *anywhere* in the action variables array. * @return bool True if $action_variable matches at the $position provided. */ function bp_is_action_variable($action_variable = '', $position = false) { $is_action_variable = false; if (false !== $position) { // When a $position is specified, check that slot in the action_variables array. if ($action_variable) { $is_action_variable = $action_variable == bp_action_variable($position); } else { // If no $action_variable is provided, we are essentially checking to see // whether the slot is empty. $is_action_variable = !bp_action_variable($position); } } else { // When no $position is specified, check the entire array. $is_action_variable = in_array($action_variable, (array) bp_action_variables()); } /** * Filters whether the current page matches a given action_variable. * * @since 1.5.0 * * @param bool $is_action_variable Whether the current page matches a given action_variable. * @param string $action_variable The action_variable being tested against. * @param int $position The array key tested against. */ return apply_filters('bp_is_action_variable', $is_action_variable, $action_variable, $position); }
/** Delete Account ************************************************************/ function bp_core_screen_delete_account() { global $bp; if (bp_action_variables()) { bp_do_404(); return; } if (isset($_POST['delete-account-understand'])) { // Nonce check check_admin_referer('delete-account'); // delete the users account if (bp_core_delete_account($bp->displayed_user->id)) { bp_core_redirect(home_url()); } } // Load the template bp_core_load_template(apply_filters('bp_core_screen_delete_account', 'members/single/settings/delete-account')); }
/** * Set up canonical stack for this component. * * @since 2.1.0 */ public function setup_canonical_stack() { if (!bp_is_groups_component()) { return; } if (empty($this->current_group)) { return; } /** * Filters the default groups extension. * * @since 1.6.0 * * @param string $value BP_GROUPS_DEFAULT_EXTENSION constant if defined, * else 'home'. */ $this->default_extension = apply_filters('bp_groups_default_extension', defined('BP_GROUPS_DEFAULT_EXTENSION') ? BP_GROUPS_DEFAULT_EXTENSION : 'home'); $bp = buddypress(); // If the activity component is not active and the current group has no custom front, members are displayed in the home nav. if ('members' === $this->default_extension && !bp_is_active('activity') && !$this->current_group->front_template) { $this->default_extension = 'home'; } if (!bp_current_action()) { $bp->current_action = $this->default_extension; } // Prepare for a redirect to the canonical URL. $bp->canonical_stack['base_url'] = bp_get_group_permalink($this->current_group); if (bp_current_action()) { $bp->canonical_stack['action'] = bp_current_action(); } /** * If there's no custom front.php template for the group, we need to make sure the canonical stack action * is set to 'home' in these 2 cases: * * - the current action is 'activity' (eg: site.url/groups/single/activity) and the Activity component is active * - the current action is 'members' (eg: site.url/groups/single/members) and the Activity component is *not* active. */ if (!$this->current_group->front_template && (bp_is_current_action('activity') || !bp_is_active('activity') && bp_is_current_action('members'))) { $bp->canonical_stack['action'] = 'home'; } if (!empty($bp->action_variables)) { $bp->canonical_stack['action_variables'] = bp_action_variables(); } // When viewing the default extension, the canonical URL should not have // that extension's slug, unless more has been tacked onto the URL via // action variables. if (bp_is_current_action($this->default_extension) && empty($bp->action_variables)) { unset($bp->canonical_stack['action']); } }
/** * Handles the deleting of a user */ function bp_settings_action_delete_account() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Bail if no submit action if (!isset($_POST['delete-account-understand'])) { return; } // Bail if not in settings if (!bp_is_settings_component() || !bp_is_current_action('delete-account')) { return false; } // 404 if there are any additional action variables attached if (bp_action_variables()) { bp_do_404(); return; } // Bail if account deletion is disabled if (bp_disable_account_deletion() && !bp_current_user_can('delete_users')) { return false; } // Nonce check check_admin_referer('delete-account'); // Get username now because it might be gone soon! $username = bp_get_displayed_user_fullname(); // delete the users account if (bp_core_delete_account(bp_displayed_user_id())) { // Add feedback ater deleting a user bp_core_add_message(sprintf(__('%s was successfully deleted.', 'buddypress'), $username), 'success'); // Redirect to the root domain bp_core_redirect(bp_get_root_domain()); } }
/** * Reset the logged-in user's new mentions data when he visits his mentions screen * * @since BuddyPress (1.2) * * @global object $bp BuddyPress global settings * @uses bp_is_activity_component() * @uses bp_activity_get_specific() * @uses bp_current_action() * @uses bp_action_variables() * @uses bp_do_404() * @uses bp_is_active() * @uses groups_get_group() * @uses groups_is_user_member() * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_access' hook * @uses do_action() To call the 'bp_activity_screen_single_activity_permalink' hook * @uses bp_core_add_message() * @uses is_user_logged_in() * @uses bp_core_redirect() * @uses site_url() * @uses esc_url() * @uses bp_get_root_domain() * @uses bp_get_activity_root_slug() * @uses bp_core_load_template() * @uses apply_filters() To call the 'bp_activity_template_profile_activity_permalink' hook */ function bp_activity_screen_single_activity_permalink() { global $bp; // No displayed user or not viewing activity component if (!bp_is_activity_component()) { return false; } if (!bp_current_action() || !is_numeric(bp_current_action())) { return false; } // Get the activity details $activity = bp_activity_get_specific(array('activity_ids' => bp_current_action(), 'show_hidden' => true, 'spam' => 'ham_only')); // 404 if activity does not exist if (empty($activity['activities'][0]) || bp_action_variables()) { bp_do_404(); return; } else { $activity = $activity['activities'][0]; } // Default access is true $has_access = true; // If activity is from a group, do an extra cap check if (isset($bp->groups->id) && $activity->component == $bp->groups->id) { // Activity is from a group, but groups is currently disabled if (!bp_is_active('groups')) { bp_do_404(); return; } // Check to see if the group is not public, if so, check the // user has access to see this activity if ($group = groups_get_group(array('group_id' => $activity->item_id))) { // Group is not public if ('public' != $group->status) { // User is not a member of group if (!groups_is_user_member(bp_loggedin_user_id(), $group->id)) { $has_access = false; } } } } // Allow access to be filtered $has_access = apply_filters_ref_array('bp_activity_permalink_access', array($has_access, &$activity)); // Allow additional code execution do_action('bp_activity_screen_single_activity_permalink', $activity, $has_access); // Access is specifically disallowed if (false === $has_access) { // User feedback bp_core_add_message(__('You do not have access to this activity.', 'buddypress'), 'error'); // Redirect based on logged in status is_user_logged_in() ? bp_core_redirect(bp_loggedin_user_domain()) : bp_core_redirect(site_url('wp-login.php?redirect_to=' . esc_url(bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/p/' . bp_current_action() . '/'))); } bp_core_load_template(apply_filters('bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink')); }