public static function modify_signup_blog_notification_message($message, $domain, $path, $title, $user, $user_email, $key) { $signup = GFSignup::get($key); // if no signup or config is set for manual activation, return false preventing signup notification from being sent to user if (is_wp_error($signup) || $signup->get_activation_type() == 'manual') { return false; } $url = add_query_arg(array('page' => 'gf_activation', 'key' => $key), get_site_url()); // BP replaces URL before passing the message, get the BP activation URL and replace if (GFUser::is_bp_active()) { $activate_url = esc_url(bp_get_activation_page() . "?key={$key}"); $message = str_replace($activate_url, '%s', $message); } return sprintf($message, $url, esc_url("http://{$domain}{$path}"), $key); }
/** * Output the URL of the activation page. */ function bp_activation_page() { echo esc_url(bp_get_activation_page()); }
/** * Notify new users of a successful registration (without blog). * * @see wpmu_signup_user_notification() for a full description of params. * * @param string $user The user's login name. * @param string $user_email The user's email address. * @param string $key The activation key created in wpmu_signup_user() * @param array $meta By default, an empty array. * * @return bool|string True on success, false on failure. */ function bp_core_activation_signup_user_notification($user, $user_email, $key, $meta) { if (is_admin()) { // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications if (in_array(get_current_screen()->id, array('user', 'user-network'))) { // If the Super Admin want to skip confirmation email if (isset($_POST['noconfirmation']) && is_super_admin()) { return false; // WordPress will manage the signup process } else { return $user; } /** * There can be a case where the user was created without the skip confirmation * And the super admin goes in pending accounts to resend it. In this case, as the * meta['password'] is not set, the activation url must be WordPress one */ } elseif (buddypress()->members->admin->signups_page == get_current_screen()->id) { $is_hashpass_in_meta = maybe_unserialize($meta); if (empty($is_hashpass_in_meta['password'])) { return $user; } } } // Set up activation link $activate_url = bp_get_activation_page() . "?key={$key}"; $activate_url = esc_url($activate_url); // Email contents $message = sprintf(__("Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress'), $activate_url); $subject = bp_get_email_subject(array('text' => __('Activate Your Account', 'buddypress'))); /** * Filters the email that the notification is going to upon successful registration without blog. * * @since 1.2.0 * * @param string $user_email The user's email address. * @param string $user The user's login name. * @param string $user_email The user's email address. * @param string $key The activation key created in wpmu_signup_blog(). * @param array $meta Array of meta values for the created site. */ $to = apply_filters('bp_core_activation_signup_user_notification_to', $user_email, $user, $user_email, $key, $meta); /** * Filters the subject that the notification uses upon successful registration without blog. * * @since 1.2.0 * * @param string $subject The subject to use. * @param string $user The user's login name. * @param string $user_email The user's email address. * @param string $key The activation key created in wpmu_signup_blog(). * @param array $meta Array of meta values for the created site. */ $subject = apply_filters('bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta); /** * Filters the message that the notification uses upon successful registration without blog. * * @since 1.2.0 * * @param string $message The message to use. * @param string $user The user's login name. * @param string $user_email The user's email address. * @param string $key The activation key created in wpmu_signup_blog(). * @param array $meta Array of meta values for the created site. */ $message = apply_filters('bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta); // Send the email wp_mail($to, $subject, $message); // Set up the $admin_email to pass to the filter $admin_email = bp_get_option('admin_email'); /** * Fires after the sending of the notification to new users for successful registration without blog. * * @since 1.5.0 * * @param string $admin_email Admin Email address for the site. * @param string $subject Subject used in the notification email. * @param string $message Message used in the notification email. * @param string $user The user's login name. * @param string $user_email The user's email address. * @param string $key The activation key created in wpmu_signup_blog(). * @param array $meta Array of meta values for the created site. Default empty array. */ do_action('bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta); // Return false to stop the original WPMU function from continuing return false; }
function bp_core_signup_send_validation_email($user_id, $user_email, $key) { $activate_url = bp_get_activation_page() . "?key={$key}"; $activate_url = esc_url($activate_url); $from_name = '' == get_option('blogname') ? __('BuddyPress', 'buddypress') : esc_html(get_option('blogname')); $message = sprintf(__("Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress'), $activate_url); $subject = '[' . $from_name . '] ' . __('Activate Your Account', 'buddypress'); // Send the message $to = apply_filters('bp_core_signup_send_validation_email_to', $user_email, $user_id); $subject = apply_filters('bp_core_signup_send_validation_email_subject', $subject, $user_id); $message = apply_filters('bp_core_signup_send_validation_email_message', $message, $user_id, $activate_url); wp_mail($to, $subject, $message); do_action('bp_core_sent_user_validation_email', $subject, $message, $user_id, $user_email, $key); }
function bp_activation_page() { echo bp_get_activation_page(); }
function bp_core_activation_signup_user_notification($user, $user_email, $key, $meta) { $activate_url = bp_get_activation_page() . "?key={$key}"; $activate_url = esc_url($activate_url); $admin_email = get_site_option('admin_email'); if (empty($admin_email)) { $admin_email = 'support@' . $_SERVER['SERVER_NAME']; } // If this is an admin generated activation, add a param to email the // user login details $email = is_admin() ? '&e=1' : ''; $from_name = '' == get_site_option('site_name') ? 'WordPress' : esc_html(get_site_option('site_name')); $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; $message = sprintf(__("Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress'), $activate_url . $email); $subject = '[' . $from_name . '] ' . __('Activate Your Account', 'buddypress'); // Send the message $to = apply_filters('bp_core_activation_signup_user_notification_to', $user_email, $user, $user_email, $key, $meta); $subject = apply_filters('bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta); $message = apply_filters('bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta); wp_mail($to, $subject, $message, $message_headers); do_action('bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta); // Return false to stop the original WPMU function from continuing return false; }
function x_buddypress_navbar_menu($items, $args) { if (X_BUDDYPRESS_IS_ACTIVE && x_get_option('x_buddypress_header_menu_enable', '') == '1') { $top_level_link = is_user_logged_in() ? bp_loggedin_user_domain() : bp_get_activity_directory_permalink(); $submenu_items = ''; if (bp_is_active('activity')) { $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activity_directory_permalink() . '" class="cf"><i class="x-icon-thumbs-up" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_activity_title', __('Activity', '__x__')) . '</span></a></li>'; } if (bp_is_active('groups')) { $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_groups_directory_permalink() . '" class="cf"><i class="x-icon-sitemap" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_groups_title', __('Groups', '__x__')) . '</span></a></li>'; } if (is_multisite() && bp_is_active('blogs')) { $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_blogs_directory_permalink() . '" class="cf"><i class="x-icon-file" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_blogs_title', __('Blogs', '__x__')) . '</span></a></li>'; } $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_members_directory_permalink() . '" class="cf"><i class="x-icon-male" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_members_title', __('Members', '__x__')) . '</span></a></li>'; if (!is_user_logged_in()) { if (bp_get_signup_allowed()) { $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_signup_page() . '" class="cf"><i class="x-icon-pencil" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_register_title', __('Create an Account', '__x__')) . '</span></a></li>'; $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activation_page() . '" class="cf"><i class="x-icon-key" data-x-icon=""></i> <span>' . x_get_option('x_buddypress_activate_title', __('Activate Your Account', '__x__')) . '</span></a></li>'; } $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . wp_login_url() . '" class="cf"><i class="x-icon-sign-in" data-x-icon=""></i> <span>' . __('Log in', '__x__') . '</span></a></li>'; } else { $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_loggedin_user_domain() . '" class="cf"><i class="x-icon-cog" data-x-icon=""></i> <span>' . __('Profile', '__x__') . '</span></a></li>'; } if ($args->theme_location == 'primary') { $items .= '<li class="menu-item current-menu-parent menu-item-has-children x-menu-item x-menu-item-buddypress">' . '<a href="' . $top_level_link . '" class="x-btn-navbar-buddypress">' . '<span><i class="x-icon-user" data-x-icon=""></i><span class="x-hidden-desktop"> ' . __('Social', '__x__') . '</span></span>' . '</a>' . '<ul class="sub-menu">' . $submenu_items . '</ul>' . '</li>'; } } return $items; }
/** * Builds a BuddyPress URL to: `/activate`. * * @param string $scheme Optional. To force a specific scheme (i.e. `//`, `http`, `https`). * * @return string BuddyPress URL to: `/activate`, if BuddyPress is installed; else an empty string. * * @throws exception If invalid types are passed through arguments list. */ public function to_bp_activate($scheme = '') { $this->check_arg_types('string', func_get_args()); if ($this->©env->has_bp_active() && function_exists('bp_get_activation_page')) { $url = bp_get_activation_page(); } else { $url = ''; } // Not applicable. return $url && $scheme ? $this->set_scheme($url, $scheme) : $url; }
/** * Send activation email to a newly registered user. * * @param int $user_id ID of the new user. * @param string $user_email Email address of the new user. * @param string $key Activation key. */ function bp_core_signup_send_validation_email($user_id, $user_email, $key) { $activate_url = trailingslashit(bp_get_activation_page()) . "{$key}/"; $activate_url = esc_url($activate_url); $message = sprintf(__("Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress'), $activate_url); $subject = bp_get_email_subject(array('text' => __('Activate Your Account', 'buddypress'))); /** * Filters the user email that the validation email will be sent to. * * @since BuddyPress (1.5.0) * * @param string $user_email User email the notification is being sent to. * @param int $user_id ID of the new user receiving email. */ $to = apply_filters('bp_core_signup_send_validation_email_to', $user_email, $user_id); /** * Filters the validation email subject that will be sent to user. * * @since BuddyPress (1.5.0) * * @param string $subject Email validation subject text. * @param int $user_id ID of the new user receiving email. */ $subject = apply_filters('bp_core_signup_send_validation_email_subject', $subject, $user_id); /** * Filters the validation email message that will be sent to user. * * @since BuddyPress (1.5.0) * * @param string $message Email validation message text. * @param int $user_id ID of the new user receiving email. * @param string $activate_url URL to use for activating account. */ $message = apply_filters('bp_core_signup_send_validation_email_message', $message, $user_id, $activate_url); wp_mail($to, $subject, $message); /** * Fires after the sending of activation email to a newly registered user. * * @since BuddyPress (1.5.0) * * @param string $subject Subject for the sent email. * @param string $message Message for the sent email. * @param int $user_id ID of the new user. * @param string $user_email Email address of the new user. * @param string $key Activation key. */ do_action('bp_core_sent_user_validation_email', $subject, $message, $user_id, $user_email, $key); }
/** * Notify new users of a successful registration (without blog). * * @see wpmu_signup_user_notification() for a full description of params. * * @param string $user The user's login name. * @param string $user_email The user's email address. * @param string $key The activation key created in wpmu_signup_user() * @param array $meta By default, an empty array. * @return bool True on success, false on failure. */ function bp_core_activation_signup_user_notification($user, $user_email, $key, $meta) { // Set up activation link $activate_url = bp_get_activation_page() . "?key={$key}"; $activate_url = esc_url($activate_url); // Email contents $message = sprintf(__("Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress'), $activate_url); $subject = bp_get_email_subject(array('text' => __('Activate Your Account', 'buddypress'))); // Email filters $to = apply_filters('bp_core_activation_signup_user_notification_to', $user_email, $user, $user_email, $key, $meta); $subject = apply_filters('bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta); $message = apply_filters('bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta); // Send the email wp_mail($to, $subject, $message); // Set up the $admin_email to pass to the filter $admin_email = bp_get_option('admin_email'); do_action('bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta); // Return false to stop the original WPMU function from continuing return false; }
/** * Notify new users of a successful registration (without blog). * * @since 1.0.0 * * @see wpmu_signup_user_notification() for a full description of params. * * @param string $user The user's login name. * @param string $user_email The user's email address. * @param string $key The activation key created in wpmu_signup_user(). * @param array $meta By default, an empty array. * @return bool|string Returns false to stop original WPMU function from continuing. */ function bp_core_activation_signup_user_notification($user, $user_email, $key, $meta) { if (is_admin()) { // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications. if (in_array(get_current_screen()->id, array('user', 'user-network'))) { // If the Super Admin want to skip confirmation email. if (isset($_POST['noconfirmation']) && is_super_admin()) { return false; // WordPress will manage the signup process. } else { return $user; } /* * There can be a case where the user was created without the skip confirmation * And the super admin goes in pending accounts to resend it. In this case, as the * meta['password'] is not set, the activation url must be WordPress one. */ } elseif (buddypress()->members->admin->signups_page == get_current_screen()->id) { $is_hashpass_in_meta = maybe_unserialize($meta); if (empty($is_hashpass_in_meta['password'])) { return $user; } } } $user_id = 0; $user_object = get_user_by('login', $user); if ($user_object) { $user_id = $user_object->ID; } $args = array('tokens' => array('activate.url' => esc_url(trailingslashit(bp_get_activation_page()) . "{$key}/"), 'key' => $key, 'user.email' => $user_email, 'user.id' => $user_id)); bp_send_email('core-user-registration', array(array($user_email => $user)), $args); // Return false to stop the original WPMU function from continuing. return false; }
function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) { global $current_site; $activate_url = bp_get_activation_page() ."?key=$key"; $activate_url = esc_url($activate_url); $admin_email = get_site_option( "admin_email" ); if ( empty( $admin_email ) ) $admin_email = 'support@' . $_SERVER['SERVER_NAME']; /* If this is an admin generated activation, add a param to email the user login details */ if ( is_admin() ) $email = '&e=1'; $from_name = ( '' == get_site_option( "site_name" ) ) ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) ); $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"; $message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress' ), $activate_url . $email, esc_url( "http://{$domain}{$path}" ) ); $subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' ); /* Send the message */ $to = apply_filters( 'bp_core_activation_signup_user_notification_to', $user_email ); $subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject ); $message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message ); wp_mail( $to, $subject, $message, $message_headers ); // Return false to stop the original WPMU function from continuing return false; }
function bp_core_signup_send_validation_email( $user_id, $user_email, $key ) { $activate_url = bp_get_activation_page() ."?key=$key"; $activate_url = esc_url( $activate_url ); $admin_email = get_site_option( "admin_email" ); if ( empty( $admin_email ) ) $admin_email = 'noreply@' . $_SERVER['SERVER_NAME']; $from_name = ( '' == get_option( 'blogname' ) ) ? 'BuddyPress' : wp_specialchars( get_option( 'blogname' ) ); $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n"; $message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress' ), $activate_url ); $subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' ); /* Send the message */ $to = apply_filters( 'bp_core_activation_signup_user_notification_to', $user_email ); $subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject ); $message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message ); wp_mail( $to, $subject, $message, $message_headers ); }
/** * Notify new users of a successful registration (without blog). * * @see wpmu_signup_user_notification() for a full description of params. * * @param string $user The user's login name. * @param string $user_email The user's email address. * @param string $key The activation key created in wpmu_signup_user() * @param array $meta By default, an empty array. * @return bool True on success, false on failure. */ function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) { if ( is_admin() ) { // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications if( in_array( get_current_screen()->id, array( 'user', 'user-network' ) ) ) { // If the Super Admin want to skip confirmation email if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { return false; // WordPress will manage the signup process } else { return $user; } /** * There can be a case where the user was created without the skip confirmation * And the super admin goes in pending accounts to resend it. In this case, as the * meta['password'] is not set, the activation url must be WordPress one */ } elseif ( buddypress()->members->admin->signups_page == get_current_screen()->id ) { $is_hashpass_in_meta = maybe_unserialize( $meta ); if ( empty( $is_hashpass_in_meta['password'] ) ) { return $user; } } } // Set up activation link $activate_url = bp_get_activation_page() . "?key=$key"; $activate_url = esc_url( $activate_url ); // Email contents $message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress' ), $activate_url ); $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) ); // Email filters $to = apply_filters( 'bp_core_activation_signup_user_notification_to', $user_email, $user, $user_email, $key, $meta ); $subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta ); $message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta ); // Send the email wp_mail( $to, $subject, $message ); // Set up the $admin_email to pass to the filter $admin_email = bp_get_option( 'admin_email' ); do_action( 'bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta ); // Return false to stop the original WPMU function from continuing return false; }
function bp_core_signup_send_validation_email($user_id, $user_email, $key) { $activate_url = bp_get_activation_page() . "?key={$key}"; $activate_url = esc_url($activate_url); $message = sprintf(__("Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress'), $activate_url); $subject = bp_get_email_subject(array('text' => __('Activate Your Account', 'buddypress'))); // Send the message $to = apply_filters('bp_core_signup_send_validation_email_to', $user_email, $user_id); $subject = apply_filters('bp_core_signup_send_validation_email_subject', $subject, $user_id); $message = apply_filters('bp_core_signup_send_validation_email_message', $message, $user_id, $activate_url); wp_mail($to, $subject, $message); do_action('bp_core_sent_user_validation_email', $subject, $message, $user_id, $user_email, $key); }
/** * Send activation email to a newly registered user. * * @since 1.2.2 * @since 2.5.0 Add the $user_login parameter. * * @param int|bool $user_id ID of the new user, false if BP_SIGNUPS_SKIP_USER_CREATION is true. * @param string $user_email Email address of the new user. * @param string $key Activation key. * @param string $user_login Optional. The user login name. */ function bp_core_signup_send_validation_email($user_id, $user_email, $key, $user_login = '') { $args = array('tokens' => array('activate.url' => esc_url(trailingslashit(bp_get_activation_page()) . "{$key}/"), 'key' => $key, 'user.email' => $user_email, 'user.id' => $user_id)); if ($user_id) { $to = $user_id; } else { $to = array(array($user_email => $user_login)); } bp_send_email('core-user-registration', $to, $args); }
public static function modify_signup_blog_notification_message($message, $domain, $path, $title, $user, $user_email, $key) { // don't send activation email for manual activations if (self::is_manual_activation($key)) { return false; } $url = add_query_arg(array('page' => 'gf_activation', 'key' => $key), get_site_url()); // BP replaces URL before passing the message, get the BP activation URL and replace if (GFUser::is_bp_active()) { $activate_url = esc_url(bp_get_activation_page() . "?key={$key}"); $message = str_replace($activate_url, '%s', $message); } return sprintf($message, $url, esc_url("http://{$domain}{$path}"), $key); }