当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_get_user_meta函数代码示例

本文整理汇总了PHP中bp_get_user_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_user_meta函数的具体用法?PHP bp_get_user_meta怎么用?PHP bp_get_user_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_get_user_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mpp_get_allowed_space

/**
 * Get allowed space for the given component( In MB) 
 * @param type $component
 * @param type $component_id
 * @return numeric : no. of MBs
 */
function mpp_get_allowed_space($component, $component_id = null)
{
    if (!empty($component_id)) {
        if ($component == 'members') {
            $space_allowed = bp_get_user_meta($component_id, 'mpp_upload_space', true);
        } elseif ($component == 'groups' && function_exists('groups_get_groupmeta')) {
            $space_allowed = groups_get_groupmeta($component_id, 'mpp_upload_space', true);
        }
    }
    if (empty($component_id) || empty($space_allowed)) {
        //if owner id is empty
        //get the gallery/group space
        if ($component == 'members') {
            $space_allowed = mpp_get_option('mpp_upload_space');
        } elseif ($component == 'groups') {
            $space_allowed = mpp_get_option('mpp_upload_space_groups');
        }
    }
    //we should have some value by now
    //if( empty($space_allowed))
    ///   $space_allowed = get_option("gallery_upload_space");//currently let us deal with blog space gallery will have it's own limit later
    if (empty($space_allowed)) {
        $space_allowed = mpp_get_option('mpp_upload_space');
    }
    //if we still don't have anything
    if (empty($space_allowed) || !is_numeric($space_allowed)) {
        $space_allowed = 10;
    }
    //by default
    return apply_filters('mpp_allowed_space', $space_allowed, $component, $component_id);
    //allow to override for specific users/groups
}
开发者ID:baden03,项目名称:mediapress,代码行数:38,代码来源:space-stats.php

示例2: friends_notification_accepted_request

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);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:30,代码来源:bp-friends-notifications.php

示例3: friends_notification_accepted_request

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);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:30,代码来源:bp-friends-notifications.php

示例4: friends_notification_accepted_request

/**
 * 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).
 *
 * @since 1.0.0
 *
 * @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.
 */
function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id)
{
    if ('no' == bp_get_user_meta((int) $initiator_id, 'notification_friends_friendship_accepted', true)) {
        return;
    }
    $args = array('tokens' => array('friend.id' => $friend_id, 'friendship.url' => esc_url(bp_core_get_user_domain($friend_id)), 'friend.name' => bp_core_get_user_displayname($friend_id), 'friendship.id' => $friendship_id, 'initiator.id' => $initiator_id));
    bp_send_email('friends-request-accepted', $initiator_id, $args);
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:20,代码来源:bp-friends-notifications.php

示例5: post_comment

 /**
  * Post a gallery or media Main comment on single page
  * 
  * @return type
  */
 public function post_comment()
 {
     // Bail if not a POST action
     if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
         return;
     }
     // Check the nonce
     check_admin_referer('post_update', '_wpnonce_post_update');
     if (!is_user_logged_in()) {
         exit('-1');
     }
     $mpp_type = $_POST['mpp-type'];
     $mpp_id = $_POST['mpp-id'];
     if (empty($_POST['content'])) {
         exit('-1<div id="message" class="error"><p>' . __('Please enter some content to post.', 'mediapress') . '</p></div>');
     }
     $activity_id = 0;
     if (empty($_POST['object']) && bp_is_active('activity')) {
         //we are preventing this comment to be set as the user's lastes_update
         $user_id = bp_loggedin_user_id();
         $old_latest_update = bp_get_user_meta($user_id, 'bp_latest_update', true);
         $activity_id = bp_activity_post_update(array('content' => $_POST['content']));
         //restore
         if (!empty($old_latest_update)) {
             bp_update_user_meta($user_id, 'bp_latest_update', $old_latest_update);
         }
     } elseif ($_POST['object'] == 'groups') {
         if (!empty($_POST['item_id']) && bp_is_active('groups')) {
             $activity_id = groups_post_update(array('content' => $_POST['content'], 'group_id' => $_POST['item_id']));
         }
     } else {
         $activity_id = apply_filters('bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content']);
     }
     if (empty($activity_id)) {
         exit('-1<div id="message" class="error"><p>' . __('There was a problem posting your update, please try again.', 'mediapress') . '</p></div>');
     }
     //if we have got activity id, let us add a meta key
     if ($mpp_type == 'gallery') {
         mpp_activity_update_gallery_id($activity_id, $mpp_id);
     } elseif ($mpp_type == 'media') {
         mpp_activity_update_media_id($activity_id, $mpp_id);
     }
     $activity = new BP_Activity_Activity($activity_id);
     // $activity->component = buddypress()->mediapress->id;
     $activity->type = 'mpp_media_upload';
     $activity->save();
     if (bp_has_activities('include=' . $activity_id)) {
         while (bp_activities()) {
             bp_the_activity();
             mpp_locate_template(array('activity/entry.php'), true);
         }
     }
     exit;
 }
开发者ID:baden03,项目名称:mediapress,代码行数:59,代码来源:class-mpp-ajax-comment-helper.php

示例6: messages_notification_new_message

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);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:52,代码来源:bp-messages-notifications.php

示例7: messages_notification_new_message

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);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:46,代码来源:bp-messages-notifications.php

示例8: bp_group_documents_screen_notification_settings

/**
 * bp_group_documents_screen_notification_settings()
 *
 * Adds notification settings for the component, so that a user can turn off email
 * notifications set on specific component actions.  These will be added to the
 * bottom of the existing "Group" settings
 * @version 2, 21/6/2013, stergatu, fix a bug which prevented the notifications setting to be saved
 */
function bp_group_documents_screen_notification_settings()
{
    if (!($notification_group_documents_upload_member = bp_get_user_meta(bp_displayed_user_id(), 'notification_group_documents_upload_member', true))) {
        $notification_group_documents_upload_member = 'yes';
    }
    if (!($notification_group_documents_upload_mod = bp_get_user_meta(bp_displayed_user_id(), 'notification_group_documents_upload_mod', true))) {
        $notification_group_documents_upload_mod = 'yes';
    }
    ?>
    <tr id="groups-notification-settings-user-upload-file">
        <td></td>
        <td><?php 
    _e('A member uploads a document to a group you belong to', 'bp-group-documents');
    ?>
</td>
        <td class="yes"><input type="radio" name="notifications[notification_group_documents_upload_member]" value="yes" <?php 
    checked($notification_group_documents_upload_member, 'yes', true);
    ?>
/></td>
        <td class="no"><input type="radio" name="notifications[notification_group_documents_upload_member]" value="no" <?php 
    checked($notification_group_documents_upload_member, 'no', true);
    ?>
/></td>
    </tr>
    <tr>
        <td></td>
        <td><?php 
    _e('A member uploads a document to a group for which you are an moderator/admin', 'bp-group-documents');
    ?>
</td>
        <td class="yes"><input type="radio" name="notifications[notification_group_documents_upload_mod]" value="yes" <?php 
    checked($notification_group_documents_upload_mod, 'yes', true);
    ?>
/></td>
        <td class="no"><input type="radio" name="notifications[notification_group_documents_upload_mod]" value="no" <?php 
    checked($notification_group_documents_upload_mod, 'no', true);
    ?>
/></td>
    </tr>

    <?php 
    do_action('bp_group_documents_notification_settings');
    ?>
    <?php 
}
开发者ID:lilarock3rs,项目名称:bp-group-documents,代码行数:53,代码来源:notifications.php

示例9: messages_notification_new_message

/**
 * Email message recipients to alert them of a new unread private message.
 *
 * @since 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())
{
    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);
    if (empty($recipients)) {
        return;
    }
    $sender_name = bp_core_get_user_displayname($sender_id);
    // Send an email to each recipient.
    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);
        if (empty($ud)) {
            continue;
        }
        $args = array('tokens' => array('usermessage' => wp_strip_all_tags(stripslashes($message)), 'message.url' => esc_url(bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/view/' . $thread_id . '/'), 'sender.name' => $sender_name, 'usersubject' => sanitize_text_field(stripslashes($subject))));
        bp_send_email('messages-unread', $ud, $args);
    }
    /**
     * Fires after the sending of a new message email notification.
     *
     * @since 1.5.0
     * @deprecated 2.5.0 Use the filters in BP_Email.
     *                   $email_subject and $email_content arguments unset and deprecated.
     *
     * @param array  $recipients    User IDs of recipients.
     * @param string $email_subject Deprecated in 2.5; now an empty string.
     * @param string $email_content Deprecated in 2.5; now an empty string.
     * @param array  $args          Array of originally provided arguments.
     */
    do_action('bp_messages_sent_notification_email', $recipients, '', '', $args);
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:57,代码来源:bp-messages-notifications.php

示例10: bp_settings_pending_email_notice

/**
 * Add the 'pending email change' message to the settings page.
 *
 * @since 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 
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:25,代码来源:bp-settings-template.php

示例11: messages_notification_new_message

/**
 * 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);
        }
//.........这里部分代码省略.........
开发者ID:kosir,项目名称:thatcamp-org,代码行数:101,代码来源:bp-messages-notifications.php

示例12: bp_activity_new_comment_notification

/**
 * 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.
//.........这里部分代码省略.........
开发者ID:mawilliamson,项目名称:wordpress,代码行数:101,代码来源:bp-activity-notifications.php

示例13: bp_settings_verify_email_change

/**
 * 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;
    }
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:43,代码来源:bp-settings-actions.php

示例14: bp_dtheme_ajax_close_notice

function bp_dtheme_ajax_close_notice()
{
    global $userdata;
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    if (!isset($_POST['notice_id'])) {
        echo "-1<div id='message' class='error'><p>" . __('There was a problem closing the notice.', 'buddypress') . '</p></div>';
    } else {
        $notice_ids = bp_get_user_meta($userdata->ID, 'closed_notices', true);
        $notice_ids[] = (int) $_POST['notice_id'];
        bp_update_user_meta($userdata->ID, 'closed_notices', $notice_ids);
    }
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:15,代码来源:ajax.php

示例15: __construct

 /**
  * Constructor method.
  *
  * The arguments passed to this class constructor are of the same
  * format as {@link BP_Activity_Activity::get()}.
  *
  * @since 1.5.0
  *
  * @see BP_Activity_Activity::get() for a description of the argument
  *      structure, as well as default values.
  *
  * @param array $args {
  *     Array of arguments. Supports all arguments from
  *     BP_Activity_Activity::get(), as well as 'page_arg' and
  *     'include'. Default values for 'per_page' and 'display_comments'
  *     differ from the originating function, and are described below.
  *     @type string      $page_arg         The string used as a query parameter in
  *                                         pagination links. Default: 'acpage'.
  *     @type array|bool  $include          Pass an array of activity IDs to
  *                                         retrieve only those items, or false to noop the 'include'
  *                                         parameter. 'include' differs from 'in' in that 'in' forms
  *                                         an IN clause that works in conjunction with other filters
  *                                         passed to the function, while 'include' is interpreted as
  *                                         an exact list of items to retrieve, which skips all other
  *                                         filter-related parameters. Default: false.
  *     @type int|bool    $per_page         Default: 20.
  *     @type string|bool $display_comments Default: 'threaded'.
  * }
  */
 public function __construct($args)
 {
     $bp = buddypress();
     // Backward compatibility with old method of passing arguments.
     if (!is_array($args) || func_num_args() > 1) {
         _deprecated_argument(__METHOD__, '1.6', sprintf(__('Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress'), __METHOD__, __FILE__));
         $old_args_keys = array(0 => 'page', 1 => 'per_page', 2 => 'max', 3 => 'include', 4 => 'sort', 5 => 'filter', 6 => 'search_terms', 7 => 'display_comments', 8 => 'show_hidden', 9 => 'exclude', 10 => 'in', 11 => 'spam', 12 => 'page_arg');
         $func_args = func_get_args();
         $args = bp_core_parse_args_array($old_args_keys, $func_args);
     }
     $defaults = array('page' => 1, 'per_page' => 20, 'page_arg' => 'acpage', 'max' => false, 'fields' => 'all', 'count_total' => false, 'sort' => false, 'include' => false, 'exclude' => false, 'in' => false, 'filter' => false, 'scope' => false, 'search_terms' => false, 'meta_query' => false, 'date_query' => false, 'filter_query' => false, 'display_comments' => 'threaded', 'show_hidden' => false, 'spam' => 'ham_only', 'update_meta_cache' => true);
     $r = wp_parse_args($args, $defaults);
     extract($r);
     $this->pag_arg = sanitize_key($r['page_arg']);
     $this->pag_page = bp_sanitize_pagination_arg($this->pag_arg, $r['page']);
     $this->pag_num = bp_sanitize_pagination_arg('num', $r['per_page']);
     // Check if blog/forum replies are disabled.
     $this->disable_blogforum_replies = (bool) bp_core_get_root_option('bp-disable-blogforum-comments');
     // Get an array of the logged in user's favorite activities.
     $this->my_favs = maybe_unserialize(bp_get_user_meta(bp_loggedin_user_id(), 'bp_favorite_activities', true));
     // Fetch specific activity items based on ID's.
     if (!empty($include)) {
         $this->activities = bp_activity_get_specific(array('activity_ids' => explode(',', $include), 'max' => $max, 'count_total' => $count_total, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'sort' => $sort, 'display_comments' => $display_comments, 'show_hidden' => $show_hidden, 'spam' => $spam, 'update_meta_cache' => $update_meta_cache));
         // Fetch all activity items.
     } else {
         $this->activities = bp_activity_get(array('display_comments' => $display_comments, 'max' => $max, 'count_total' => $count_total, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'meta_query' => $meta_query, 'date_query' => $date_query, 'filter_query' => $filter_query, 'filter' => $filter, 'scope' => $scope, 'show_hidden' => $show_hidden, 'exclude' => $exclude, 'in' => $in, 'spam' => $spam, 'update_meta_cache' => $update_meta_cache));
     }
     // The total_activity_count property will be set only if a
     // 'count_total' query has taken place.
     if (!is_null($this->activities['total'])) {
         if (!$max || $max >= (int) $this->activities['total']) {
             $this->total_activity_count = (int) $this->activities['total'];
         } else {
             $this->total_activity_count = (int) $max;
         }
     }
     $this->has_more_items = $this->activities['has_more_items'];
     $this->activities = $this->activities['activities'];
     if ($max) {
         if ($max >= count($this->activities)) {
             $this->activity_count = count($this->activities);
         } else {
             $this->activity_count = (int) $max;
         }
     } else {
         $this->activity_count = count($this->activities);
     }
     $this->full_name = bp_get_displayed_user_fullname();
     // Fetch parent content for activity comments so we do not have to query in the loop.
     foreach ((array) $this->activities as $activity) {
         if ('activity_comment' != $activity->type) {
             continue;
         }
         $parent_ids[] = $activity->item_id;
     }
     if (!empty($parent_ids)) {
         $activity_parents = bp_activity_get_specific(array('activity_ids' => $parent_ids));
     }
     if (!empty($activity_parents['activities'])) {
         foreach ($activity_parents['activities'] as $parent) {
             $this->activity_parents[$parent->id] = $parent;
         }
         unset($activity_parents);
     }
     if ((int) $this->total_activity_count && (int) $this->pag_num) {
         $this->pag_links = paginate_links(array('base' => add_query_arg($this->pag_arg, '%#%'), 'format' => '', 'total' => ceil((int) $this->total_activity_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => _x('&larr;', 'Activity pagination previous text', 'buddypress'), 'next_text' => _x('&rarr;', 'Activity pagination next text', 'buddypress'), 'mid_size' => 1, 'add_args' => array()));
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:97,代码来源:class-bp-activity-template.php


注:本文中的bp_get_user_meta函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。