/** * @param boolean $result * @param EM_Booking $EM_Booking * @return boolean */ function bp_em_record_activity_booking_save($result, $EM_Booking) { if ($result) { $rejected_statuses = array(0, 2, 3); //these statuses apply to rejected/cancelled bookings $user = $EM_Booking->person; $member_slug = function_exists('bp_get_members_root_slug') ? bp_get_members_root_slug() : BP_MEMBERS_SLUG; $member_link = trailingslashit(bp_get_root_domain()) . $member_slug . '/' . $user->user_login; $user_link = "<a href='" . $member_link . "/'>" . $user->display_name . "</a>"; $event_link = $EM_Booking->get_event()->output('#_EVENTLINK'); $status = $EM_Booking->booking_status; $EM_Event = $EM_Booking->get_event(); if (empty($EM_Event->group_id)) { if ($status == 1 || !get_option('dbem_bookings_approval') && $status < 2) { $action = sprintf(__('%s is attending %s.', 'dbem'), $user_link, $event_link); } elseif (($EM_Booking->previous_status == 1 || !get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2) && in_array($status, $rejected_statuses)) { $action = sprintf(__('%s will not be attending %s anymore.', 'dbem'), $user_link, $event_link); } } else { $group = new BP_Groups_Group($EM_Event->group_id); $group_link = '<a href="' . bp_get_group_permalink($group) . '">' . bp_get_group_name($group) . '</a>'; if ($status == 1 || !get_option('dbem_bookings_approval') && $status < 2) { $action = sprintf(__('%s is attending %s of the group %s.', 'dbem'), $user_link, $event_link, $group_link); } elseif (($EM_Booking->previous_status == 1 || !get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2) && in_array($status, $rejected_statuses)) { $action = sprintf(__('%s will not be attending %s of group %s anymore.', 'dbem'), $user_link, $event_link, $group_link); } } if (!empty($action)) { bp_em_record_activity(array('user_id' => $EM_Booking->person->ID, 'action' => $action, 'primary_link' => $EM_Event->output('#_EVENTURL'), 'type' => 'new_booking', 'item_id' => $EM_Event->event_id, 'secondary_item_id' => $EM_Booking->booking_id, 'hide_sitewide' => $EM_Event->event_private)); //group activity if (!empty($EM_Event->group_id)) { //tis a group event bp_em_record_activity(array('component' => 'groups', 'item_id' => $EM_Event->group_id, 'user_id' => $EM_Booking->person->ID, 'action' => $action, 'primary_link' => $EM_Event->output('#_EVENTURL'), 'type' => 'new_booking', 'secondary_item_id' => $EM_Booking->booking_id, 'hide_sitewide' => $EM_Event->event_private)); } } } return $result; }
function huddle_bp_get_the_profile_field_value($value, $type = '', $id = '') { global $field; if (substr_count(strtolower($field->name), 'twitter')) { if (!substr_count($field->data->value, 'twitter.com')) { $value = 'http://twitter.com/' . $value; } } elseif (substr_count(strtolower($field->name), 'about')) { } else { $values = explode(',', $value); if ($values) { foreach ((array) $values as $value) { $value = trim($value); // If the value is a URL, skip it and just make it clickable. if (preg_match('@(https?://([-\\w\\.]+)+(:\\d+)?(/([\\w/_\\.]*(\\?\\S+)?)?)?)@', $value)) { $new_values[] = make_clickable($value); } else { if (count(explode(' ', $value)) > 5) { $new_values[] = $value; } else { $new_values[] = '<a href="' . site_url(bp_get_members_root_slug()) . '/?s=' . strip_tags($value) . '" rel="nofollow">' . $value . '</a>'; } } } $value = implode(', ', $new_values); } } return $value; }
<?php do_action('bp_before_directory_members_content'); ?> <div id="members-dir-search" class="dir-search" role="search"> <?php bp_directory_members_search_form(); ?> </div><!-- #members-dir-search --> <div class="item-list-tabs" role="navigation"> <ul> <li class="selected" id="members-all"><a href="<?php echo trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()); ?> "><?php printf(__('All %1s <span>%2s</span>', 'buddypress'), ucfirst(buatp_get_dir_name()), bp_get_total_member_count()); ?> </a></li> <?php if (is_user_logged_in() && bp_is_active('friends') && bp_get_total_friend_count(bp_loggedin_user_id())) { ?> <li id="members-personal"><a href="<?php echo bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends/'; ?> "><?php printf(__('My Friends <span>%s</span>', 'buddypress'), bp_get_total_friend_count(bp_loggedin_user_id()));
/** * Return the linked name of the user who last posted to the current topic in the loop. * * @return string HTML link to the profile of the user who last posted * to the current topic. */ function bp_get_the_topic_last_poster_name() { global $forum_template; $domain = bp_core_get_user_domain($forum_template->topic->topic_last_poster, $forum_template->topic->topic_last_poster_nicename, $forum_template->topic->topic_last_poster_login); // In the case where no user is found, bp_core_get_user_domain() may return the URL // of the Members directory if (!$domain || $domain == bp_core_get_root_domain() . '/' . bp_get_members_root_slug() . '/') { return __('Deleted User', 'buddypress'); } return apply_filters('bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>'); }
/** * Return the domain for the passed user: e.g. http://example.com/members/andy/. * * @since 1.0.0 * * @param int $user_id The ID of the user. * @param string|bool $user_nicename Optional. user_nicename of the user. * @param string|bool $user_login Optional. user_login of the user. * @return string */ function bp_core_get_user_domain($user_id = 0, $user_nicename = false, $user_login = false) { if (empty($user_id)) { return; } $username = bp_core_get_username($user_id, $user_nicename, $user_login); if (bp_is_username_compatibility_mode()) { $username = rawurlencode($username); } $after_domain = bp_core_enable_root_profiles() ? $username : bp_get_members_root_slug() . '/' . $username; $domain = trailingslashit(bp_get_root_domain() . '/' . $after_domain); // Don't use this filter. Subject to removal in a future release. // Use the 'bp_core_get_user_domain' filter instead. $domain = apply_filters('bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login); /** * Filters the domain for the passed user. * * @since 1.0.1 * * @param string $domain Domain for the passed user. * @param int $user_id ID of the passed user. * @param string $user_nicename User nicename of the passed user. * @param string $user_login User login of the passed user. */ return apply_filters('bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login); }
function bp_adminbar_random_menu() { global $bp; ?> <li class="align-right" id="bp-adminbar-visitrandom-menu"> <a href="#"><?php _e('Visit', 'buddypress'); ?> </a> <ul class="random-list"> <li><a href="<?php echo trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()) . '?random-member'; ?> " rel="nofollow"><?php _e('Random Member', 'buddypress'); ?> </a></li> <?php if (bp_is_active('groups')) { ?> <li class="alt"><a href="<?php echo trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug()) . '?random-group'; ?> " rel="nofollow"><?php _e('Random Group', 'buddypress'); ?> </a></li> <?php } ?> <?php if (is_multisite() && bp_is_active('blogs')) { ?> <li><a href="<?php echo trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_root_slug()) . '?random-blog'; ?> " rel="nofollow"><?php _e('Random Site', 'buddypress'); ?> </a></li> <?php } ?> <?php do_action('bp_adminbar_random_menu'); ?> </ul> </li> <?php }
/** * Strip out BuddyPress activity at-name HTML on topic/reply edit * * Copied from bp_forums_strip_mentions_on_post_edit() in case forums * component is not active or is not loaded in yet. * * @since bbPress (r3475) * @param type $content Optional * @uses bp_get_root_domain() * @uses bp_get_members_root_slug() * @return string */ public function strip_mentions_on_edit($content = '') { // Backwards compat for members root slug if (function_exists('bp_get_members_root_slug')) { $members_root = bp_get_members_root_slug(); } elseif (defined('BP_MEMBERS_SLUG')) { $members_root = BP_MEMBERS_SLUG; } else { $members_root = 'members'; } $pattern = "|<a href='" . bp_get_root_domain() . "/" . $members_root . "/[A-Za-z0-9-_\\.]+/' rel='nofollow'>(@[A-Za-z0-9-_\\.@]+)</a>|"; $content = preg_replace($pattern, "\$1", htmlspecialchars_decode($content)); return $content; }
/** * Get user domain. * * Do not use this outside of digests! * * This is almost a duplicate of bp_core_get_user_domain(), but references * our already-fetched mass-userdata array to avoid pinging the DB over and * over again in a foreach loop. */ function ass_digest_get_user_domain($user_id) { global $bp; if (empty($bp->ass->massdata)) { return false; } $mass_userdata = $bp->ass->massdata; $username = bp_is_username_compatibility_mode() ? $mass_userdata[$user_id]['user_login'] : $mass_userdata[$user_id]['user_nicename']; if (bp_core_enable_root_profiles()) { $after_domain = $username; } else { $after_domain = bp_get_members_root_slug() . '/'; $after_domain .= bp_is_username_compatibility_mode() ? rawurlencode($username) : $username; } $domain = trailingslashit(bp_get_root_domain() . '/' . $after_domain); $domain = apply_filters('bp_core_get_user_domain_pre_cache', $domain, $user_id, $mass_userdata[$user_id]['user_nicename'], $mass_userdata[$user_id]['user_login']); return apply_filters('bp_core_get_user_domain', $domain, $user_id, $mass_userdata[$user_id]['user_nicename'], $mass_userdata[$user_id]['user_login']); }
function rw_bp_docs_set_the_doc_relatetd_group() { $d_doc_id = $folder_id = $group_id = 0; $group = new stdClass(); $url = '#'; $description = ''; if (bp_docs_is_existing_doc()) { $d_doc_id = get_queried_object_id(); $folder_id = bp_docs_get_doc_folder($d_doc_id); if ($folder_id) { $group_id = bp_docs_get_folder_group($folder_id); if ($group_id) { $group = groups_get_group(array('group_id' => $group_id)); buddypress()->groups->current_group = $group; if (!bp_disable_group_avatar_uploads()) { $url = bp_get_groups_root_slug() . '/' . $group->slug; } $avatar = bp_get_group_avatar('type=thumb&width=250&height=250'); $description = $group->description; $name = $group->name; } } else { $post = get_post($d_doc_id); $user = get_userdata($post->post_author); $name = $user->display_name; $avatar = bp_core_fetch_avatar(array('type' => 'thumb', 'width' => 250, 'height' => 250, 'item_id' => $user->ID)); $description = ''; $url = bp_get_members_root_slug() . '/' . $user->nice_name; } } ?> <div id="bp_docs_sitebar_info"> <h2><a href="/<?php echo $url; ?> "><?php echo $name; ?> </a></h2> <div class="group-avatar"> <a href="/<?php echo $url; ?> "><?php echo $avatar; ?> </a> </div> <div class="group-info"> <p><?php echo $description; ?> </p> </div> </div> <hr> <?php }
/** * Handles BP profile saving action * * @global object $current_user * @param int $user_id * @param array $posted_field_ids * @param array $errors * @author korotkov@UD */ static function bp_profile_updated($user_id, $posted_field_ids, $errors) { global $current_user, $bp; if (is_admin()) { return; } //** Get new user_data from POST */ $user_data = $_REQUEST['wp_crm']['user_data']; //** user_id is required */ $user_data['user_id'][0]['value'] = $user_id; //** user_email is required */ if (!array_key_exists('user_email', $user_data)) { $user_data['user_email'][0]['value'] = $current_user->user_email; } //** Change display name if xprofile full name exists */ $fullname_field_name = bp_xprofile_fullname_field_name(); $fullname_field_id = xprofile_get_field_id_from_name($fullname_field_name); if (in_array($fullname_field_id, $posted_field_ids)) { $display_name = xprofile_get_field_data($fullname_field_name, $user_id); $user_data['display_name'] = $display_name; } //** Save user data */ $user_id = wp_crm_save_user_data($user_data); //** Determine if user changed nicename (display name in URL). peshkov@UD */ if ($user_id && isset($user_data['user_nicename'])) { $user_domain = bp_displayed_user_domain(); $userdata = get_userdata($user_id); $user_nicename = $userdata->data->user_nicename; $needle = bp_get_members_root_slug() . '/' . $user_nicename . '/'; $pos = strpos($user_domain, $needle); if ($pos === false) { //** Looks like user_nicename was changed so redirect to the new profile's URL. */ $user_domain = str_replace($bp->displayed_user->userdata->user_nicename, $user_nicename, $user_domain); if ($errors) { bp_core_add_message(__('There was a problem updating some of your profile information, please try again.', ud_get_wp_crm()->domain), 'error'); } else { bp_core_add_message(__('Changes saved.', ud_get_wp_crm()->domain)); } //* Redirect back to the edit screen to display the updates and message */ bp_core_redirect(trailingslashit($user_domain . $bp->profile->slug . '/edit/group/' . bp_action_variable(1))); } } }
/** * Output the about screen. * * @since BuddyPress (1.7.0) */ public function about_screen() { global $wp_rewrite; $is_new_install = !empty($_GET['is_new_install']); $pretty_permalinks_enabled = !empty($wp_rewrite->permalink_structure); $image_base = buddypress()->plugin_url . 'bp-core/images/bp20/'; list($display_version) = explode('-', bp_get_version()); ?> <div class="wrap about-wrap"> <h1><?php printf(__('Welcome to BuddyPress %s', 'buddypress'), $display_version); ?> </h1> <div class="about-text"> <?php if ($is_new_install) { ?> <?php printf(__('It’s a great time to use BuddyPress! With a focus on speed, admin tools, and developer enhancements, %s is our leanest and most powerful version yet.', 'buddypress'), $display_version); ?> <?php } else { ?> <?php printf(__('Thanks for updating! With a focus on speed, admin tools, and developer enhancements, BuddyPress %s is our leanest and most powerful version yet.', 'buddypress'), $display_version); ?> <?php } ?> </div> <div class="bp-badge"></div> <h2 class="nav-tab-wrapper"> <a class="nav-tab nav-tab-active" href="<?php echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-about'), 'index.php'))); ?> "> <?php _e('What’s New', 'buddypress'); ?> </a><a class="nav-tab" href="<?php echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-credits'), 'index.php'))); ?> "> <?php _e('Credits', 'buddypress'); ?> </a> </h2> <?php if ($is_new_install) { ?> <h3><?php _e('Getting Started', 'buddypress'); ?> </h3> <div class="feature-section"> <h4><?php _e('Your Default Setup', 'buddypress'); ?> </h4> <?php if (bp_is_active('members') && bp_is_active('activity') && current_user_can($this->capability)) { ?> <p><?php printf(__('BuddyPress’s powerful features help your users connect and collaborate. To help get your community started, we’ve activated two of the most commonly used tools in BP: <strong>Extended Profiles</strong> and <strong>Activity Streams</strong>. See these components in action at the %1$s and %2$s directories, and be sure to spend a few minutes <a href="%3$s">configuring user profiles</a>. Want to explore more of BP’s features? Visit the <a href="%4$s">Components panel</a>.', 'buddypress'), $pretty_permalinks_enabled ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()) . '">' . __('Members', 'buddypress') . '</a>' : __('Members', 'buddypress'), $pretty_permalinks_enabled ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_activity_root_slug()) . '">' . __('Activity', 'buddypress') . '</a>' : __('Activity', 'buddypress'), bp_get_admin_url(add_query_arg(array('page' => 'bp-profile-setup'), 'users.php')), bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $this->settings_page))); ?> </p> <?php } else { ?> <p><?php printf(__('BuddyPress’s powerful features help your users connect and collaborate. Want to explore BP’s features? Visit the <a href="%s">Components panel</a>.', 'buddypress'), bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $this->settings_page))); ?> </p> <?php } ?> <h4><?php _e('Community and Support', 'buddypress'); ?> </h4> <p><?php _e('Looking for help? The <a href="http://codex.buddypress.org/">BuddyPress Codex</a> has you covered, with dozens of user-contributed guides on how to configure and use your BP site. Can’t find what you need? Stop by <a href="http://buddypress.org/support/">our support forums</a>, where a vibrant community of BuddyPress users and developers is waiting to share tips, show off their sites, talk about the future of BuddyPress, and much more.', 'buddypress'); ?> </p> </div> <hr /> <?php } ?> <div class="changelog"> <h2 class="about-headline-callout"><?php _e('Performance Improvements', 'buddypress'); ?> </h2> <img class="about-overview-img" src="<?php echo $image_base; ?> performance.png" alt="Performance improvements in BP 2.0" /> <p><?php esc_html_e('Whether your community has tens of members or tens of thousands, we think the performance improvements in BuddyPress 2.0 will knock your socks off. We’ve slashed our memory footprint and query overhead across the board, with a special focus on the Activity and Members components.', 'buddypress'); ?> </p> </div> <hr /> <div class="changelog"> <h2 class="about-headline-callout"><?php _e('New Administrative Tools', 'buddypress'); ?> </h2> <div class="feature-section col two-col"> <div> <h4><?php esc_html_e('Extended Profiles in Admin', 'buddypress'); ?> </h4> <p><?php esc_html_e('Site administrators can edit members’ xProfile data at Dashboard > Users > Extended Profiles.', 'buddypress'); ?> </p> <img src="<?php echo $image_base; ?> admin-xprofile.jpg" style="width:90%" /> </div> <div class="last-feature"> <h4><?php esc_html_e('Registration Management', 'buddypress'); ?> </h4> <p><?php esc_html_e('Perform common tasks with pending signups - including resending activation emails and manually activating accounts - on the new Pending tab of Dashboard > Users.', 'buddypress'); ?> </p> <img src="<?php echo $image_base; ?> users-pending.jpg" style="width:90%" /> </div> </div> <div class="feature-section col two-col"> <div> <h4><?php esc_html_e('BuddyPress Repair Tools', 'buddypress'); ?> </h4> <p><?php esc_html_e('Dashboard > Tools > BuddyPress contains a number of tools for correcting data that occasionally gets out of sync on BP installs.', 'buddypress'); ?> </p> <img src="<?php echo $image_base; ?> tools-buddypress.jpg" style="width:90%" /> </div> <div class="feature-section col two-col"> <h4><?php esc_html_e('Mark Spammers in Admin', 'buddypress'); ?> </h4> <p><?php esc_html_e('Admins on non-Multisite installations can now perform spam actions from Dashboard > Users > All Users.', 'buddypress'); ?> </p> <img src="<?php echo $image_base; ?> user-mark-spam.jpg" style="width:90%" /> </div> </div> </div> <hr /> <div class="changelog"> <h2 class="about-headline-callout"><?php esc_html_e('A More Dynamic Activity Stream', 'buddypress'); ?> </h2> <div class="feature-section col two-col"> <div> <p><?php esc_html_e('Spend a lot of time viewing the activity stream? BuddyPress 2.0 automatically lets you know when new items are waiting to be loaded.', 'buddypress'); ?> </p> <p><?php esc_html_e('The activity stream is better integrated with blog posts, too. Comment on a blog post, and an activity item is posted. Comment on a blog-related activity item, and a blog comment is posted. No more worrying about fractured conversations.', 'buddypress'); ?> </p> <p><?php esc_html_e('We’ve also reworked the way that phrases like "Boone posted an update" are handled, so that they’re always up-to-date and always translatable.', 'buddypress'); ?> </p> </div> <div class="feature-section col two-col"> <img src="<?php echo $image_base; ?> load-newest.jpg" style="width:90%" /> </div> </div> </div> <hr /> <div class="changelog"> <h2 class="about-headline-callout"><?php esc_html_e('Developer Tools', 'buddypress'); ?> </h2> <p><?php esc_html_e('BuddyPress 2.0 is full of new and improved tools for the theme and plugin developer. A few highlights:', 'buddypress'); ?> </p> <ul> <li><?php _e('The <code>BP_XProfile_Field_Type</code> class makes it a breeze to create new xProfile field types with custom display callbacks, validation, and more.', 'buddypress'); ?> </li> <li><?php _e('Major improvements have taken place with respect to object caching throughout BuddyPress. If you use Memcached, APC, or some other persistent object caching backend on your BuddyPress site, you should notice huge performance boosts.', 'buddypress'); ?> </li> <li><?php _e('Our internal metadata libraries have been rewritten to use WP’s <code>add_metadata()</code>, <code>update_metadata()</code>, and so on. This means greater consistency and parity between the components when storing and retrieving BuddyPress metadata.', 'buddypress'); ?> </li> <li><?php printf(__('<a href="%s">…and lots more!</a>', 'buddypress'), 'http://codex.buddypress.org/releases/version-2-0'); ?> </li> </ul> </div> <hr /> <?php if (current_user_can($this->capability)) { ?> <div class="return-to-dashboard"> <a href="<?php echo esc_url(bp_get_admin_url(add_query_arg(array('page' => 'bp-components'), $this->settings_page))); ?> "><?php _e('Go to the BuddyPress Settings page', 'buddypress'); ?> </a> </div> <?php } ?> </div> <?php }
/** * Return the domain for the passed user: e.g. http://domain.com/members/andy/. * * @param int $user_id The ID of the user. * @param string $user_nicename Optional. user_nicename of the user. * @param string $user_login Optional. user_login of the user. */ function bp_core_get_user_domain($user_id = 0, $user_nicename = false, $user_login = false) { if (empty($user_id)) { return; } $username = bp_core_get_username($user_id, $user_nicename, $user_login); if (bp_is_username_compatibility_mode()) { $username = rawurlencode($username); } $after_domain = bp_core_enable_root_profiles() ? $username : bp_get_members_root_slug() . '/' . $username; $domain = trailingslashit(bp_get_root_domain() . '/' . $after_domain); // Don't use this filter. Subject to removal in a future release. // Use the 'bp_core_get_user_domain' filter instead. $domain = apply_filters('bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login); return apply_filters('bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login); }
?> "> <h1 class="post-title"><?php apoc_title(); ?> </h1> <p class="post-byline"><?php apoc_description(); ?> </p> </header> <nav id="directory-nav" class="dir-list-tabs" role="navigation"> <ul id="directory-actions" class="directory-tabs"> <li class="selected" id="members-all"><a href="<?php echo trailingslashit(SITEURL . '/' . bp_get_members_root_slug()); ?> ">All Members<span><?php echo bp_get_total_member_count(); ?> </span></a></li> <?php if (is_user_logged_in()) { ?> <li id="members-personal"><a href="<?php echo bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends/'; ?> ">My Friends<span><?php echo bp_get_total_friend_count(); ?> </span></a></li>
/** * Applies restrictions based on the Theme options -> Memberships * @return void * @since 2.0 */ function kleo_pmpro_restrict_rules() { //if PMPRO is not activated if (!function_exists('pmpro_url')) { return; } //if buddypress is not activated if (!function_exists('bp_is_active')) { return; } //full current url $actual_link = kleo_full_url(); //our request uri $home_url = home_url(); //WPML support if (defined('ICL_SITEPRESS_VERSION')) { global $sitepress; $home_url = $sitepress->language_url(ICL_LANGUAGE_CODE); } $home_url = str_replace("www.", "", $home_url); $uri = str_replace(untrailingslashit($home_url), "", $actual_link); //restriction match array $final = array(); $allowed_chars = apply_filters('kleo_pmpro_allowed_chars', "a-z 0-9~%.:_\\-"); $restrict_options = kleo_memberships(); $members_slug = str_replace('/', '\\/', bp_get_members_root_slug()); /*-----------------------------------------------------------------------------------*/ /* Preg match rules /*-----------------------------------------------------------------------------------*/ //members directory restriction rule $final["/^\\/" . $members_slug . "\\/?\$/"] = array('name' => 'members_dir', 'type' => $restrict_options['members_dir']['type'], 'levels' => isset($restrict_options['members_dir']['levels']) ? $restrict_options['members_dir']['levels'] : array()); //members single profile restriction rule $final["/^\\/" . $members_slug . "\\/[" . $allowed_chars . "\\/]+\\/?\$/"] = array('name' => 'view_profiles', 'type' => $restrict_options['view_profiles']['type'], 'levels' => isset($restrict_options['view_profiles']['levels']) ? $restrict_options['view_profiles']['levels'] : array()); if (function_exists('bp_get_groups_root_slug')) { $groups_slug = str_replace('/', '\\/', bp_get_groups_root_slug()); //groups directory restriction rule $final["/^\\/" . $groups_slug . "\\/?\$/"] = array('name' => 'groups_dir', 'type' => $restrict_options['groups_dir']['type'], 'levels' => isset($restrict_options['groups_dir']['levels']) ? $restrict_options['groups_dir']['levels'] : array()); //groups single page restriction rule $final["/^\\/" . $groups_slug . "\\/[" . $allowed_chars . "\\/]+\\/?\$/"] = array('name' => 'view_groups', 'type' => $restrict_options['view_groups']['type'], 'levels' => isset($restrict_options['view_groups']['levels']) ? $restrict_options['view_groups']['levels'] : array()); } if (function_exists('bp_get_activity_root_slug')) { $activity_slug = str_replace('/', '\\/', bp_get_activity_root_slug()); //activity page restriction rule $final["/^\\/" . $activity_slug . "\\/?\$/"] = array('name' => 'show_activity', 'type' => $restrict_options['show_activity']['type'], 'levels' => isset($restrict_options['show_activity']['levels']) ? $restrict_options['show_activity']['levels'] : array()); } /* You can add extra restrictions using this filter */ $final = apply_filters('kleo_pmpro_match_rules', $final); //no redirection for super-admin if (is_super_admin()) { return false; } elseif (is_user_logged_in()) { //restrict media if (preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/media\\/?/", $uri) || preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/album\\/?/", $uri)) { kleo_check_access('add_media', $restrict_options); } elseif (preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/messages\\/compose\\/?/", $uri) || preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/messages\\/view\\/[" . $allowed_chars . "\\/]?\\/?/", $uri)) { kleo_check_access('pm', $restrict_options); } /* Add other restrictions for own profile */ do_action('kleo_pmro_extra_restriction_before_my_profile', $restrict_options); //allow me to view other parts of my profile if (bp_is_my_profile()) { return false; } } //loop trought remaining restrictions foreach ($final as $rk => $rv) { if (preg_match($rk, $uri)) { kleo_check_access($rv['name'], $restrict_options); } } do_action('kleo_pmro_extra_restriction_rules', $restrict_options); }
/** * Handle the loading of the Activate screen. */ function bp_core_screen_activation() { global $bp; if (!bp_is_current_component('activate')) { return false; } // If the user is logged in, redirect away from here if (is_user_logged_in()) { if (bp_is_component_front_page('activate')) { $redirect_to = trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()); } else { $redirect_to = trailingslashit(bp_get_root_domain()); } bp_core_redirect(apply_filters('bp_loggedin_activate_page_redirect_to', $redirect_to)); return; } // Check if an activation key has been passed if (isset($_GET['key'])) { // Activate the signup $user = apply_filters('bp_core_activate_account', bp_core_activate_signup($_GET['key'])); // If there were errors, add a message and redirect if (!empty($user->errors)) { bp_core_add_message($user->get_error_message(), 'error'); bp_core_redirect(trailingslashit(bp_get_root_domain() . '/' . $bp->pages->activate->slug)); } $hashed_key = wp_hash($_GET['key']); // Check if the avatar folder exists. If it does, move rename it, move // it and delete the signup avatar dir if (file_exists(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key)) { @rename(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key, bp_core_avatar_upload_path() . '/avatars/' . $user); } bp_core_add_message(__('Your account is now active!', 'buddypress')); $bp->activation_complete = true; } bp_core_load_template(apply_filters('bp_core_template_activate', array('activate', 'registration/activate'))); }
function bp_core_screen_signup() { global $bp, $wpdb; if (!bp_is_current_component('register')) { return; } // Not a directory bp_update_is_directory(false, 'register'); // If the user is logged in, redirect away from here if (is_user_logged_in()) { if (bp_is_component_front_page('register')) { $redirect_to = bp_get_root_domain() . '/' . bp_get_members_root_slug(); } else { $redirect_to = bp_get_root_domain(); } bp_core_redirect(apply_filters('bp_loggedin_register_page_redirect_to', $redirect_to)); return; } $bp->signup->step = 'request-details'; if (!bp_get_signup_allowed()) { $bp->signup->step = 'registration-disabled'; } elseif (isset($_POST['signup_submit'])) { // Check the nonce check_admin_referer('bp_new_signup'); // Check the base account details for problems $account_details = bp_core_validate_user_signup($_POST['signup_username'], $_POST['signup_email']); // If there are errors with account details, set them for display if (!empty($account_details['errors']->errors['user_name'])) { $bp->signup->errors['signup_username'] = $account_details['errors']->errors['user_name'][0]; } if (!empty($account_details['errors']->errors['user_email'])) { $bp->signup->errors['signup_email'] = $account_details['errors']->errors['user_email'][0]; } // Check that both password fields are filled in if (empty($_POST['signup_password']) || empty($_POST['signup_password_confirm'])) { $bp->signup->errors['signup_password'] = __('Please make sure you enter your password twice', 'buddypress'); } // Check that the passwords match if (!empty($_POST['signup_password']) && !empty($_POST['signup_password_confirm']) && $_POST['signup_password'] != $_POST['signup_password_confirm']) { $bp->signup->errors['signup_password'] = __('The passwords you entered do not match.', 'buddypress'); } $bp->signup->username = $_POST['signup_username']; $bp->signup->email = $_POST['signup_email']; // Now we've checked account details, we can check profile information if (bp_is_active('xprofile')) { // Make sure hidden field is passed and populated if (isset($_POST['signup_profile_field_ids']) && !empty($_POST['signup_profile_field_ids'])) { // Let's compact any profile field info into an array $profile_field_ids = explode(',', $_POST['signup_profile_field_ids']); // Loop through the posted fields formatting any datebox values then validate the field foreach ((array) $profile_field_ids as $field_id) { if (!isset($_POST['field_' . $field_id])) { if (!empty($_POST['field_' . $field_id . '_day']) && !empty($_POST['field_' . $field_id . '_month']) && !empty($_POST['field_' . $field_id . '_year'])) { $_POST['field_' . $field_id] = date('Y-m-d H:i:s', strtotime($_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'])); } } // Create errors for required fields without values if (xprofile_check_is_required_field($field_id) && empty($_POST['field_' . $field_id])) { $bp->signup->errors['field_' . $field_id] = __('This is a required field', 'buddypress'); } } // This situation doesn't naturally occur so bounce to website root } else { bp_core_redirect(bp_get_root_domain()); } } // Finally, let's check the blog details, if the user wants a blog and blog creation is enabled if (isset($_POST['signup_with_blog'])) { $active_signup = $bp->site_options['registration']; if ('blog' == $active_signup || 'all' == $active_signup) { $blog_details = bp_core_validate_blog_signup($_POST['signup_blog_url'], $_POST['signup_blog_title']); // If there are errors with blog details, set them for display if (!empty($blog_details['errors']->errors['blogname'])) { $bp->signup->errors['signup_blog_url'] = $blog_details['errors']->errors['blogname'][0]; } if (!empty($blog_details['errors']->errors['blog_title'])) { $bp->signup->errors['signup_blog_title'] = $blog_details['errors']->errors['blog_title'][0]; } } } do_action('bp_signup_validate'); // Add any errors to the action for the field in the template for display. if (!empty($bp->signup->errors)) { foreach ((array) $bp->signup->errors as $fieldname => $error_message) { add_action('bp_' . $fieldname . '_errors', create_function('', 'echo apply_filters(\'bp_members_signup_error_message\', "<div class=\\"error\\">' . $error_message . '</div>" );')); } } else { $bp->signup->step = 'save-details'; // No errors! Let's register those deets. $active_signup = !empty($bp->site_options['registration']) ? $bp->site_options['registration'] : ''; if ('none' != $active_signup) { // Let's compact any profile field info into usermeta $profile_field_ids = explode(',', $_POST['signup_profile_field_ids']); // Loop through the posted fields formatting any datebox values then add to usermeta foreach ((array) $profile_field_ids as $field_id) { if (!isset($_POST['field_' . $field_id])) { if (isset($_POST['field_' . $field_id . '_day'])) { $_POST['field_' . $field_id] = date('Y-m-d H:i:s', strtotime($_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'])); } } if (!empty($_POST['field_' . $field_id])) { $usermeta['field_' . $field_id] = $_POST['field_' . $field_id]; } } // Store the profile field ID's in usermeta $usermeta['profile_field_ids'] = $_POST['signup_profile_field_ids']; // Hash and store the password $usermeta['password'] = wp_hash_password($_POST['signup_password']); // If the user decided to create a blog, save those details to usermeta if ('blog' == $active_signup || 'all' == $active_signup) { $usermeta['public'] = isset($_POST['signup_blog_privacy']) && 'public' == $_POST['signup_blog_privacy'] ? true : false; } $usermeta = apply_filters('bp_signup_usermeta', $usermeta); // Finally, sign up the user and/or blog if (isset($_POST['signup_with_blog']) && is_multisite()) { bp_core_signup_blog($blog_details['domain'], $blog_details['path'], $blog_details['blog_title'], $_POST['signup_username'], $_POST['signup_email'], $usermeta); } else { bp_core_signup_user($_POST['signup_username'], $_POST['signup_password'], $_POST['signup_email'], $usermeta); } $bp->signup->step = 'completed-confirmation'; } do_action('bp_complete_signup'); } } do_action('bp_core_screen_signup'); bp_core_load_template(apply_filters('bp_core_template_register', 'registration/register')); }
/** * Returns the domain for the passed user: e.g. http://domain.com/members/andy/ * * @package BuddyPress Core * @global $current_user WordPress global variable containing current logged in user information * @param user_id The ID of the user. */ function bp_core_get_user_domain($user_id, $user_nicename = false, $user_login = false) { global $bp; if (empty($user_id)) { return; } if (!($domain = wp_cache_get('bp_user_domain_' . $user_id, 'bp'))) { $username = bp_core_get_username($user_id, $user_nicename, $user_login); if (bp_is_username_compatibility_mode()) { $username = rawurlencode($username); } // If we are using a members slug, include it. if (!defined('BP_ENABLE_ROOT_PROFILES')) { $domain = bp_get_root_domain() . '/' . bp_get_members_root_slug() . '/' . $username; } else { $domain = bp_get_root_domain() . '/' . $username; } // Add a slash at the end, and filter before caching $domain = apply_filters('bp_core_get_user_domain_pre_cache', trailingslashit($domain), $user_id, $user_nicename, $user_login); // Cache the link if (!empty($domain)) { wp_cache_set('bp_user_domain_' . $user_id, $domain, 'bp'); } } return apply_filters('bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login); }
function widget($args, $instance) { extract($args); if (!$instance['member_default']) { $instance['member_default'] = 'active'; } echo $before_widget; $title = $instance['link_title'] ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()) . '">' . $instance['title'] . '</a>' : $instance['title']; echo $before_title . $title . $after_title; ?> <?php if (bp_has_members('user_id=0&type=' . $instance['member_default'] . '&max=' . $instance['max_members'] . '&populate_extras=0')) { ?> <div class="item-options" id="members-list-options"> <a href="<?php echo site_url(bp_get_members_root_slug()); ?> " id="newest-members" <?php if ($instance['member_default'] == 'newest') { ?> class="selected"<?php } ?> ><?php _e('Newest', 'buddypress'); ?> </a> | <a href="<?php echo site_url(bp_get_members_root_slug()); ?> " id="recently-active-members" <?php if ($instance['member_default'] == 'active') { ?> class="selected"<?php } ?> ><?php _e('Active', 'buddypress'); ?> </a> <?php if (bp_is_active('friends')) { ?> | <a href="<?php echo site_url(bp_get_members_root_slug()); ?> " id="popular-members" <?php if ($instance['member_default'] == 'popular') { ?> class="selected"<?php } ?> ><?php _e('Popular', 'buddypress'); ?> </a> <?php } ?> </div> <ul id="members-list" class="item-list"> <?php while (bp_members()) { bp_the_member(); ?> <li class="vcard"> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_avatar(); ?> </a> </div> <div class="item"> <div class="item-title fn"><a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_name(); ?> </a></div> <div class="item-meta"> <span class="activity"> <?php if ('newest' == $instance['member_default']) { bp_member_registered(); } if ('active' == $instance['member_default']) { bp_member_last_active(); } if ('popular' == $instance['member_default']) { bp_member_total_friend_count(); } ?> </span> </div> </div> </li> <?php } ?> </ul> <?php wp_nonce_field('bp_core_widget_members', '_wpnonce-members'); ?> <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo esc_attr($instance['max_members']); ?> " /> <?php } else { ?> <div class="widget-error"> <?php _e('No one has signed up yet!', 'buddypress'); ?> </div> <?php } ?> <?php echo $after_widget; ?> <?php }
/** * Display the Members widget. * * @see WP_Widget::widget() for description of parameters. * * @param array $args Widget arguments. * @param array $instance Widget settings, as saved by the user. */ function widget($args, $instance) { extract($args); if (!$instance['member_default']) { $instance['member_default'] = 'active'; } $title = apply_filters('widget_title', $instance['title']); echo $before_widget; $title = $instance['link_title'] ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug()) . '">' . $title . '</a>' : $title; echo $before_title . $title . $after_title; $members_args = array('user_id' => 0, 'type' => $instance['member_default'], 'per_page' => $instance['max_members'], 'max' => $instance['max_members'], 'populate_extras' => true, 'search_terms' => false); ?> <?php if (bp_has_members($members_args)) { ?> <div class="main_tabs"> <div class="item-options" id="members-list-options"> <ul class="widget-tabbed-header mom-bp-tabbed-widgets"> <li><a href="<?php bp_members_directory_permalink(); ?> " id="newest-members" <?php if ($instance['member_default'] == 'newest') { ?> class="selected"<?php } ?> ><?php _e('Newest', 'buddypress'); ?> </a></li> <li><a href="<?php bp_members_directory_permalink(); ?> " id="recently-active-members" <?php if ($instance['member_default'] == 'active') { ?> class="selected"<?php } ?> ><?php _e('Active', 'buddypress'); ?> </a></li> <?php if (bp_is_active('friends')) { ?> <li><a href="<?php bp_members_directory_permalink(); ?> " id="popular-members" <?php if ($instance['member_default'] == 'popular') { ?> class="selected"<?php } ?> ><?php _e('Popular', 'buddypress'); ?> </a></li> <?php } ?> </ul> </div> <div class="widget-tabbed-body"> <ul id="members-list" class="item-list"> <?php while (bp_members()) { bp_the_member(); ?> <li class="vcard"> <div class="item-avatar"> <a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_avatar(); ?> </a> </div> <div class="item"> <div class="item-title fn"><a href="<?php bp_member_permalink(); ?> " title="<?php bp_member_name(); ?> "><?php bp_member_name(); ?> </a></div> <div class="item-meta"> <span class="activity"> <?php if ('newest' == $instance['member_default']) { bp_member_registered(); } if ('active' == $instance['member_default']) { bp_member_last_active(); } if ('popular' == $instance['member_default']) { bp_member_total_friend_count(); } ?> </span> </div> </div> </li> <?php } ?> </ul> </div> </div> <!--main tabs--> <?php wp_nonce_field('bp_core_widget_members', '_wpnonce-members'); ?> <input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo esc_attr($instance['max_members']); ?> " /> <?php } else { ?> <div class="widget-error"> <?php _e('No one has signed up yet!', 'buddypress'); ?> </div> <?php } ?> <?php echo $after_widget; ?> <?php }
function xprofile_filter_link_profile_data($field_value, $field_type = 'textbox') { if ('datebox' == $field_type) { return $field_value; } if (!strpos($field_value, ',') && count(explode(' ', $field_value)) > 5) { return $field_value; } $values = explode(',', $field_value); if ($values) { foreach ((array) $values as $value) { $value = trim($value); // If the value is a URL, skip it and just make it clickable. if (preg_match('@(https?://([-\\w\\.]+)+(:\\d+)?(/([\\w/_\\.]*(\\?\\S+)?)?)?)@', $value)) { $new_values[] = make_clickable($value); } else { if (count(explode(' ', $value)) > 5) { $new_values[] = $value; } else { $new_values[] = '<a href="' . site_url(bp_get_members_root_slug()) . '/?s=' . strip_tags($value) . '" rel="nofollow">' . $value . '</a>'; } } } $values = implode(', ', $new_values); } return $values; }
/** * Return member directory permalink. * * @since 1.5.0 * * @return string */ function bp_get_members_directory_permalink() { /** * Filters the member directory permalink. * * @since 1.5.0 * * @param string $value Members directory permalink. */ return apply_filters('bp_get_members_directory_permalink', trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug())); }
/** * Returns the domain for the passed user: e.g. http://domain.com/members/andy/ * * @package BuddyPress Core * @global $current_user WordPress global variable containing current logged in user information * @param user_id The ID of the user. */ function bp_core_get_user_domain($user_id, $user_nicename = false, $user_login = false) { if (empty($user_id)) { return; } if (!($domain = wp_cache_get('bp_user_domain_' . $user_id, 'bp'))) { $username = bp_core_get_username($user_id, $user_nicename, $user_login); if (bp_is_username_compatibility_mode()) { $username = rawurlencode($username); } $after_domain = bp_core_enable_root_profiles() ? $username : bp_get_members_root_slug() . '/' . $username; $domain = trailingslashit(bp_get_root_domain() . '/' . $after_domain); $domain = apply_filters('bp_core_get_user_domain_pre_cache', $domain, $user_id, $user_nicename, $user_login); // Cache the link if (!empty($domain)) { wp_cache_set('bp_user_domain_' . $user_id, $domain, 'bp'); } } return apply_filters('bp_core_get_user_domain', $domain, $user_id, $user_nicename, $user_login); }
/** * bp_forums_strip_mentions_on_post_edit( $title ) * * Removes the anchor tag autogenerated for at-mentions when forum topics and posts are edited. * Prevents embedded anchor tags. * * @global object $bp * @param string $content * @return string $content */ function bp_forums_strip_mentions_on_post_edit($content) { global $bp; $content = htmlspecialchars_decode($content); $pattern = "|<a href='" . bp_get_root_domain() . "/" . bp_get_members_root_slug() . "/[A-Za-z0-9-_\\.]+/' rel='nofollow'>(@[A-Za-z0-9-_\\.@]+)</a>|"; $content = preg_replace($pattern, "\$1", $content); return $content; }
/** * Return the linked name of the user who last posted to the current topic in the loop. * * @return string HTML link to the profile of the user who last posted * to the current topic. */ function bp_get_the_topic_last_poster_name() { global $forum_template; $domain = bp_core_get_user_domain( $forum_template->topic->topic_last_poster, $forum_template->topic->topic_last_poster_nicename, $forum_template->topic->topic_last_poster_login ) ; // In the case where no user is found, bp_core_get_user_domain() may return the URL // of the Members directory if ( !$domain || $domain == bp_core_get_root_domain() . '/' . bp_get_members_root_slug() . '/' ) return __( 'Deleted User', 'buddypress' ); /** * Filters the linked name of the user who last posted to the current topic in the loop. * * @since BuddyPress (1.0.0) * * @param string $value HTML link to the profile of the user who last posted. */ return apply_filters( 'bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>' ); }
/** * A javascript-free implementation of the search functions in BuddyPress. * * @param string $slug The slug to redirect to for searching. */ function bp_core_action_search_site($slug = '') { if (!bp_is_current_component(bp_get_search_slug())) { return; } if (empty($_POST['search-terms'])) { bp_core_redirect(bp_get_root_domain()); return; } $search_terms = stripslashes($_POST['search-terms']); $search_which = !empty($_POST['search-which']) ? $_POST['search-which'] : ''; $query_string = '/?s='; if (empty($slug)) { switch ($search_which) { case 'posts': $slug = ''; $var = '/?s='; // If posts aren't displayed on the front page, find the post page's slug. if ('page' == get_option('show_on_front')) { $page = get_post(get_option('page_for_posts')); if (!is_wp_error($page) && !empty($page->post_name)) { $slug = $page->post_name; $var = '?s='; } } break; case 'blogs': $slug = bp_is_active('blogs') ? bp_get_blogs_root_slug() : ''; break; case 'forums': $slug = bp_is_active('forums') ? bp_get_forums_root_slug() : ''; $query_string = '/?fs='; break; case 'groups': $slug = bp_is_active('groups') ? bp_get_groups_root_slug() : ''; break; case 'members': default: $slug = bp_get_members_root_slug(); break; } if (empty($slug) && 'posts' != $search_which) { bp_core_redirect(bp_get_root_domain()); return; } } bp_core_redirect(apply_filters('bp_core_search_site', home_url($slug . $query_string . urlencode($search_terms)), $search_terms)); }
/** * Get the canonical URL of the current page. * * @since BuddyPress (1.6.0) * * @uses apply_filters() Filter bp_get_canonical_url to modify return value. * * @param array $args { * Optional array of arguments. * @type bool $include_query_args Whether to include current URL arguments * in the canonical URL returned from the function. * } * @return string Canonical URL for the current page. */ function bp_get_canonical_url($args = array()) { global $bp; // For non-BP content, return the requested url, and let WP do the work if (bp_is_blog_page()) { return bp_get_requested_url(); } $defaults = array('include_query_args' => false); $r = wp_parse_args($args, $defaults); extract($r); // Special case: when a BuddyPress directory (eg example.com/members) // is set to be the front page, ensure that the current canonical URL // is the home page URL. if ('page' == get_option('show_on_front') && ($page_on_front = (int) get_option('page_on_front'))) { $front_page_component = array_search($page_on_front, bp_core_get_directory_page_ids()); // If requesting the front page component directory, canonical // URL is the front page. We detect whether we're detecting a // component *directory* by checking that bp_current_action() // is empty - ie, this not a single item or a feed if (false !== $front_page_component && bp_is_current_component($front_page_component) && !bp_current_action()) { $bp->canonical_stack['canonical_url'] = trailingslashit(bp_get_root_domain()); // Except when the front page is set to the registration page // and the current user is logged in. In this case we send to // the members directory to avoid redirect loops } else { if (bp_is_register_page() && 'register' == $front_page_component && is_user_logged_in()) { $bp->canonical_stack['canonical_url'] = apply_filters('bp_loggedin_register_page_redirect_to', trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug())); } } } if (empty($bp->canonical_stack['canonical_url'])) { // Build the URL in the address bar $requested_url = bp_get_requested_url(); // Stash query args $url_stack = explode('?', $requested_url); // Build the canonical URL out of the redirect stack if (isset($bp->canonical_stack['base_url'])) { $url_stack[0] = $bp->canonical_stack['base_url']; } if (isset($bp->canonical_stack['component'])) { $url_stack[0] = trailingslashit($url_stack[0] . $bp->canonical_stack['component']); } if (isset($bp->canonical_stack['action'])) { $url_stack[0] = trailingslashit($url_stack[0] . $bp->canonical_stack['action']); } if (!empty($bp->canonical_stack['action_variables'])) { foreach ((array) $bp->canonical_stack['action_variables'] as $av) { $url_stack[0] = trailingslashit($url_stack[0] . $av); } } // Add trailing slash $url_stack[0] = trailingslashit($url_stack[0]); // Stash in the $bp global $bp->canonical_stack['canonical_url'] = implode('?', $url_stack); } $canonical_url = $bp->canonical_stack['canonical_url']; if (!$include_query_args) { $canonical_url = array_reverse(explode('?', $canonical_url)); $canonical_url = array_pop($canonical_url); } return apply_filters('bp_get_canonical_url', $canonical_url, $args); }
<?php if (!substr_count($_SERVER['REQUEST_URI'], '/' . bp_get_members_root_slug()) && !substr_count($_SERVER['REQUEST_URI'], '/' . bp_get_groups_root_slug()) && !in_array('bp-profile', apply_filters('body_class', 'a-class')) && !in_array('bp-plugin', apply_filters('body_class', 'a-class'))) { ?> <div id="sidebar-page"> <?php dynamic_sidebar('sidebar-page'); ?> </div><!-- #sidebar-page --> <?php }
<?php } ?> <li<?php if (bp_is_members_component() || bp_is_user()) { ?> class="selected"<?php } ?> > <a href="<?php echo site_url(); ?> /<?php echo bp_get_members_root_slug(); ?> /" title="<?php _e('Members', 'framemarket'); ?> "><?php _e('Members', 'framemarket'); ?> </a> </li> <?php if (bp_is_active('groups')) { ?> <li<?php if ((bp_is_groups_component() || bp_is_group()) && !bp_is_user_groups()) {
/** * Handle the loading of the Activate screen. * * @todo Move the actual activation process into an action in bp-members-actions.php */ function bp_core_screen_activation() { // Bail if not viewing the activation page if (!bp_is_current_component('activate')) { return false; } // If the user is already logged in, redirect away from here if (is_user_logged_in()) { // If activation page is also front page, set to members directory to // avoid an infinite loop. Otherwise, set to root domain. $redirect_to = bp_is_component_front_page('activate') ? bp_get_root_domain() . '/' . bp_get_members_root_slug() : bp_get_root_domain(); // Trailing slash it, as we expect these URL's to be $redirect_to = trailingslashit($redirect_to); /** * Filters the URL to redirect logged in users to when visiting activation page. * * @since BuddyPress (1.9.0) * * @param string $redirect_to URL to redirect user to. */ $redirect_to = apply_filters('bp_loggedin_activate_page_redirect_to', $redirect_to); // Redirect away from the activation page bp_core_redirect($redirect_to); } // grab the key (the old way) $key = isset($_GET['key']) ? $_GET['key'] : ''; // grab the key (the new way) if (empty($key)) { $key = bp_current_action(); } // Get BuddyPress $bp = buddypress(); // we've got a key; let's attempt to activate the signup if (!empty($key)) { /** * Filters the activation signup. * * @since BuddyPress (1.1.0) * * @param bool|int $value Value returned by activation. * Integer on success, boolean on failure. */ $user = apply_filters('bp_core_activate_account', bp_core_activate_signup($key)); // If there were errors, add a message and redirect if (!empty($user->errors)) { bp_core_add_message($user->get_error_message(), 'error'); bp_core_redirect(trailingslashit(bp_get_root_domain() . '/' . $bp->pages->activate->slug)); } $hashed_key = wp_hash($key); // Check if the signup avatar folder exists. If it does, move the folder to // the BP user avatars directory if (file_exists(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key)) { @rename(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key, bp_core_avatar_upload_path() . '/avatars/' . $user); } bp_core_add_message(__('Your account is now active!', 'buddypress')); $bp->activation_complete = true; } /** * Filters the template to load for the Member activation page screen. * * @since BuddyPress (1.1.1) * * @param string $value Path to the Member activation template to load. */ bp_core_load_template(apply_filters('bp_core_template_activate', array('activate', 'registration/activate'))); }
/** * Return member directory permalink * * @package BuddyPress * @subpackage Members Template * @since 1.5 * @uses apply_filters() * @uses traisingslashit() * @uses bp_get_root_domain() * @uses bp_get_members_root_slug() * @return string */ function bp_get_members_directory_permalink() { return apply_filters('bp_get_members_directory_permalink', trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug())); }