本文整理汇总了PHP中bp_is_activation_page函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_is_activation_page函数的具体用法?PHP bp_is_activation_page怎么用?PHP bp_is_activation_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_is_activation_page函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fx_private_site_please_log_in
/**
* Redirects users that are not logged in to the 'wp-login.php' page.
* This function is taken from Private Site Feature in "Members" Plugin.
*
* @since 0.1.0
* @author Justin Tadlock <justin@justintadlock.com>
* @copyright Copyright (c) 2009 - 2016, Justin Tadlock
*/
function fx_private_site_please_log_in()
{
/* Check if the private site feature is active and if the user is not logged in. */
if (true === fx_private_site_get_option('enable', false) && !is_user_logged_in()) {
/* Hook */
do_action('fx_private_site_before_auth_redirect');
/* If using BuddyPress and on the register page, don't do anything. */
if (function_exists('bp_is_activation_page') && bp_is_activation_page()) {
return;
}
if (function_exists('bp_is_register_page') && bp_is_register_page()) {
return;
}
/* WooCommerce: Whitelist My Account Page */
if (class_exists('WooCommerce')) {
$myaccount_page_id = get_option('woocommerce_myaccount_page_id');
if ($myaccount_page_id && is_page($myaccount_page_id)) {
return;
}
}
/* Redirect to the login page. */
auth_redirect();
exit;
}
}
示例2: subway_redirect_to_login
/**
* Redirects all the pages except for few selected pages inside
* the reading settings
*
* (Front-end General)
*
* @return void
*/
function subway_redirect_to_login()
{
global $post;
$post_copy =& $post;
$login_page_id = intval(get_option('subway_login_page'));
$excluded_page = subway_get_excluded_page_id_collection();
// Already escaped inside 'subway_get_redirect_page_url'.
$redirect_page = subway_get_redirect_page_url();
// Check if redirect page is empty or not.
if (empty($redirect_page)) {
return;
}
// Check if buddypress activate page.
if (function_exists('bp_is_activation_page')) {
if (bp_is_activation_page()) {
return;
}
}
// Check if buddypress registration page.
if (function_exists('bp_is_register_page')) {
if (bp_is_register_page()) {
return;
}
}
// In case their is no post ID assign a 0 value to
// $post->ID. This pages applies to custom WordPress pages
// like BuddyPress Members and Groups.
if (empty($post_copy)) {
$post_copy = new stdclass();
$post_copy->ID = 0;
}
// Check if current page is locked down or not.
$current_page_id = intval($post_copy->ID);
// Check if $current_page_id && $selected_blog_id is equal to each other.
// If that's the case, get the page ID instead of global $post->ID that returns.
// the ID of the first post object inside the loop.
$blog_id = intval(get_option('page_for_posts'));
if (is_home()) {
if ($blog_id === $login_page_id) {
$current_page_id = $blog_id;
}
}
// Only execute the script for non-loggedin visitors.
if (!is_user_logged_in()) {
if ($current_page_id !== $login_page_id) {
if (!in_array($current_page_id, $excluded_page, true)) {
wp_safe_redirect(add_query_arg(array('_redirected' => 'yes'), $redirect_page));
die;
}
}
}
return;
}
示例3: is_registration
/**
* Are we looking at either the registration or activation pages?
*
* @since 1.7.0
*/
public function is_registration()
{
// Bail if not looking at the registration or activation page.
if (!bp_is_register_page() && !bp_is_activation_page()) {
return;
}
// Not a directory.
bp_update_is_directory(false, 'register');
// Setup actions.
add_filter('bp_get_buddypress_template', array($this, 'template_hierarchy'));
add_action('bp_template_include_reset_dummy_post_data', array($this, 'dummy_post'));
add_filter('bp_replace_the_content', array($this, 'dummy_content'));
}
示例4: maybe_redirect
/**
* Check user access and redirect if access denied
*/
public function maybe_redirect()
{
// always allow access to blog, registration and activation pages
if (bp_is_blog_page() || bp_is_register_page() || bp_is_activation_page()) {
return;
}
// grab toggle option from registry
$opt_toggle = $this->get_suboption('toggle');
// is option toggled on?
if ($opt_toggle && true == $opt_toggle->get()) {
// protection is enabled, is user logged in?
if (!is_user_logged_in()) {
// not logged in, redirect to registration page
bp_core_redirect(bp_get_root_domain() . '/' . bp_get_root_slug('register'));
// exit to avoid any accidental output
exit;
}
}
}
示例5: lazy_load_css_js
/**
* Lazy load CSS/JS files?
*
* @package s2Member\CSS_JS
* @since 131028
*
* @return boolean TRUE if we should load; else FALSE.
*/
public static function lazy_load_css_js()
{
static $load;
// Static cache var.
if (isset($load)) {
return $load;
}
$null = NULL;
// Needed below in earlier versions of WP.
if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['lazy_load_css_js']) {
$load = TRUE;
} else {
if (c_ws_plugin__s2member_systematics::is_s2_systematic_use_page()) {
$load = TRUE;
} else {
if (!empty($_GET[apply_filters('ws_plugin__s2member_check_force_ssl_get_var_name', 's2-ssl', array())])) {
$load = TRUE;
} else {
if (c_ws_plugin__s2member_utils_conds::bp_is_installed() && (bp_is_register_page() || bp_is_activation_page() || bp_is_user_profile())) {
$load = TRUE;
} else {
if (is_singular() && ($post = get_post($null)) && (stripos($post->post_content, 's2member') !== FALSE || stripos($post->post_content, '[s2') !== FALSE)) {
$load = TRUE;
} else {
if (preg_match('/\\/wp\\-signup\\.php|\\/wp\\-login\\.php|\\/wp\\-admin\\/(?:user\\/)?profile\\.php|[?&]s2member/', $_SERVER['REQUEST_URI'])) {
$load = TRUE;
}
}
}
}
}
}
if (!isset($load)) {
$load = FALSE;
}
// Make sure it's set; always.
return $load = apply_filters('ws_plugin__s2member_lazy_load_css_js', $load);
}
示例6: lazy_load_css_js
/**
* Lazy load CSS/JS files?
*
* @package s2Member\CSS_JS
* @since 131028
*
* @return boolean TRUE if we should load; else FALSE.
*/
public static function lazy_load_css_js()
{
static $load;
// Static cache var.
if (isset($load)) {
return $load;
}
if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["lazy_load_css_js"]) {
$load = TRUE;
} else {
if (c_ws_plugin__s2member_systematics::is_s2_systematic_use_page()) {
$load = TRUE;
} else {
if (!empty($_GET[apply_filters("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", array())])) {
$load = TRUE;
} else {
if (c_ws_plugin__s2member_utils_conds::bp_is_installed() && (bp_is_register_page() || bp_is_activation_page() || bp_is_user_profile())) {
$load = TRUE;
} else {
if (is_singular() && ($post = get_post(NULL)) && (stripos($post->post_content, "s2member") !== FALSE || stripos($post->post_content, "[s2") !== FALSE)) {
$load = TRUE;
} else {
if (preg_match("/\\/wp\\-signup\\.php" . "|\\/wp\\-login\\.php" . "|\\/wp\\-admin\\/(?:user\\/)?profile\\.php" . "|[?&]s2member/", $_SERVER["REQUEST_URI"])) {
$load = TRUE;
}
}
}
}
}
}
if (!isset($load)) {
$load = FALSE;
}
// Make sure it's set; always.
return $load = apply_filters("ws_plugin__s2member_lazy_load_css_js", $load);
}
示例7: elseif
<?php
if (is_404() || is_page_template('public-full.php') || is_page_template('public-subpages-4-column.php') || is_page_template('public-subpages.php') || is_page_template('gallery-public.php')) {
?>
</div>
</div>
</div>
</div>
</div>
<?php
} elseif (function_exists('bp_is_active') && bp_is_activation_page() || function_exists('bp_is_active') && bp_is_user() || function_exists('bp_is_active') && bp_is_register_page() || function_exists('bp_is_active') && bp_is_current_component('groups') || function_exists('bp_is_active') && bp_is_current_component('activity') || function_exists('bp_is_active') && bp_is_current_component('members') || class_exists('bbPress') && is_bbpress()) {
?>
</div>
</div>
</div>
</div>
</div>
<?php
} else {
?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<div class="clear"></div>
<div class="container">
示例8: subway_redirect_login
/**
* Redirect all wp-login.php post
* and get request to the user assigned log-in page
*
* @return void
*/
function subway_redirect_login()
{
// Only run this function when on wp-login.php
if (!in_array($GLOBALS['pagenow'], array('wp-login.php'))) {
return;
}
// Bypass login if specified.
$no_redirect = filter_input(INPUT_GET, 'no_redirect', FILTER_VALIDATE_BOOLEAN);
// Bypass wp-login.php?action=*
$has_action = filter_input(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
// Has errors?
$has_error = filter_input(INPUT_GET, 'error', FILTER_SANITIZE_STRING);
// Error Types
$has_type = filter_input(INPUT_GET, 'type', FILTER_SANITIZE_STRING);
// Set the default to our login page
$redirect_page = subway_get_redirect_page_url();
if ($has_error && $has_type) {
$redirect_to = add_query_arg(array('login' => 'failed', 'type' => $has_type), $redirect_page);
wp_safe_redirect(esc_url_raw($redirect_to));
die;
}
// Bypass wp-login.php?action=* link.
if ($has_action) {
return;
}
if ($no_redirect) {
return;
}
// Check if buddypress activate page.
if (function_exists('bp_is_activation_page')) {
if (bp_is_activation_page()) {
return;
}
}
// Check if buddypress registration page.
if (function_exists('bp_is_register_page')) {
if (bp_is_register_page()) {
return;
}
}
// Store for checking if this page equals wp-login.php.
$curr_paged = basename($_SERVER['REQUEST_URI']);
if (empty($redirect_page)) {
return;
}
// if user visits wp-admin or wp-login.php, redirect them
if (strstr($curr_paged, 'wp-login.php')) {
if (isset($_GET['interim-login'])) {
return;
}
// check if there is an action present
// action might represent user trying to log out
if (isset($_GET['action'])) {
$action = $_GET['action'];
if ('logout' === $action) {
return;
}
}
// Only redirect if there are no incoming post data.
if (empty($_POST)) {
wp_safe_redirect($redirect_page);
}
// Redirect to error page if user left username and password blank
if (!empty($_POST)) {
if (empty($_POST['log']) && empty($_POST['pwd'])) {
$redirect_to = add_query_arg(array('login' => 'failed', 'type' => '__blank'), $redirect_page);
wp_safe_redirect(esc_url_raw($redirect_to));
} elseif (empty($_POST['log']) && !empty($_POST['pwd']) && !empty($_POST['redirect_to'])) {
// Username empty
$redirect_to = add_query_arg(array('login' => 'failed', 'type' => '__userempty'), $redirect_page);
wp_safe_redirect(esc_url_raw($redirect_to));
} elseif (!empty($_POST['log']) && empty($_POST['pwd']) && !empty($_POST['redirect_to'])) {
// Password empty
$redirect_to = add_query_arg(array('login' => 'failed', 'type' => '__passempty'), $redirect_page);
wp_safe_redirect(esc_url_raw($redirect_to));
} else {
wp_safe_redirect($redirect_page);
}
}
}
return;
}
示例9: bp_modify_page_title
/**
* Filter the page title for BuddyPress pages.
*
* @since 1.5.0
*
* @see wp_title()
* @global object $bp BuddyPress global settings.
*
* @param string $title Original page title.
* @param string $sep How to separate the various items within the page title.
* @param string $seplocation Direction to display title.
* @return string New page title.
*/
function bp_modify_page_title($title = '', $sep = '»', $seplocation = 'right')
{
global $bp, $paged, $page, $_wp_theme_features;
// If this is not a BP page, just return the title produced by WP.
if (bp_is_blog_page()) {
return $title;
}
// If this is a 404, let WordPress handle it.
if (is_404()) {
return $title;
}
// If this is the front page of the site, return WP's title.
if (is_front_page() || is_home()) {
return $title;
}
// Return WP's title if not a BuddyPress page.
if (!is_buddypress()) {
return $title;
}
// Setup an empty title parts array.
$title_parts = array();
// Is there a displayed user, and do they have a name?
$displayed_user_name = bp_get_displayed_user_fullname();
// Displayed user.
if (!empty($displayed_user_name) && !is_404()) {
// Get the component's ID to try and get its name.
$component_id = $component_name = bp_current_component();
// Set empty subnav name.
$component_subnav_name = '';
// Use the component nav name.
if (!empty($bp->bp_nav[$component_id])) {
$component_name = _bp_strip_spans_from_title($bp->bp_nav[$component_id]['name']);
// Fall back on the component ID.
} elseif (!empty($bp->{$component_id}->id)) {
$component_name = ucwords($bp->{$component_id}->id);
}
// Append action name if we're on a member component sub-page.
if (!empty($bp->bp_options_nav[$component_id]) && !empty($bp->canonical_stack['action'])) {
$component_subnav_name = wp_filter_object_list($bp->bp_options_nav[$component_id], array('slug' => bp_current_action()), 'and', 'name');
if (!empty($component_subnav_name)) {
$component_subnav_name = array_shift($component_subnav_name);
}
}
// If on the user profile's landing page, just use the fullname.
if (bp_is_current_component($bp->default_component) && bp_get_requested_url() === bp_displayed_user_domain()) {
$title_parts[] = $displayed_user_name;
// Use component name on member pages.
} else {
$title_parts = array_merge($title_parts, array_map('strip_tags', array($displayed_user_name, $component_name)));
// If we have a subnav name, add it separately for localization.
if (!empty($component_subnav_name)) {
$title_parts[] = strip_tags($component_subnav_name);
}
}
// A single group.
} elseif (bp_is_active('groups') && !empty($bp->groups->current_group) && !empty($bp->bp_options_nav[$bp->groups->current_group->slug])) {
$subnav = isset($bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name']) ? $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] : '';
$title_parts = array($bp->bp_options_title, $subnav);
// A single item from a component other than groups.
} elseif (bp_is_single_item()) {
$title_parts = array($bp->bp_options_title, $bp->bp_options_nav[bp_current_item()][bp_current_action()]['name']);
// An index or directory.
} elseif (bp_is_directory()) {
$current_component = bp_current_component();
// No current component (when does this happen?).
$title_parts = array(_x('Directory', 'component directory title', 'buddypress'));
if (!empty($current_component)) {
$title_parts = array(bp_get_directory_title($current_component));
}
// Sign up page.
} elseif (bp_is_register_page()) {
$title_parts = array(__('Create an Account', 'buddypress'));
// Activation page.
} elseif (bp_is_activation_page()) {
$title_parts = array(__('Activate Your Account', 'buddypress'));
// Group creation page.
} elseif (bp_is_group_create()) {
$title_parts = array(__('Create a Group', 'buddypress'));
// Blog creation page.
} elseif (bp_is_create_blog()) {
$title_parts = array(__('Create a Site', 'buddypress'));
}
// Strip spans.
$title_parts = array_map('_bp_strip_spans_from_title', $title_parts);
// Sep on right, so reverse the order.
if ('right' == $seplocation) {
$title_parts = array_reverse($title_parts);
//.........这里部分代码省略.........
示例10: is_register_page
/**
* is_register_page determines if current page is a registration page
* @return boolean true is registration page false is login page
*/
public static function is_register_page()
{
global $pagenow, $loginRadiusSettings, $loginRadiusLoginIsBpActive;
$location = LR_Common::get_protocol() . $_SERVER['HTTP_HOST'] . remove_query_arg(array('lrlinked', 'loginradius_linking', 'loginradius_post', 'loginradius_invite', 'loginRadiusMappingProvider', 'loginRadiusMap', 'loginRadiusMain'));
if ($loginRadiusLoginIsBpActive) {
if (bp_is_register_page() || bp_is_activation_page()) {
return true;
}
} else {
if (wp_registration_url() == $location || 'wp-signup.php' == $pagenow || 'register.php' == $pagenow) {
return true;
}
}
return false;
}
示例11: bp_modify_page_title
//.........这里部分代码省略.........
}
$title = '';
// Displayed user
if ( bp_get_displayed_user_fullname() && ! is_404() ) {
// Get the component's ID to try and get its name
$component_id = $component_name = bp_current_component();
// Use the component nav name
if ( ! empty( $bp->bp_nav[$component_id] ) ) {
// Remove counts that are added by the nav item
$span = strpos( $bp->bp_nav[ $component_id ]['name'], '<span' );
if ( false !== $span ) {
$component_name = substr( $bp->bp_nav[ $component_id ]['name'], 0, $span - 1 );
} else {
$component_name = $bp->bp_nav[ $component_id ]['name'];
}
// Fall back on the component ID
} elseif ( ! empty( $bp->{$component_id}->id ) ) {
$component_name = ucwords( $bp->{$component_id}->id );
}
// Append action name if we're on a member component sub-page
if ( ! empty( $bp->bp_options_nav[ $component_id ] ) && ! empty( $bp->canonical_stack['action'] ) ) {
$component_subnav_name = wp_filter_object_list( $bp->bp_options_nav[ $component_id ], array( 'slug' => bp_current_action() ), 'and', 'name' );
if ( $component_subnav_name ) {
$component_subnav_name = array_shift( $component_subnav_name );
} else {
$component_subnav_name = '';
}
} else {
$component_subnav_name = '';
}
// If on the user profile's landing page, just use the fullname
if ( bp_is_current_component( $bp->default_component ) && bp_get_requested_url() === bp_displayed_user_domain() ) {
$title = bp_get_displayed_user_fullname();
// Use component name on member pages
} else {
// If we have a subnav name, add it separately for localization
if ( ! empty( $component_subnav_name ) ) {
// translators: construct the page title. 1 = user name, 2 = component name, 3 = separator, 4 = component subnav name
$title = strip_tags( sprintf( __( '%1$s %3$s %2$s %3$s %4$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep, $component_subnav_name ) );
} else {
// translators: construct the page title. 1 = user name, 2 = component name, 3 = separator
$title = strip_tags( sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep ) );
}
}
// A single group
} elseif ( bp_is_active( 'groups' ) && ! empty( $bp->groups->current_group ) && ! empty( $bp->bp_options_nav[ $bp->groups->current_group->slug ] ) ) {
$subnav = isset( $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] ) ? $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] : '';
// translators: 1 = group name, 2 = group nav section name, 3 = separator
$title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $subnav, $sep );
// A single item from a component other than groups
} elseif ( bp_is_single_item() ) {
// translators: 1 = component item name, 2 = component nav section name, 3 = separator
$title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[ bp_current_item() ][ bp_current_action() ]['name'], $sep );
// An index or directory
} elseif ( bp_is_directory() ) {
$current_component = bp_current_component();
// No current component (when does this happen?)
if ( empty( $current_component ) ) {
$title = _x( 'Directory', 'component directory title', 'buddypress' );
} else {
$title = bp_get_directory_title( $current_component );
}
// Sign up page
} elseif ( bp_is_register_page() ) {
$title = __( 'Create an Account', 'buddypress' );
// Activation page
} elseif ( bp_is_activation_page() ) {
$title = __( 'Activate your Account', 'buddypress' );
// Group creation page
} elseif ( bp_is_group_create() ) {
$title = __( 'Create a Group', 'buddypress' );
// Blog creation page
} elseif ( bp_is_create_blog() ) {
$title = __( 'Create a Site', 'buddypress' );
}
// Some BP nav items contain item counts. Remove them
$title = preg_replace( '|<span>[0-9]+</span>|', '', $title );
return apply_filters( 'bp_modify_page_title', $title . ' ' . $sep . ' ', $title, $sep, $seplocation );
}
示例12: bp_get_the_body_class
//.........这里部分代码省略.........
}
if (bp_is_user_recent_commments()) {
$bp_classes[] = 'recent-comments';
}
if (bp_is_user_recent_posts()) {
$bp_classes[] = 'recent-posts';
}
if (bp_is_user_change_avatar()) {
$bp_classes[] = 'change-avatar';
}
if (bp_is_user_profile_edit()) {
$bp_classes[] = 'profile-edit';
}
if (bp_is_user_friends_activity()) {
$bp_classes[] = 'friends-activity';
}
if (bp_is_user_groups_activity()) {
$bp_classes[] = 'groups-activity';
}
if (is_user_logged_in()) {
$bp_classes[] = 'logged-in';
}
/** Messages **********************************************************/
if (bp_is_messages_inbox()) {
$bp_classes[] = 'inbox';
}
if (bp_is_messages_sentbox()) {
$bp_classes[] = 'sentbox';
}
if (bp_is_messages_compose_screen()) {
$bp_classes[] = 'compose';
}
if (bp_is_notices()) {
$bp_classes[] = 'notices';
}
if (bp_is_user_friend_requests()) {
$bp_classes[] = 'friend-requests';
}
if (bp_is_create_blog()) {
$bp_classes[] = 'create-blog';
}
/** Groups ************************************************************/
if (bp_is_group_leave()) {
$bp_classes[] = 'leave-group';
}
if (bp_is_group_invites()) {
$bp_classes[] = 'group-invites';
}
if (bp_is_group_members()) {
$bp_classes[] = 'group-members';
}
if (bp_is_group_forum_topic()) {
$bp_classes[] = 'group-forum-topic';
}
if (bp_is_group_forum_topic_edit()) {
$bp_classes[] = 'group-forum-topic-edit';
}
if (bp_is_group_forum()) {
$bp_classes[] = 'group-forum';
}
if (bp_is_group_admin_page()) {
$bp_classes[] = 'group-admin';
}
if (bp_is_group_create()) {
$bp_classes[] = 'group-create';
}
if (bp_is_group_home()) {
$bp_classes[] = 'group-home';
}
if (bp_is_single_activity()) {
$bp_classes[] = 'activity-permalink';
}
/** Registration ******************************************************/
if (bp_is_register_page()) {
$bp_classes[] = 'registration';
}
if (bp_is_activation_page()) {
$bp_classes[] = 'activation';
}
/** Current Component & Action ****************************************/
if (!bp_is_blog_page()) {
$bp_classes[] = bp_current_component();
$bp_classes[] = bp_current_action();
}
/** Clean up***********************************************************/
// We don't want NXTClass blog classes to appear on non-blog pages.
if (!bp_is_blog_page()) {
// Preserve any custom classes already set
if (!empty($custom_classes)) {
$nxt_classes = (array) $custom_classes;
} else {
$nxt_classes = array();
}
}
// Merge nxt classes with BP classes
$classes = array_merge((array) $bp_classes, (array) $nxt_classes);
// Remove any duplicates
$classes = array_unique($classes);
return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $nxt_classes, $custom_classes);
}
示例13: configure_user_registration
/**
* Configures all new Users.
*
* The Hook `user_register` is also fired by calling:
* ``c_ws_plugin__s2member_registrations::ms_create_existing_user()`` and/or ``wpmu_create_user()``.
*
* This function also receives hand-offs from s2Member's handlers for these two Hooks:
* `wpmu_activate_user` and `wpmu_activate_blog`.
*
* @package s2Member\Registrations
* @since 3.5
*
* @attaches-to ``add_action('user_register');``
*
* @param int|string $user_id A numeric WordPress User ID.
* @param string $password Optional in most cases. A User's plain text Password. If unspecified, attempts are made to collect the plain text Password from other sources.
* @param array $meta Optional in most cases. Defaults to false. An array of meta data for a User/Member.
*
* @TODO Impossible to delete cookies when fired inside: `/wp-activate.php`?
*/
public static function configure_user_registration($user_id = '', $password = '', $meta = array())
{
global $wpdb;
// Global database object reference.
global $pagenow;
// We need this to detect the current administration page.
global $current_site, $current_blog;
// Adds support for Multisite Networking.
static $email_config, $processed;
// Static vars prevent duplicate processing.
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_configure_user_registration', get_defined_vars());
unset($__refs, $__v);
// Housekeeping.
// With Multisite Networking, we need this to run on `user_register` ahead of `wpmu_activate_[user|blog]`.
if (!isset($email_config) && ($email_config = TRUE)) {
// Anytime this routine is fired; we configure email.
c_ws_plugin__s2member_email_configs::email_config();
}
// Configures `From:` email header.
$_p = isset($_POST) ? $_POST : NULL;
// Grab global ``$_POST`` array here, if it's possible to do so.
$rvs = isset($GLOBALS['ws_plugin__s2member_registration_vars']) ? $GLOBALS['ws_plugin__s2member_registration_vars'] : NULL;
if (!$processed) {
if (is_array($_p) || is_array($meta) || is_array($rvs)) {
if (!(is_multisite() && is_blog_admin() && $pagenow === 'user-new.php' && isset($_p['noconfirmation']) && is_super_admin() && !is_array($meta))) {
if (!(preg_match('/\\/wp-activate\\.php/', $_SERVER['REQUEST_URI']) && !is_array($meta))) {
if (!(c_ws_plugin__s2member_utils_conds::bp_is_installed() && bp_is_activation_page() && !is_array($meta))) {
if (!(c_ws_plugin__s2member_utils_conds::pro_is_installed() && c_ws_plugin__s2member_pro_remote_ops::is_remote_op('create_user') && !is_array($rvs))) {
if ($user_id && is_object($user = new WP_User($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && ($processed = TRUE)) {
settype($_p, 'array') . settype($meta, 'array') . settype($rvs, 'array');
// Force arrays here.
$_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_p));
$meta = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($meta));
$rvs = c_ws_plugin__s2member_utils_strings::trim_deep($rvs);
foreach ($_p as $_key => $_value) {
// Scan ``$_p`` vars; adding `custom_reg_field` keys.
if (preg_match('/^ws_plugin__s2member_user_new_/', $_key)) {
// Look for keys.
if ($_key = str_replace('_user_new_', '_custom_reg_field_', $_key)) {
$_p[$_key] = $_value;
}
}
}
// Add each of these key conversions.
unset($_key, $_value);
if (!is_admin() && (isset($_p['ws_plugin__s2member_custom_reg_field_s2member_subscr_gateway']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_subscr_id']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_subscr_baid']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_subscr_cid']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_custom']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_ccaps']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time']) || isset($_p['ws_plugin__s2member_custom_reg_field_s2member_notes']))) {
exit(_x('s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!', 's2member-front', 's2member'));
}
$_pmr = array_merge($_p, $meta, $rvs);
// Merge all of these arrays together now, in this specific order.
unset($_p, $meta, $rvs);
// These variables can all be unset now; we have them all in the ``$_pmr`` array.
$custom_reg_display_name = $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_display_name'];
// Can be configured by the site owner.
if (!is_admin() && (!c_ws_plugin__s2member_utils_conds::pro_is_installed() || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op('create_user')) && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies)) {
/* This routine could be processed through `/wp-login.php?action=register`, `/wp-activate.php`, or `/activate` via BuddyPress`.
This may also be processed through a standard BuddyPress installation, or another plugin calling `user_register`.
If processed through `/wp-activate.php`, it could've originated inside the admin—via `/user-new.php`. */
/**
* @var $subscr_gateway string Reference for IDEs.
* @var $subscr_id string Reference for IDEs.
* @var $custom string Reference for IDEs.
* @var $item_number string Reference for IDEs.
*/
$processed = 'yes';
// Mark this as yes.
$current_role = c_ws_plugin__s2member_user_access::user_access_role($user);
@(list($level, $ccaps, $eotper) = preg_split('/\\:/', $item_number, 3));
$role = 's2member_level' . $level;
// Membership Level.
$email = $user->user_email;
$login = $user->user_login;
$ip = (string) @$_pmr['ws_plugin__s2member_custom_reg_field_s2member_registration_ip'];
$ip = !$ip ? $_SERVER['REMOTE_ADDR'] : $ip;
// Else use environment variable.
$subscr_baid = (string) @$_pmr['ws_plugin__s2member_custom_reg_field_s2member_subscr_baid'];
$subscr_cid = (string) @$_pmr['ws_plugin__s2member_custom_reg_field_s2member_subscr_cid'];
//.........这里部分代码省略.........
示例14: bp_get_the_body_class
//.........这里部分代码省略.........
if (bp_is_user_profile()) {
$bp_classes[] = 'my-profile';
}
if (bp_is_user_friends()) {
$bp_classes[] = 'my-friends';
}
if (bp_is_user_messages()) {
$bp_classes[] = 'my-messages';
}
if (bp_is_user_recent_commments()) {
$bp_classes[] = 'recent-comments';
}
if (bp_is_user_recent_posts()) {
$bp_classes[] = 'recent-posts';
}
if (bp_is_user_change_avatar()) {
$bp_classes[] = 'change-avatar';
}
if (bp_is_user_profile_edit()) {
$bp_classes[] = 'profile-edit';
}
if (bp_is_user_friends_activity()) {
$bp_classes[] = 'friends-activity';
}
if (bp_is_user_groups_activity()) {
$bp_classes[] = 'groups-activity';
}
/** Messages **********************************************************/
if (bp_is_messages_inbox()) {
$bp_classes[] = 'inbox';
}
if (bp_is_messages_sentbox()) {
$bp_classes[] = 'sentbox';
}
if (bp_is_messages_compose_screen()) {
$bp_classes[] = 'compose';
}
if (bp_is_notices()) {
$bp_classes[] = 'notices';
}
if (bp_is_user_friend_requests()) {
$bp_classes[] = 'friend-requests';
}
if (bp_is_create_blog()) {
$bp_classes[] = 'create-blog';
}
/** Groups ************************************************************/
if (bp_is_group_leave()) {
$bp_classes[] = 'leave-group';
}
if (bp_is_group_invites()) {
$bp_classes[] = 'group-invites';
}
if (bp_is_group_members()) {
$bp_classes[] = 'group-members';
}
if (bp_is_group_forum_topic()) {
$bp_classes[] = 'group-forum-topic';
}
if (bp_is_group_forum_topic_edit()) {
$bp_classes[] = 'group-forum-topic-edit';
}
if (bp_is_group_forum()) {
$bp_classes[] = 'group-forum';
}
if (bp_is_group_admin_page()) {
$bp_classes[] = 'group-admin';
$bp_classes[] = bp_get_group_current_admin_tab();
}
if (bp_is_group_create()) {
$bp_classes[] = 'group-create';
$bp_classes[] = bp_get_groups_current_create_step();
}
if (bp_is_group_home()) {
$bp_classes[] = 'group-home';
}
if (bp_is_single_activity()) {
$bp_classes[] = 'activity-permalink';
}
/** Registration ******************************************************/
if (bp_is_register_page()) {
$bp_classes[] = 'registration';
}
if (bp_is_activation_page()) {
$bp_classes[] = 'activation';
}
/** Current Component & Action ****************************************/
if (!bp_is_blog_page()) {
$bp_classes[] = bp_current_component();
$bp_classes[] = bp_current_action();
}
/** Clean up ***********************************************************/
// Add BuddyPress class if we are within a BuddyPress page
if (!bp_is_blog_page()) {
$bp_classes[] = 'buddypress';
}
// Merge WP classes with BuddyPress classes and remove any duplicates
$classes = array_unique(array_merge((array) $bp_classes, (array) $wp_classes));
return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes);
}
示例15: bp_modify_page_title
/**
* Filter the page title for BuddyPress pages
*
* @global object $bp BuddyPress global settings
* @param string $title Original page title
* @param string $sep How to separate the various items within the page title.
* @param string $seplocation Direction to display title
* @return string new page title
* @see wp_title()
* @since BuddyPress (1.5)
*/
function bp_modify_page_title($title, $sep, $seplocation)
{
global $bp;
// If this is not a BP page, just return the title produced by WP
if (bp_is_blog_page()) {
return $title;
}
// If this is the front page of the site, return WP's title
if (is_front_page() || is_home()) {
return $title;
}
$title = '';
// Displayed user
if (bp_get_displayed_user_fullname() && !is_404()) {
// Get the component's ID to try and get it's name
$component_id = $component_name = bp_current_component();
// Use the actual component name
if (!empty($bp->{$component_id}->name)) {
$component_name = $bp->{$component_id}->name;
// Fall back on the component ID (probably same as current_component)
} elseif (!empty($bp->{$component_id}->id)) {
$component_name = $bp->{$component_id}->id;
}
// translators: "displayed user's name | canonicalised component name"
$title = strip_tags(sprintf(__('%1$s | %2$s', 'buddypress'), bp_get_displayed_user_fullname(), ucwords($component_name)));
// A single group
} elseif (bp_is_active('groups') && !empty($bp->groups->current_group) && !empty($bp->bp_options_nav[$bp->groups->current_group->slug])) {
$subnav = isset($bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name']) ? $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] : '';
// translators: "group name | group nav section name"
$title = sprintf(__('%1$s | %2$s', 'buddypress'), $bp->bp_options_title, $subnav);
// A single item from a component other than groups
} elseif (bp_is_single_item()) {
// translators: "component item name | component nav section name | root component name"
$title = sprintf(__('%1$s | %2$s | %3$s', 'buddypress'), $bp->bp_options_title, $bp->bp_options_nav[bp_current_item()][bp_current_action()]['name'], bp_get_name_from_root_slug(bp_get_root_slug()));
// An index or directory
} elseif (bp_is_directory()) {
if (!bp_current_component()) {
$title = sprintf(__('%s Directory', 'buddypress'), bp_get_name_from_root_slug());
} else {
$title = sprintf(__('%s Directory', 'buddypress'), bp_get_name_from_root_slug());
}
// Sign up page
} elseif (bp_is_register_page()) {
$title = __('Create an Account', 'buddypress');
// Activation page
} elseif (bp_is_activation_page()) {
$title = __('Activate your Account', 'buddypress');
// Group creation page
} elseif (bp_is_group_create()) {
$title = __('Create a Group', 'buddypress');
// Blog creation page
} elseif (bp_is_create_blog()) {
$title = __('Create a Site', 'buddypress');
}
// Some BP nav items contain item counts. Remove them
$title = preg_replace('|<span>[0-9]+</span>|', '', $title);
return apply_filters('bp_modify_page_title', $title . ' ' . $sep . ' ', $title, $sep, $seplocation);
}