function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id) { $friend_name = bp_core_get_user_displayname($friend_id); if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) { return false; } $ud = get_userdata($initiator_id); $friend_link = bp_core_get_user_domain($friend_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = trailingslashit(bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications'); // Set up and send the message $to = $ud->user_email; $subject = bp_get_email_subject(array('text' => sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name))); $message = sprintf(__('%1$s accepted your friend request. To view %2$s\'s profile: %3$s --------------------- ', 'buddypress'), $friend_name, $friend_name, $friend_link); // Only show the disable notifications line if the settings component is enabled if (bp_is_active('settings')) { $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); } /* Send the message */ $to = apply_filters('friends_notification_accepted_request_to', $to); $subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name); $message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link); wp_mail($to, $subject, $message); do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id); }
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id) { global $bp; $friendship = new BP_Friends_Friendship($friendship_id, false, false); $friend_name = bp_core_get_user_displayname($friend_id); if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) { return false; } $ud = get_userdata($initiator_id); $friend_link = bp_core_get_user_domain($friend_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications'; // Set up and send the message $to = $ud->user_email; $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES); $subject = '[' . $sitename . '] ' . sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name); $message = sprintf(__('%1$s accepted your friend request. To view %2$s\'s profile: %3$s --------------------- ', 'buddypress'), $friend_name, $friend_name, $friend_link); $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); /* Send the message */ $to = apply_filters('friends_notification_accepted_request_to', $to); $subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name); $message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link); nxt_mail($to, $subject, $message); do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id); }
/** * Get user profile URL to add our Google Drive options. * * If BuddyPress is enabled and the BP Settings component is enabled, we'll * use the user settings URL. Otherwise, we'll use the admin dashboard * profile link from the main site. * * @return string */ function mexp_gdrive_get_user_profile_url() { if (function_exists('buddypress') && bp_is_active('settings')) { $url = trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug()); } else { $url = get_admin_url($GLOBALS['current_site']->blog_id, 'profile.php'); } return apply_filters('mexp_gdrive_get_user_profile_url', $url . '#gauth'); }
public function setup_settings_privacy_nav($wp_admin_nav) { // Setup the logged in user variables if (is_rtmedia_privacy_user_overide()) { $settings_link = trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug()); // Add the "Profile" subnav item $wp_admin_nav[] = array('parent' => 'my-account-' . buddypress()->settings->id, 'id' => 'my-account-' . buddypress()->settings->id . '-privacy', 'title' => _x('Privacy', 'My Account Privacy sub nav', 'rtmedia'), 'href' => trailingslashit($settings_link . 'privacy')); } return $wp_admin_nav; }
function messages_notification_new_message($args = array()) { // These should be extracted below $recipients = array(); $email_subject = $email_content = ''; extract($args); $sender_name = bp_core_get_user_displayname($sender_id); // Bail if no recipients if (!empty($recipients)) { foreach ($recipients as $recipient) { if ($sender_id == $recipient->user_id || 'no' == bp_get_user_meta($recipient->user_id, 'notification_messages_new_message', true)) { continue; } // User data and links $ud = get_userdata($recipient->user_id); // Bail if user cannot be found if (empty($ud)) { continue; } $message_link = bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/'; $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($recipient->user_id) . $settings_slug . '/notifications/'; // Sender info $sender_name = stripslashes($sender_name); $subject = stripslashes(wp_filter_kses($subject)); $content = stripslashes(wp_filter_kses($content)); // Set up and send the message $email_to = $ud->user_email; $email_subject = bp_get_email_subject(array('text' => sprintf(__('New message from %s', 'buddypress'), $sender_name))); $email_content = sprintf(__('%1$s sent you a new message: Subject: %2$s "%3$s" To view and read your messages please log in and visit: %4$s --------------------- ', 'buddypress'), $sender_name, $subject, $content, $message_link); // Only show the disable notifications line if the settings component is enabled if (bp_is_active('settings')) { $email_content .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); } // Send the message $email_to = apply_filters('messages_notification_new_message_to', $email_to); $email_subject = apply_filters('messages_notification_new_message_subject', $email_subject, $sender_name); $email_content = apply_filters('messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link); wp_mail($email_to, $email_subject, $email_content); } } do_action('bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args); }
function messages_notification_new_message($args = array()) { // These should be extracted below $recipients = array(); $email_subject = $email_content = ''; extract($args); $sender_name = bp_core_get_user_displayname($sender_id); // Bail if no recipients if (!empty($recipients)) { foreach ($recipients as $recipient) { if ($sender_id == $recipient->user_id || 'no' == bp_get_user_meta($recipient->user_id, 'notification_messages_new_message', true)) { continue; } // User data and links $ud = get_userdata($recipient->user_id); $message_link = bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/'; $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($recipient->user_id) . $settings_slug . '/notifications/'; // Sender info $sender_name = stripslashes($sender_name); $subject = stripslashes(wp_filter_kses($subject)); $content = stripslashes(wp_filter_kses($content)); // Set up and send the message $email_to = $ud->user_email; $sitename = wp_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES); $email_subject = '[' . $sitename . '] ' . sprintf(__('New message from %s', 'buddypress'), $sender_name); $email_content = sprintf(__('%1$s sent you a new message: Subject: %2$s "%3$s" To view and read your messages please log in and visit: %4$s --------------------- ', 'buddypress'), $sender_name, $subject, $content, $message_link); $email_content .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); // Send the message $email_to = apply_filters('messages_notification_new_message_to', $email_to); $email_subject = apply_filters('messages_notification_new_message_subject', $email_subject, $sender_name); $email_content = apply_filters('messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link); wp_mail($email_to, $email_subject, $email_content); } } do_action('bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args); }
/** * Add the 'pending email change' message to the settings page. * * @since BuddyPress (2.1.0) */ function bp_settings_pending_email_notice() { $pending_email = bp_get_user_meta(bp_displayed_user_id(), 'pending_email_change', true); if (empty($pending_email['newemail'])) { return; } if (bp_get_displayed_user_email() == $pending_email['newemail']) { return; } ?> <div id="message" class="bp-template-notice error"> <p><?php printf(__('There is a pending change of your email address to <code>%1$s</code>.<br />Check your email (<code>%2$s</code>) for the verification link. <a href="%3$s">Cancel</a>', 'buddypress'), $pending_email['newemail'], bp_get_displayed_user_email(), esc_url(bp_displayed_user_domain() . bp_get_settings_slug() . '/?dismiss_email_change=1')); ?> </p> </div> <?php }
/** * Sends the email notification to the user when an Achievement is unlocked. * * @global object $bp BuddyPress global settings * @global nxtdb $nxtdb NXTClass database object * @param int $achievement_id * @param int $user_id * @since 2.0 */ function dpa_achievement_unlocked_notification($achievement_id, $user_id) { global $achievements_template, $bp, $nxtdb; if ('no' == get_user_meta($user_id, 'notification_dpa_unlock_achievement', true)) { return; } $recipient = get_userdata($user_id); $settings_link = bp_core_get_user_domain($user_id) . bp_get_settings_slug() . '/notifications/'; $achievements_link = bp_core_get_user_domain($user_id) . DPA_SLUG . '/'; $email_subject = sprintf(__('[%1$s] Achievement unlocked: %2$s', 'dpa'), nxt_specialchars_decode(get_blog_option(BP_ROOT_BLOG, 'blogname'), ENT_QUOTES), dpa_get_achievement_name()); $email_content = sprintf(__(' You have unlocked an Achievement: %1$s To review this and see all of your Achievements, go to %2$s --------------------- To disable these notifications please log in and go to: %3$s', 'dpa'), dpa_get_achievement_name(), $achievements_link, $settings_link); // Send the message $email_to = apply_filters('dpa_unlock_achievement_notification_to', $recipient->user_email, $achievement_id); $email_subject = apply_filters('dpa_unlock_achievement_notification_subject', $email_subject, $achievement_id); $email_content = apply_filters('dpa_unlock_achievement_notification_message', $email_content, $achievement_id, $achievements_link, $settings_link); nxt_mail($email_to, $email_subject, $email_content); }
function groups_notification_group_invites(&$group, &$member, $inviter_user_id) { // @todo $inviter_up may be used for caching, test without it $inviter_ud = bp_core_get_core_userdata($inviter_user_id); $inviter_name = bp_core_get_userlink($inviter_user_id, true, false, true); $inviter_link = bp_core_get_user_domain($inviter_user_id); $group_link = bp_get_group_permalink($group); if (!$member->invite_sent) { $invited_user_id = $member->user_id; // Post a screen notification first. bp_core_add_notification($group->id, $invited_user_id, 'groups', 'group_invite'); if ('no' == bp_get_user_meta($invited_user_id, 'notification_groups_invite', true)) { return false; } $invited_ud = bp_core_get_core_userdata($invited_user_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($invited_user_id) . $settings_slug . '/notifications/'; $invited_link = bp_core_get_user_domain($invited_user_id); $invites_link = trailingslashit($invited_link . bp_get_groups_slug() . '/invites'); // Set up and send the message $to = $invited_ud->user_email; $subject = bp_get_email_subject(array('text' => sprintf(__('You have an invitation to the group: "%s"', 'buddypress'), $group->name))); $message = sprintf(__('One of your friends %1$s has invited you to the group: "%2$s". To view your group invites visit: %3$s To view the group visit: %4$s To view %5$s\'s profile visit: %6$s --------------------- ', 'buddypress'), $inviter_name, $group->name, $invites_link, $group_link, $inviter_name, $inviter_link); // Only show the disable notifications line if the settings component is enabled if (bp_is_active('settings')) { $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); } /* Send the message */ $to = apply_filters('groups_notification_group_invites_to', $to); $subject = apply_filters_ref_array('groups_notification_group_invites_subject', array($subject, &$group)); $message = apply_filters_ref_array('groups_notification_group_invites_message', array($message, &$group, $inviter_name, $inviter_link, $invites_link, $group_link, $settings_link)); wp_mail($to, $subject, $message); do_action('bp_groups_sent_invited_email', $invited_user_id, $subject, $message, $group); } }
/** * changing and saving of privacy setting save action */ function rt_privacy_settings_action() { if (buddypress()->current_action != 'privacy') { return; } if (isset($_POST["rtmedia-default-privacy"])) { $status = false; if (wp_verify_nonce($_POST['rtmedia_member_settings_privacy'], 'rtmedia_member_settings_privacy')) { $status = update_user_meta(get_current_user_id(), 'rtmedia-default-privacy', $_POST["rtmedia-default-privacy"]); } if (false == $status) { $feedback = __('No changes were made to your account.', 'buddypress-media'); $feedback_type = 'error'; } else { if (true == $status) { $feedback = __('Your default privacy settings saved successfully.', 'buddypress-media'); $feedback_type = 'success'; } } bp_core_add_message($feedback, $feedback_type); do_action('bp_core_general_settings_after_save'); bp_core_redirect(bp_displayed_user_domain() . bp_get_settings_slug() . '/privacy/'); } }
/** * Output the settings component slug * * @package BuddyPress * @subpackage SettingsTemplate * @since BuddyPress (1.5) * * @uses bp_get_settings_slug() */ function bp_settings_slug() { echo bp_get_settings_slug(); }
/** * Notify a member they have been invited to a group. * * @since 1.0.0 * * @param BP_Groups_Group $group Group object. * @param BP_Groups_Member $member Member object. * @param int $inviter_user_id ID of the user who sent the invite. * @return null|false False on failure. */ function groups_notification_group_invites(&$group, &$member, $inviter_user_id) { // Bail if member has already been invited. if (!empty($member->invite_sent)) { return; } // @todo $inviter_ud may be used for caching, test without it $inviter_ud = bp_core_get_core_userdata($inviter_user_id); $inviter_name = bp_core_get_userlink($inviter_user_id, true, false, true); $inviter_link = bp_core_get_user_domain($inviter_user_id); $group_link = bp_get_group_permalink($group); // Setup the ID for the invited user. $invited_user_id = $member->user_id; // Trigger a BuddyPress Notification. if (bp_is_active('notifications')) { bp_notifications_add_notification(array('user_id' => $invited_user_id, 'item_id' => $group->id, 'component_name' => buddypress()->groups->id, 'component_action' => 'group_invite')); } // Bail if member opted out of receiving this email. if ('no' === bp_get_user_meta($invited_user_id, 'notification_groups_invite', true)) { return false; } $invited_ud = bp_core_get_core_userdata($invited_user_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($invited_user_id) . $settings_slug . '/notifications/'; $invited_link = bp_core_get_user_domain($invited_user_id); $invites_link = trailingslashit($invited_link . bp_get_groups_slug() . '/invites'); // Set up and send the message. $to = $invited_ud->user_email; $subject = bp_get_email_subject(array('text' => sprintf(__('You have an invitation to the group: "%s"', 'buddypress'), $group->name))); $message = sprintf(__('One of your friends %1$s has invited you to the group: "%2$s". To view your group invites visit: %3$s To view the group visit: %4$s To view %5$s\'s profile visit: %6$s --------------------- ', 'buddypress'), $inviter_name, $group->name, $invites_link, $group_link, $inviter_name, $inviter_link); // Only show the disable notifications line if the settings component is enabled. if (bp_is_active('settings')) { $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); } /** * Filters the user email that the group invite notification will be sent to. * * @since 1.2.0 * * @param string $to User email the invite notification is being sent to. */ $to = apply_filters('groups_notification_group_invites_to', $to); /** * Filters the group invite notification subject that will be sent to user. * * @since 1.2.0 * * @param string $subject Invite notification email subject text. * @param BP_Groups_Group $group Object holding the current group instance. Passed by reference. */ $subject = apply_filters_ref_array('groups_notification_group_invites_subject', array($subject, &$group)); /** * Filters the group invite notification message that will be sent to user. * * @since 1.2.0 * * @param string $message Invite notification email message text. * @param BP_Groups_Group $group Object holding the current group instance. Passed by reference. * @param string $inviter_name Username for the person doing the inviting. * @param string $inviter_link Profile link for the person doing the inviting. * @param string $invites_link URL permalink for the invited user's invite management screen. * @param string $group_link URL permalink for the group that the invite was related to. * @param string $settings_link URL permalink for the user's notification settings area. */ $message = apply_filters_ref_array('groups_notification_group_invites_message', array($message, &$group, $inviter_name, $inviter_link, $invites_link, $group_link, $settings_link)); wp_mail($to, $subject, $message); /** * Fires after the notification is sent that a member has been invited to a group. * * @since 1.5.0 * * @param int $invited_user_id ID of the user who was invited. * @param string $subject Email notification subject text. * @param string $message Email notification message text. * @param BP_Groups_Group $group Group object. */ do_action('bp_groups_sent_invited_email', $invited_user_id, $subject, $message, $group); }
/** * Send an email and a BP notification on receipt of an @-mention in a group * * @deprecated 1.5 * @deprecated Deprecated in favor of the more general bp_activity_at_message_notification() */ function groups_at_message_notification($content, $poster_user_id, $group_id, $activity_id) { global $bp; _deprecated_function(__FUNCTION__, '1.5', 'bp_activity_at_message_notification()'); /* Scan for @username strings in an activity update. Notify each user. */ $pattern = '/[@]+([A-Za-z0-9-_\\.@]+)/'; preg_match_all($pattern, $content, $usernames); /* Make sure there's only one instance of each username */ if (!($usernames = array_unique($usernames[1]))) { return false; } $group = new BP_Groups_Group($group_id); foreach ((array) $usernames as $username) { if (!($receiver_user_id = bp_core_get_userid($username))) { continue; } /* Check the user is a member of the group before sending the update. */ if (!groups_is_user_member($receiver_user_id, $group_id)) { continue; } // Now email the user with the contents of the message (if they have enabled email notifications) if ('no' != bp_get_user_meta($receiver_user_id, 'notification_activity_new_mention', true)) { $poster_name = bp_core_get_user_displayname($poster_user_id); $message_link = bp_activity_get_permalink($activity_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($receiver_user_id) . $settings_slug . '/notifications/'; $poster_name = stripslashes($poster_name); $content = bp_groups_filter_kses(stripslashes($content)); // Set up and send the message $ud = bp_core_get_core_userdata($receiver_user_id); $to = $ud->user_email; $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES); $subject = '[' . $sitename . '] ' . sprintf(__('%1$s mentioned you in the group "%2$s"', 'buddypress'), $poster_name, $group->name); $message = sprintf(__('%1$s mentioned you in the group "%2$s": "%3$s" To view and respond to the message, log in and visit: %4$s --------------------- ', 'buddypress'), $poster_name, $group->name, $content, $message_link); $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); /* Send the message */ $to = apply_filters('groups_at_message_notification_to', $to); $subject = apply_filters('groups_at_message_notification_subject', $subject, $group, $poster_name); $message = apply_filters('groups_at_message_notification_message', $message, $group, $poster_name, $content, $message_link, $settings_link); nxt_mail($to, $subject, $message); } } do_action('bp_groups_sent_mention_email', $usernames, $subject, $message, $content, $poster_user_id, $group_id, $activity_id); }
/** * BuddyPress - Members Single Profile * * @package BuddyPress * @subpackage bp-legacy */ /** * Fires before the display of member settings template. * * @since 1.5.0 */ do_action('bp_before_member_settings_template'); ?> <form action="<?php echo trailingslashit(bp_displayed_user_domain() . bp_get_settings_slug() . '/profile'); ?> " method="post" class="standard-form" id="settings-form"> <?php if (bp_xprofile_get_settings_fields()) { ?> <?php while (bp_profile_groups()) { bp_the_profile_group(); ?> <?php if (bp_profile_fields()) { ?>
function x_buddypress_current_member_item_buttons() { if (bp_is_my_profile()) { ?> <div class="generic-button"> <a href="<?php echo trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug()); ?> "><?php _e('Edit Settings', '__x__'); ?> </a> </div> <?php } }
/** * Set up the Toolbar. * * @param array $wp_admin_nav Array of Admin Bar items. */ public function setup_admin_bar($wp_admin_nav = array()) { // Menus for logged in user if (is_user_logged_in()) { // Setup the logged in user variables $settings_link = trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug()); // Add main Settings menu $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => __('Settings', 'buddypress'), 'href' => $settings_link); // General Account $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-general', 'title' => __('General', 'buddypress'), 'href' => $settings_link); // Notifications - only add the tab when there is something to display there. if (has_action('bp_notification_settings')) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-notifications', 'title' => __('Email', 'buddypress'), 'href' => trailingslashit($settings_link . 'notifications')); } // Delete Account if (!bp_current_user_can('bp_moderate') && !bp_core_get_root_option('bp-disable-account-deletion')) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-delete-account', 'title' => __('Delete Account', 'buddypress'), 'href' => trailingslashit($settings_link . 'delete-account')); } } parent::setup_admin_bar($wp_admin_nav); }
/** * Email message recipients to alert them of a new unread private message. * * @since BuddyPress (1.0.0) * * @param array|BP_Messages_Message $raw_args { * Array of arguments. Also accepts a BP_Messages_Message object. * @type array $recipients User IDs of recipients. * @type string $email_subject Subject line of message. * @type string $email_content Content of message. * @type int $sender_id User ID of sender. * } */ function messages_notification_new_message($raw_args = array()) { // Cast possible $message object as an array if (is_object($raw_args)) { $args = (array) $raw_args; } else { $args = $raw_args; } // These should be extracted below $recipients = array(); $email_subject = $email_content = ''; $sender_id = 0; // Barf extract($args); // Get the sender display name $sender_name = bp_core_get_user_displayname($sender_id); // Bail if no recipients if (!empty($recipients)) { foreach ($recipients as $recipient) { if ($sender_id == $recipient->user_id || 'no' == bp_get_user_meta($recipient->user_id, 'notification_messages_new_message', true)) { continue; } // User data and links $ud = get_userdata($recipient->user_id); // Bail if user cannot be found if (empty($ud)) { continue; } $message_link = bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/'; $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($recipient->user_id) . $settings_slug . '/notifications/'; // Sender info $sender_name = stripslashes($sender_name); $subject = stripslashes(wp_filter_kses($subject)); $content = stripslashes(wp_filter_kses($message)); // Set up and send the message $email_to = $ud->user_email; $email_subject = bp_get_email_subject(array('text' => sprintf(__('New message from %s', 'buddypress'), $sender_name))); $email_content = sprintf(__('%1$s sent you a new message: Subject: %2$s "%3$s" To view and read your messages please log in and visit: %4$s --------------------- ', 'buddypress'), $sender_name, $subject, $content, $message_link); // Only show the disable notifications line if the settings component is enabled if (bp_is_active('settings')) { $email_content .= sprintf(__('To disable these notifications, please log in and go to: %s', 'buddypress'), $settings_link); } /** * Filters the user email that the message notification will be sent to. * * @since BuddyPress (1.2.0) * * @param string $email_to User email the notification is being sent to. * @param WP_User $ud WP_User object of who is receiving the message. */ $email_to = apply_filters('messages_notification_new_message_to', $email_to, $ud); /** * Filters the message notification subject that will be sent to user. * * @since BuddyPress (1.2.0) * * @param string $email_subject Email notification subject text. * @param string $sender_name Name of the person who sent the message. * @param WP_User $ud WP_User object of who is receiving the message. */ $email_subject = apply_filters('messages_notification_new_message_subject', $email_subject, $sender_name, $ud); /** * Filters the message notification message that will be sent to user. * * @since BuddyPress (1.2.0) * * @param string $email_content Email notification message text. * @param string $sender_name Name of the person who sent the message. * @param string $subject Email notification subject text. * @param string $content Content of the message. * @param string $message_link URL permalink for the message. * @param string $settings_link URL permalink for the user's notification settings area. * @param WP_User $ud WP_User object of who is receiving the message. */ $email_content = apply_filters('messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud); wp_mail($email_to, $email_subject, $email_content); } } /** * Fires after the sending of a new message email notification. * * @since BuddyPress (1.5.0) * * @param array $recipients User IDs of recipients. * @param string $email_subject Email notification subject text. * @param string $email_content Email notification message text. * @param array $$args Array of originally provided arguments. */ do_action('bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args); }
/** * Send email and BP notifications when an activity item receives a comment. * * @since 1.2.0 * * @uses bp_get_user_meta() * @uses bp_core_get_user_displayname() * @uses bp_activity_get_permalink() * @uses bp_core_get_user_domain() * @uses bp_get_settings_slug() * @uses bp_activity_filter_kses() * @uses bp_core_get_core_userdata() * @uses wp_specialchars_decode() * @uses get_blog_option() * @uses bp_get_root_blog_id() * @uses apply_filters() To call the 'bp_activity_new_comment_notification_to' hook. * @uses apply_filters() To call the 'bp_activity_new_comment_notification_subject' hook. * @uses apply_filters() To call the 'bp_activity_new_comment_notification_message' hook. * @uses wp_mail() * @uses do_action() To call the 'bp_activity_sent_reply_to_update_email' hook. * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_to' hook. * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_subject' hook. * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_message' hook. * @uses do_action() To call the 'bp_activity_sent_reply_to_reply_email' hook. * * @param int $comment_id The comment id. * @param int $commenter_id The ID of the user who posted the comment. * @param array $params {@link bp_activity_new_comment()}. * @return bool */ function bp_activity_new_comment_notification($comment_id = 0, $commenter_id = 0, $params = array()) { // Set some default parameters. $activity_id = 0; $parent_id = 0; extract($params); $original_activity = new BP_Activity_Activity($activity_id); if ($original_activity->user_id != $commenter_id && 'no' != bp_get_user_meta($original_activity->user_id, 'notification_activity_new_reply', true)) { $poster_name = bp_core_get_user_displayname($commenter_id); $thread_link = bp_activity_get_permalink($activity_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($original_activity->user_id) . $settings_slug . '/notifications/'; $poster_name = stripslashes($poster_name); $content = bp_activity_filter_kses(stripslashes($content)); // Set up and send the message. $ud = bp_core_get_core_userdata($original_activity->user_id); $to = $ud->user_email; $subject = bp_get_email_subject(array('text' => sprintf(__('%s replied to one of your updates', 'buddypress'), $poster_name))); $message = sprintf(__('%1$s replied to one of your updates: "%2$s" To view your original update and all comments, log in and visit: %3$s --------------------- ', 'buddypress'), $poster_name, $content, $thread_link); // Only show the disable notifications line if the settings component is enabled. if (bp_is_active('settings')) { $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); } /** * Filters the user email that the new comment notification will be sent to. * * @since 1.2.0 * * @param string $to User email the notification is being sent to. */ $to = apply_filters('bp_activity_new_comment_notification_to', $to); /** * Filters the new comment notification subject that will be sent to user. * * @since 1.2.0 * * @param string $subject Email notification subject text. * @param string $poster_name Name of the person who made the comment. */ $subject = apply_filters('bp_activity_new_comment_notification_subject', $subject, $poster_name); /** * Filters the new comment notification message that will be sent to user. * * @since 1.2.0 * * @param string $message Email notification message text. * @param string $poster_name Name of the person who made the comment. * @param string $content Content of the comment. * @param string $thread_link URL permalink for the activity thread. * @param string $settings_link URL permalink for the user's notification settings area. */ $message = apply_filters('bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link, $settings_link); wp_mail($to, $subject, $message); /** * Fires after the sending of a reply to an update email notification. * * @since 1.5.0 * * @param int $user_id ID of the original activity item author. * @param string $subject Email notification subject text. * @param string $message Email notification message text. * @param int $comment_id ID for the newly received comment. * @param int $commenter_id ID of the user who made the comment. * @param array $params Arguments used with the original activity comment. */ do_action('bp_activity_sent_reply_to_update_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params); } /* * If this is a reply to another comment, send an email notification to the * author of the immediate parent comment. */ if (empty($parent_id) || $activity_id == $parent_id) { return false; } $parent_comment = new BP_Activity_Activity($parent_id); if ($parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != bp_get_user_meta($parent_comment->user_id, 'notification_activity_new_reply', true)) { $poster_name = bp_core_get_user_displayname($commenter_id); $thread_link = bp_activity_get_permalink($activity_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($parent_comment->user_id) . $settings_slug . '/notifications/'; // Set up and send the message. $ud = bp_core_get_core_userdata($parent_comment->user_id); $to = $ud->user_email; $subject = bp_get_email_subject(array('text' => sprintf(__('%s replied to one of your comments', 'buddypress'), $poster_name))); $poster_name = stripslashes($poster_name); $content = bp_activity_filter_kses(stripslashes($content)); $message = sprintf(__('%1$s replied to one of your comments: "%2$s" To view the original activity, your comment and all replies, log in and visit: %3$s --------------------- ', 'buddypress'), $poster_name, $content, $thread_link); // Only show the disable notifications line if the settings component is enabled. if (bp_is_active('settings')) { $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); } /** * Filters the user email that the new comment reply notification will be sent to. * * @since 1.2.0 * * @param string $to User email the notification is being sent to. */ $to = apply_filters('bp_activity_new_comment_notification_comment_author_to', $to); /** * Filters the new comment reply notification subject that will be sent to user. * * @since 1.2.0 * * @param string $subject Email notification subject text. * @param string $poster_name Name of the person who made the comment reply. */ $subject = apply_filters('bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name); /** * Filters the new comment reply notification message that will be sent to user. * * @since 1.2.0 * * @param string $message Email notification message text. * @param string $poster_name Name of the person who made the comment reply. * @param string $content Content of the comment reply. * @param string $settings_link URL permalink for the user's notification settings area. * @param string $thread_link URL permalink for the activity thread. */ $message = apply_filters('bp_activity_new_comment_notification_comment_author_message', $message, $poster_name, $content, $settings_link, $thread_link); wp_mail($to, $subject, $message); /** * Fires after the sending of a reply to a reply email notification. * * @since 1.5.0 * * @param int $user_id ID of the parent activity item author. * @param string $subject Email notification subject text. * @param string $message Email notification message text. * @param int $comment_id ID for the newly received comment. * @param int $commenter_id ID of the user who made the comment. * @param array $params Arguments used with the original activity comment. */ do_action('bp_activity_sent_reply_to_reply_email', $parent_comment->user_id, $subject, $message, $comment_id, $commenter_id, $params); } }
?> <?php do_action('bp_member_plugin_options_nav'); ?> </ul> </div><!-- .item-list-tabs --> <h3><?php _e('Capabilities', 'buddypress'); ?> </h3> <form action="<?php echo bp_displayed_user_domain() . bp_get_settings_slug() . '/capabilities/'; ?> " name="account-capabilities-form" id="account-capabilities-form" class="standard-form" method="post"> <?php do_action('bp_members_capabilities_account_before_submit'); ?> <label> <input type="checkbox" name="user-spammer" id="user-spammer" value="1" <?php checked(bp_is_user_spammer(bp_displayed_user_id())); ?> /> <?php _e('This user is a spammer.', 'buddypress'); ?>
/** * Send notifications related to the acceptance of a friendship request. * * When a friendship request is accepted, an email and a BP notification are * sent to the user who requested the friendship ($initiator_id). * * @param int $friendship_id ID of the friendship object. * @param int $initiator_id ID of the user who initiated the request. * @param int $friend_id ID of the request recipient. * @return bool */ function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id) { $friend_name = bp_core_get_user_displayname($friend_id); if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) { return false; } $ud = get_userdata($initiator_id); $friend_link = bp_core_get_user_domain($friend_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = trailingslashit(bp_core_get_user_domain($initiator_id) . $settings_slug . '/notifications'); // Set up and send the message. $to = $ud->user_email; $subject = bp_get_email_subject(array('text' => sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name))); $message = sprintf(__('%1$s accepted your friend request. To view %2$s\'s profile: %3$s --------------------- ', 'buddypress'), $friend_name, $friend_name, $friend_link); // Only show the disable notifications line if the settings component is enabled. if (bp_is_active('settings')) { $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); } /** * Filters the email address for whose friend request got accepted. * * @since 1.2.0 * * @param string $to Email address for whose friend request got accepted. */ $to = apply_filters('friends_notification_accepted_request_to', $to); /** * Filters the subject for the friend request accepted email. * * @since 1.2.0 * * @param string $subject Subject line to be used in friend request accepted email. * @param string $friend_name Name of the person who accepted the friendship request. */ $subject = apply_filters('friends_notification_accepted_request_subject', $subject, $friend_name); /** * Filters the message for the friend request accepted email. * * @since 1.2.0 * * @param string $message Message to be used in friend request email. * @param string $friend_name Name of the person who accepted the friendship request. * @param string $friend_link Profile link of person who accepted the friendship request. * @param string $settings_link Email recipient's settings management link. */ $message = apply_filters('friends_notification_accepted_request_message', $message, $friend_name, $friend_link, $settings_link); wp_mail($to, $subject, $message); /** * Fires after the friend request accepted email is sent. * * @since 1.5.0 * * @param int $initiator_id ID of the friendship requester. * @param string $subject Text for the friend request subject field. * @param string $message Text for the friend request message field. * @param int $friendship_id ID of the friendship object. * @param int $friend_id ID of the request recipient. */ do_action('bp_friends_sent_accepted_email', $initiator_id, $subject, $message, $friendship_id, $friend_id); }
/** * Sends an email notification and a BP notification when someone mentions you in an update * * @since 1.2.0 * * @param int $comment_id The comment id * @param int $commenter_id The unique user_id of the user who posted the comment * @param array $params {@link bp_activity_new_comment()} * * @global object $bp BuddyPress global settings * @uses bp_get_user_meta() * @uses bp_core_get_user_displayname() * @uses bp_activity_get_permalink() * @uses bp_core_get_user_domain() * @uses bp_get_settings_slug() * @uses bp_activity_filter_kses() * @uses bp_core_get_core_userdata() * @uses nxt_specialchars_decode() * @uses get_blog_option() * @uses bp_get_root_blog_id() * @uses apply_filters() To call the 'bp_activity_new_comment_notification_to' hook * @uses apply_filters() To call the 'bp_activity_new_comment_notification_subject' hook * @uses apply_filters() To call the 'bp_activity_new_comment_notification_message' hook * @uses nxt_mail() * @uses do_action() To call the 'bp_activity_sent_reply_to_update_email' hook * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_to' hook * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_subject' hook * @uses apply_filters() To call the 'bp_activity_new_comment_notification_comment_author_message' hook * @uses do_action() To call the 'bp_activity_sent_reply_to_reply_email' hook */ function bp_activity_new_comment_notification($comment_id, $commenter_id, $params) { global $bp; extract($params); $original_activity = new BP_Activity_Activity($activity_id); if ($original_activity->user_id != $commenter_id && 'no' != bp_get_user_meta($original_activity->user_id, 'notification_activity_new_reply', true)) { $poster_name = bp_core_get_user_displayname($commenter_id); $thread_link = bp_activity_get_permalink($activity_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($original_activity->user_id) . $settings_slug . '/notifications/'; $poster_name = stripslashes($poster_name); $content = bp_activity_filter_kses(stripslashes($content)); // Set up and send the message $ud = bp_core_get_core_userdata($original_activity->user_id); $to = $ud->user_email; $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES); $subject = '[' . $sitename . '] ' . sprintf(__('%s replied to one of your updates', 'buddypress'), $poster_name); $message = sprintf(__('%1$s replied to one of your updates: "%2$s" To view your original update and all comments, log in and visit: %3$s --------------------- ', 'buddypress'), $poster_name, $content, $thread_link); $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); /* Send the message */ $to = apply_filters('bp_activity_new_comment_notification_to', $to); $subject = apply_filters('bp_activity_new_comment_notification_subject', $subject, $poster_name); $message = apply_filters('bp_activity_new_comment_notification_message', $message, $poster_name, $content, $thread_link, $settings_link); nxt_mail($to, $subject, $message); do_action('bp_activity_sent_reply_to_update_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params); } /*** * If this is a reply to another comment, send an email notification to the * author of the immediate parent comment. */ if ($activity_id == $parent_id) { return false; } $parent_comment = new BP_Activity_Activity($parent_id); if ($parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != bp_get_user_meta($parent_comment->user_id, 'notification_activity_new_reply', true)) { $poster_name = bp_core_get_user_displayname($commenter_id); $thread_link = bp_activity_get_permalink($activity_id); $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings'; $settings_link = bp_core_get_user_domain($parent_comment->user_id) . $settings_slug . '/notifications/'; // Set up and send the message $ud = bp_core_get_core_userdata($parent_comment->user_id); $to = $ud->user_email; $sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES); $subject = '[' . $sitename . '] ' . sprintf(__('%s replied to one of your comments', 'buddypress'), $poster_name); $poster_name = stripslashes($poster_name); $content = bp_activity_filter_kses(stripslashes($content)); $message = sprintf(__('%1$s replied to one of your comments: "%2$s" To view the original activity, your comment and all replies, log in and visit: %3$s --------------------- ', 'buddypress'), $poster_name, $content, $thread_link); $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); /* Send the message */ $to = apply_filters('bp_activity_new_comment_notification_comment_author_to', $to); $subject = apply_filters('bp_activity_new_comment_notification_comment_author_subject', $subject, $poster_name); $message = apply_filters('bp_activity_new_comment_notification_comment_author_message', $message, $poster_name, $content, $settings_link, $thread_link); nxt_mail($to, $subject, $message); do_action('bp_activity_sent_reply_to_reply_email', $original_activity->user_id, $subject, $message, $comment_id, $commenter_id, $params); } }
} else { ?> <p><?php _e('Deleting this account will delete all of the content it has created. It will be completely irrecoverable.', 'thatcamp'); ?> </p> <?php } ?> </div> <form action="<?php echo bp_displayed_user_domain() . bp_get_settings_slug() . '/delete-account'; ?> " name="account-delete-form" id="account-delete-form" class="standard-form" method="post"> <?php do_action('bp_members_delete_account_before_submit'); ?> <label> <input type="checkbox" name="delete-account-understand" id="delete-account-understand" value="1" onclick="if(this.checked) { document.getElementById('delete-account-button').disabled = ''; } else { document.getElementById('delete-account-button').disabled = 'disabled'; }" /> <?php _e('I understand the consequences.', 'thatcamp'); ?> </label> <div class="submit">
/** * Process email change verification or cancel requests. * * @since 2.1.0 */ function bp_settings_verify_email_change() { if (!bp_is_settings_component()) { return; } if (!bp_is_my_profile()) { return; } $redirect_to = trailingslashit(bp_displayed_user_domain() . bp_get_settings_slug()); // Email change is being verified if (isset($_GET['verify_email_change'])) { $pending_email = bp_get_user_meta(bp_displayed_user_id(), 'pending_email_change', true); // Bail if the hash provided doesn't match the one saved in the database if (urldecode($_GET['verify_email_change']) !== $pending_email['hash']) { return; } $email_changed = wp_update_user(array('ID' => bp_displayed_user_id(), 'user_email' => trim($pending_email['newemail']))); if ($email_changed) { // Delete object cache for displayed user wp_cache_delete('bp_core_userdata_' . bp_displayed_user_id(), 'bp'); // Delete the pending email change key bp_delete_user_meta(bp_displayed_user_id(), 'pending_email_change'); // Post a success message and redirect bp_core_add_message(__('You have successfully verified your new email address.', 'buddypress')); } else { // Unknown error bp_core_add_message(__('There was a problem verifying your new email address. Please try again.', 'buddypress'), 'error'); } bp_core_redirect($redirect_to); die; // Email change is being dismissed } elseif (!empty($_GET['dismiss_email_change'])) { bp_delete_user_meta(bp_displayed_user_id(), 'pending_email_change'); bp_core_add_message(__('You have successfully dismissed your pending email change.', 'buddypress')); bp_core_redirect($redirect_to); die; } }
function groups_notification_group_invites(&$group, &$member, $inviter_user_id) { global $bp; $inviter_ud = bp_core_get_core_userdata($inviter_user_id); $inviter_name = bp_core_get_userlink($inviter_user_id, true, false, true); $inviter_link = bp_core_get_user_domain($inviter_user_id); $group_link = bp_get_group_permalink($group); if (!$member->invite_sent) { $invited_user_id = $member->user_id; // Post a screen notification first. bp_core_add_notification($group->id, $invited_user_id, 'groups', 'group_invite'); if ('no' == bp_get_user_meta($invited_user_id, 'notification_groups_invite', true)) { return false; } $invited_ud = bp_core_get_core_userdata($invited_user_id); $settings_link = bp_core_get_user_domain($invited_user_id) . bp_get_settings_slug() . '/notifications/'; $invited_link = bp_core_get_user_domain($invited_user_id); $invites_link = $invited_link . bp_get_groups_slug() . '/invites'; // Set up and send the message $to = $invited_ud->user_email; $sitename = wp_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES); $subject = '[' . $sitename . '] ' . sprintf(__('You have an invitation to the group: "%s"', 'buddypress'), $group->name); $message = sprintf(__('One of your friends %1$s has invited you to the group: "%2$s". To view your group invites visit: %3$s To view the group visit: %4$s To view %5$s\'s profile visit: %6$s --------------------- ', 'buddypress'), $inviter_name, $group->name, $invites_link, $group_link, $inviter_name, $inviter_link); $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link); /* Send the message */ $to = apply_filters('groups_notification_group_invites_to', $to); $subject = apply_filters_ref_array('groups_notification_group_invites_subject', array($subject, &$group)); $message = apply_filters_ref_array('groups_notification_group_invites_message', array($message, &$group, $inviter_name, $inviter_link, $invites_link, $group_link, $settings_link)); wp_mail($to, $subject, $message); do_action('bp_groups_sent_invited_email', $invited_user_id, $subject, $message, $group); } }
?> </ul> </div><!-- .item-list-tabs --> <h3><?php _e('General Settings', 'dp'); ?> </h3> <?php do_action('bp_template_content'); ?> <form action="<?php echo bp_displayed_user_domain() . bp_get_settings_slug() . '/general'; ?> " method="post" class="standard-form" id="settings-form"> <?php if (!is_super_admin()) { ?> <label for="pwd"><?php _e('Current Password <span>(required to update email or change current password)</span>', 'dp'); ?> </label> <input type="password" name="pwd" id="pwd" size="16" value="" class="settings-input small" /> <a href="<?php echo site_url(add_query_arg(array('action' => 'lostpassword'), 'wp-login.php'), 'login'); ?> " title="<?php
/** * Adds "Settings > Profile" subnav item under the "Settings" adminbar menu. * * @since BuddyPress (2.0.0) * * @param array $wp_admin_nav The settings adminbar nav array. * @return array */ public function setup_settings_admin_nav($wp_admin_nav) { // Setup the logged in user variables $settings_link = trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug()); // Add the "Profile" subnav item $wp_admin_nav[] = array('parent' => 'my-account-' . buddypress()->settings->id, 'id' => 'my-account-' . buddypress()->settings->id . '-profile', 'title' => _x('Profile', 'My Account Settings sub nav', 'buddypress'), 'href' => trailingslashit($settings_link . 'profile')); return $wp_admin_nav; }
<?php /** This action is documented in bp-templates/bp-legacy/buddypress/members/single/settings/profile.php */ do_action('bp_before_member_settings_template'); ?> <form action="<?php echo bp_displayed_user_domain() . bp_get_settings_slug() . '/notifications'; ?> " method="post" class="standard-form" id="settings-form"> <p><?php _e('Send an email notice when:', 'buddypress'); ?> </p> <?php /** * Fires at the top of the member template notification settings form. * * @since BuddyPress (1.0.0) */ do_action('bp_notification_settings'); ?> <?php /** * Fires before the display of the submit button for user notification saving. * * @since BuddyPress (1.5.0) */ do_action('bp_members_notification_settings_before_submit');
function bp_is_user_settings_account_delete() { $this->go_to(bp_core_get_user_domain(bp_loggedin_user_id()) . bp_get_settings_slug() . '/delete-account'); $this->assertTrue(bp_is_user_settings_account_delete()); }
/** * Handles the setting of user capabilities, spamming, hamming, role, etc... */ function bp_settings_action_capabilities() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Bail if no submit action if (!isset($_POST['capabilities-submit'])) { return; } // Bail if not in settings if (!bp_is_settings_component() || !bp_is_current_action('capabilities')) { return false; } // 404 if there are any additional action variables attached if (bp_action_variables()) { bp_do_404(); return; } // Only super admins can currently spam users (but they can't spam // themselves) if (!is_super_admin() || bp_is_my_profile()) { return; } // Nonce check check_admin_referer('capabilities'); do_action('bp_settings_capabilities_before_save'); /** Spam **************************************************************/ $is_spammer = !empty($_POST['user-spammer']) ? true : false; if (bp_is_user_spammer(bp_displayed_user_id()) != $is_spammer) { $status = true == $is_spammer ? 'spam' : 'ham'; bp_core_process_spammer_status(bp_displayed_user_id(), $status); do_action('bp_core_action_set_spammer_status', bp_displayed_user_id(), $status); } /** Other *************************************************************/ do_action('bp_settings_capabilities_after_save'); // Redirect to the root domain bp_core_redirect(bp_displayed_user_domain() . bp_get_settings_slug() . '/capabilities/'); }
function bp_checkins_foursquare_user_actions() { global $bp; if (!bp_checkins_is_foursquare_ready()) { return; } if (bp_is_current_component('checkins') && !bp_displayed_user_id() && !bp_current_action() && !empty($_GET['code'])) { $referer = trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug()) . 'checkins-settings'; $foursquare_auth_user = new Bp_Checkins_Foursquare_Oauth(); $foursquare_user = $foursquare_auth_user->token_url($_GET['code']); if ($foursquare_user['type'] == 'error') { bp_core_add_message($foursquare_user['message'], 'error'); } else { update_user_meta($bp->loggedin_user->id, 'foursquare_latest_timestamp', current_time('timestamp')); bp_core_add_message($foursquare_user['message']); } bp_core_redirect($referer); } if (bp_is_settings_component() && bp_displayed_user_id() && 'checkins-settings' == bp_current_action() && !empty($_GET['update'])) { $referer = trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug()) . 'checkins-settings'; if ((int) bp_get_option('foursquare-user-import')) { return false; } $user_import = new Bp_Checkins_Foursquare_Import($bp->loggedin_user->id); $user_import_do = $user_import->user_import(); if ($user_import_do['type'] == 'error') { bp_core_add_message($user_import_do['message'], 'error'); } else { bp_core_add_message($user_import_do['message']); } bp_core_redirect($referer); } }