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


PHP bbp_is_subscriptions_active函数代码示例

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


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

示例1: notify_on_reply

 /**
  * Send a notification to subscribers
  *
  * @wp-filter bbp_new_reply 1
  */
 public function notify_on_reply($reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $reply_author = 0)
 {
     if ($this->handler === null) {
         return false;
     }
     global $wpdb;
     if (!bbp_is_subscriptions_active()) {
         return false;
     }
     $reply_id = bbp_get_reply_id($reply_id);
     $topic_id = bbp_get_topic_id($topic_id);
     $forum_id = bbp_get_forum_id($forum_id);
     if (!bbp_is_reply_published($reply_id)) {
         return false;
     }
     if (!bbp_is_topic_published($topic_id)) {
         return false;
     }
     $user_ids = bbp_get_topic_subscribers($topic_id, true);
     if (empty($user_ids)) {
         return false;
     }
     // Poster name
     $reply_author_name = apply_filters('bbsub_reply_author_name', bbp_get_reply_author_display_name($reply_id));
     do_action('bbp_pre_notify_subscribers', $reply_id, $topic_id, $user_ids);
     // Don't send notifications to the person who made the post
     $send_to_author = Falcon::get_option('bbsub_send_to_author', false);
     if (!$send_to_author && !empty($reply_author)) {
         $user_ids = array_filter($user_ids, function ($id) use($reply_author) {
             return (int) $id !== (int) $reply_author;
         });
     }
     // Get userdata for all users
     $user_ids = array_map(function ($id) {
         return get_userdata($id);
     }, $user_ids);
     // Sanitize the HTML into text
     $content = apply_filters('bbsub_html_to_text', bbp_get_reply_content($reply_id));
     // Build email
     $text = "%1\$s\n\n";
     $text .= "---\nReply to this email directly or view it online:\n%2\$s\n\n";
     $text .= "You are receiving this email because you subscribed to it. Login and visit the topic to unsubscribe from these emails.";
     $text = sprintf($text, $content, bbp_get_reply_url($reply_id));
     $text = apply_filters('bbsub_email_message', $text, $reply_id, $topic_id, $content);
     $subject = apply_filters('bbsub_email_subject', 'Re: [' . get_option('blogname') . '] ' . bbp_get_topic_title($topic_id), $reply_id, $topic_id);
     $options = array('id' => $topic_id, 'author' => $reply_author_name);
     $this->handler->send_mail($user_ids, $subject, $text, $options);
     do_action('bbp_post_notify_subscribers', $reply_id, $topic_id, $user_ids);
     return true;
 }
开发者ID:rmccue,项目名称:Falcon,代码行数:55,代码来源:bbPress.php

示例2: bbp_notify_forum_subscribers

/**
 * Sends notification emails for new topics to subscribed forums
 *
 * Gets new post's ID and check if there are subscribed users to that forum, and
 * if there are, send notifications
 *
 * Note: in bbPress 2.6, we've moved away from 1 email per subscriber to 1 email
 * with everyone BCC'd. This may have negative repercussions for email services
 * that limit the number of addresses in a BCC field (often to around 500.) In
 * those cases, we recommend unhooking this function and creating your own
 * custom emailer script.
 *
 * @since 2.5.0 bbPress (r5156)
 *
 * @param int $topic_id ID of the newly made reply
 * @param int $forum_id ID of the forum for the topic
 * @param mixed $anonymous_data Array of anonymous user data
 * @param int $topic_author ID of the topic author ID
 *
 * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
 * @uses bbp_get_topic_id() To validate the topic ID
 * @uses bbp_get_forum_id() To validate the forum ID
 * @uses bbp_is_topic_published() To make sure the topic is published
 * @uses bbp_get_forum_subscribers() To get the forum subscribers
 * @uses bbp_get_topic_author_display_name() To get the topic author's display name
 * @uses do_action() Calls 'bbp_pre_notify_forum_subscribers' with the topic id,
 *                    forum id and user id
 * @uses apply_filters() Calls 'bbp_forum_subscription_mail_message' with the
 *                    message, topic id, forum id and user id
 * @uses apply_filters() Calls 'bbp_forum_subscription_mail_title' with the
 *                    topic title, topic id, forum id and user id
 * @uses apply_filters() Calls 'bbp_forum_subscription_mail_headers'
 * @uses get_userdata() To get the user data
 * @uses wp_mail() To send the mail
 * @uses do_action() Calls 'bbp_post_notify_forum_subscribers' with the topic,
 *                    id, forum id and user id
 * @return bool True on success, false on failure
 */
function bbp_notify_forum_subscribers($topic_id = 0, $forum_id = 0, $anonymous_data = false, $topic_author = 0)
{
    // Bail if subscriptions are turned off
    if (!bbp_is_subscriptions_active()) {
        return false;
    }
    /** Validation ************************************************************/
    $topic_id = bbp_get_topic_id($topic_id);
    $forum_id = bbp_get_forum_id($forum_id);
    /**
     * Necessary for backwards compatibility
     *
     * @see https://bbpress.trac.wordpress.org/ticket/2620
     */
    $user_id = 0;
    /** Topic *****************************************************************/
    // Bail if topic is not published
    if (!bbp_is_topic_published($topic_id)) {
        return false;
    }
    // Poster name
    $topic_author_name = bbp_get_topic_author_display_name($topic_id);
    /** Mail ******************************************************************/
    // Remove filters from reply content and topic title to prevent content
    // from being encoded with HTML entities, wrapped in paragraph tags, etc...
    remove_all_filters('bbp_get_topic_content');
    remove_all_filters('bbp_get_topic_title');
    // Strip tags from text and setup mail data
    $topic_title = strip_tags(bbp_get_topic_title($topic_id));
    $topic_content = strip_tags(bbp_get_topic_content($topic_id));
    $topic_url = get_permalink($topic_id);
    $blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    // For plugins to filter messages per reply/topic/user
    $message = sprintf(__('%1$s wrote:

%2$s

Topic Link: %3$s

-----------

You are receiving this email because you subscribed to a forum.

Login and visit the topic to unsubscribe from these emails.', 'bbpress'), $topic_author_name, $topic_content, $topic_url);
    $message = apply_filters('bbp_forum_subscription_mail_message', $message, $topic_id, $forum_id, $user_id);
    if (empty($message)) {
        return;
    }
    // For plugins to filter titles per reply/topic/user
    $subject = apply_filters('bbp_forum_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $topic_id, $forum_id, $user_id);
    if (empty($subject)) {
        return;
    }
    /** User ******************************************************************/
    // Get the noreply@ address
    $no_reply = bbp_get_do_not_reply_address();
    // Setup "From" email address
    $from_email = apply_filters('bbp_subscription_from_email', $no_reply);
    // Setup the From header
    $headers = array('From: ' . get_bloginfo('name') . ' <' . $from_email . '>');
    // Get topic subscribers and bail if empty
    $user_ids = bbp_get_forum_subscribers($forum_id, true);
//.........这里部分代码省略.........
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:101,代码来源:functions.php

示例3: ajax_subscription

 /**
  * AJAX handler to Subscribe/Unsubscribe a user from a topic
  *
  * @since bbPress (r3732)
  *
  * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
  * @uses bbp_is_user_logged_in() To check if user is logged in
  * @uses bbp_get_current_user_id() To get the current user id
  * @uses current_user_can() To check if the current user can edit the user
  * @uses bbp_get_topic() To get the topic
  * @uses wp_verify_nonce() To verify the nonce
  * @uses bbp_is_user_subscribed() To check if the topic is in user's subscriptions
  * @uses bbp_remove_user_subscriptions() To remove the topic from user's subscriptions
  * @uses bbp_add_user_subscriptions() To add the topic from user's subscriptions
  * @uses bbp_ajax_response() To return JSON
  */
 public function ajax_subscription()
 {
     // Bail if subscriptions are not active
     if (!bbp_is_subscriptions_active()) {
         bbp_ajax_response(false, __('Subscriptions are no longer active.', 'bbpress'), 300);
     }
     // Bail if user is not logged in
     if (!is_user_logged_in()) {
         bbp_ajax_response(false, __('Please login to subscribe to this topic.', 'bbpress'), 301);
     }
     // Get user and topic data
     $user_id = bbp_get_current_user_id();
     $id = intval($_POST['id']);
     // Bail if user cannot add favorites for this user
     if (!current_user_can('edit_user', $user_id)) {
         bbp_ajax_response(false, __('You do not have permission to do this.', 'bbpress'), 302);
     }
     // Get the topic
     $topic = bbp_get_topic($id);
     // Bail if topic cannot be found
     if (empty($topic)) {
         bbp_ajax_response(false, __('The topic could not be found.', 'bbpress'), 303);
     }
     // Bail if user did not take this action
     if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'toggle-subscription_' . $topic->ID)) {
         bbp_ajax_response(false, __('Are you sure you meant to do that?', 'bbpress'), 304);
     }
     // Take action
     $status = bbp_is_user_subscribed($user_id, $topic->ID) ? bbp_remove_user_subscription($user_id, $topic->ID) : bbp_add_user_subscription($user_id, $topic->ID);
     // Bail if action failed
     if (empty($status)) {
         bbp_ajax_response(false, __('The request was unsuccessful. Please try again.', 'bbpress'), 305);
     }
     // Put subscription attributes in convenient array
     $attrs = array('topic_id' => $topic->ID, 'user_id' => $user_id);
     // Action succeeded
     bbp_ajax_response(true, bbp_get_user_subscribe_link($attrs, $user_id, false), 200);
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:54,代码来源:bbpress-functions.php

示例4: set_member_forum_query_vars

 /**
  * Set favorites and subscriptions query variables if viewing member profile
  * pages.
  *
  * @since bbPress (r4615)
  *
  * @global WP_Query $wp_query
  * @return If not viewing your own profile
  */
 public function set_member_forum_query_vars()
 {
     // Special handling for forum component
     if (!bp_is_my_profile()) {
         return;
     }
     global $wp_query;
     // 'favorites' action
     if (bbp_is_favorites_active() && bp_is_current_action(bbp_get_user_favorites_slug())) {
         $wp_query->bbp_is_single_user_favs = true;
         // 'subscriptions' action
     } elseif (bbp_is_subscriptions_active() && bp_is_current_action(bbp_get_user_subscriptions_slug())) {
         $wp_query->bbp_is_single_user_subs = true;
     }
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:24,代码来源:members.php

示例5: stachestack_bbp_get_user_subscribe_link

/**
 * Return the link to subscribe/unsubscribe from a topic
 *
 * @since bbPress (r2668)
 *
 * @param mixed $args This function supports these arguments:
 *  - subscribe: Subscribe text
 *  - unsubscribe: Unsubscribe text
 *  - user_id: User id
 *  - topic_id: Topic id
 *  - before: Before the link
 *  - after: After the link
 * @param int $user_id Optional. User id
 * @param bool $wrap Optional. If you want to wrap the link in <span id="subscription-toggle">.
 * @uses bbp_get_user_id() To get the user id
 * @uses current_user_can() To check if the current user can edit user
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_is_user_subscribed() To check if the user is subscribed
 * @uses bbp_is_subscriptions() To check if it's the subscriptions page
 * @uses bbp_get_subscriptions_permalink() To get subscriptions link
 * @uses bbp_get_topic_permalink() To get topic link
 * @uses apply_filters() Calls 'bbp_get_user_subscribe_link' with the
 *                        link, args, user id & topic id
 * @return string Permanent link to topic
 */
function stachestack_bbp_get_user_subscribe_link($args = '', $user_id = 0, $wrap = true)
{
    if (!bbp_is_subscriptions_active()) {
        return;
    }
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('subscribe' => __('Subscribe', 'bbpress'), 'unsubscribe' => __('Unsubscribe', 'bbpress'), 'user_id' => 0, 'topic_id' => 0, 'before' => '&nbsp;|&nbsp;', 'after' => ''), 'get_user_subscribe_link');
    // Validate user and topic ID's
    $user_id = bbp_get_user_id($r['user_id'], true, true);
    $topic_id = bbp_get_topic_id($r['topic_id']);
    if (empty($user_id) || empty($topic_id)) {
        return false;
    }
    // No link if you can't edit yourself
    if (!current_user_can('edit_user', (int) $user_id)) {
        return false;
    }
    // Decide which link to show
    $is_subscribed = bbp_is_user_subscribed($user_id, $topic_id);
    if (!empty($is_subscribed)) {
        $text = $r['unsubscribe'];
        $query_args = array('action' => 'bbp_unsubscribe', 'topic_id' => $topic_id);
    } else {
        $text = $r['subscribe'];
        $query_args = array('action' => 'bbp_subscribe', 'topic_id' => $topic_id);
    }
    // Create the link based where the user is and if the user is
    // subscribed already
    if (bbp_is_subscriptions()) {
        $permalink = bbp_get_subscriptions_permalink($user_id);
    } elseif (bbp_is_single_topic() || bbp_is_single_reply()) {
        $permalink = bbp_get_topic_permalink($topic_id);
    } else {
        $permalink = get_permalink();
    }
    $url = esc_url(wp_nonce_url(add_query_arg($query_args, $permalink), 'toggle-subscription_' . $topic_id));
    $sub = $is_subscribed ? ' class="is-subscribed"' : '';
    $html = sprintf('%s<span id="subscribe-%d"  %s><a href="%s" class="btn btn-warning btn-xs subscription-toggle" data-topic="%d">%s</a></span>%s', $r['before'], $topic_id, $sub, $url, $topic_id, $text, $r['after']);
    // Initial output is wrapped in a span, ajax output is hooked to this
    if (!empty($wrap)) {
        $html = '<span id="subscription-toggle">' . $html . '</span>';
    }
    // Return the link
    return apply_filters('bbp_get_user_subscribe_link', $html, $r, $user_id, $topic_id);
}
开发者ID:BeardandFedora,项目名称:StacheStack,代码行数:70,代码来源:bbpress.php

示例6: do_action

<?php

/**
 * User Subscriptions
 *
 * @package bbPress
 * @subpackage Theme
 */
?>

	<?php 
do_action('bbp_template_before_user_subscriptions');
?>

	<?php 
if (bbp_is_subscriptions_active()) {
    ?>

		<?php 
    if (bbp_is_user_home() || current_user_can('edit_users')) {
        ?>

			<div id="bbp-user-subscriptions" class="bbp-user-subscriptions">
				<h2 class="entry-title"><?php 
        _e('Subscribed Forums', 'wpdance');
        ?>
</h2>
				<div class="bbp-user-section">

					<?php 
        if (bbp_get_user_forum_subscriptions()) {
开发者ID:mynein,项目名称:myne,代码行数:31,代码来源:user-subscriptions.php

示例7: bbp_admin_setting_callback_subscriptions

/**
 * Allow subscriptions setting field
 *
 * @since 2.0.0 bbPress (r2737)
 *
 * @uses checked() To display the checked attribute
 */
function bbp_admin_setting_callback_subscriptions()
{
    ?>

	<input name="_bbp_enable_subscriptions" id="_bbp_enable_subscriptions" type="checkbox" value="1" <?php 
    checked(bbp_is_subscriptions_active(true));
    bbp_maybe_admin_setting_disabled('_bbp_enable_subscriptions');
    ?>
 />
	<label for="_bbp_enable_subscriptions"><?php 
    esc_html_e('Allow users to subscribe to forums and topics', 'bbpress');
    ?>
</label>

<?php 
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:23,代码来源:settings.php

示例8: bbp_subscriptions_handler

/**
 * Handles the front end subscribing and unsubscribing topics
 *
 * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
 * @uses bbp_get_user_id() To get the user id
 * @uses bbp_verify_nonce_request() To verify the nonce and check the request
 * @uses current_user_can() To check if the current user can edit the user
 * @uses bbPress:errors:add() To log the error messages
 * @uses bbp_is_user_subscribed() To check if the topic is in user's
 *                                 subscriptions
 * @uses bbp_remove_user_subscription() To remove the user subscription
 * @uses bbp_add_user_subscription() To add the user subscription
 * @uses do_action() Calls 'bbp_subscriptions_handler' with success, user id,
 *                    topic id and action
 * @uses bbp_is_subscription() To check if it's the subscription page
 * @uses bbp_get_subscription_link() To get the subscription page link
 * @uses bbp_get_topic_permalink() To get the topic permalink
 * @uses wp_safe_redirect() To redirect to the url
 */
function bbp_subscriptions_handler()
{
    if (!bbp_is_subscriptions_active()) {
        return false;
    }
    // Bail if not a GET action
    if ('GET' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    // Bail if required GET actions aren't passed
    if (empty($_GET['topic_id']) || empty($_GET['action'])) {
        return;
    }
    // Setup possible get actions
    $possible_actions = array('bbp_subscribe', 'bbp_unsubscribe');
    // Bail if actions aren't meant for this function
    if (!in_array($_GET['action'], $possible_actions)) {
        return;
    }
    // Get required data
    $action = $_GET['action'];
    $user_id = bbp_get_user_id(0, true, true);
    $topic_id = intval($_GET['topic_id']);
    // Check for empty topic
    if (empty($topic_id)) {
        bbp_add_error('bbp_subscription_topic_id', __('<strong>ERROR</strong>: No topic was found! Which topic are you subscribing/unsubscribing to?', 'bbpress'));
        // Check nonce
    } elseif (!bbp_verify_nonce_request('toggle-subscription_' . $topic_id)) {
        bbp_add_error('bbp_subscription_topic_id', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress'));
        // Check current user's ability to edit the user
    } elseif (!current_user_can('edit_user', $user_id)) {
        bbp_add_error('bbp_subscription_permissions', __('<strong>ERROR</strong>: You don\'t have the permission to edit favorites of that user!', 'bbpress'));
    }
    // Bail if we have errors
    if (bbp_has_errors()) {
        return;
    }
    /** No errors *************************************************************/
    $is_subscription = bbp_is_user_subscribed($user_id, $topic_id);
    $success = false;
    if (true == $is_subscription && 'bbp_unsubscribe' == $action) {
        $success = bbp_remove_user_subscription($user_id, $topic_id);
    } elseif (false == $is_subscription && 'bbp_subscribe' == $action) {
        $success = bbp_add_user_subscription($user_id, $topic_id);
    }
    // Do additional subscriptions actions
    do_action('bbp_subscriptions_handler', $success, $user_id, $topic_id, $action);
    // Success!
    if (true == $success) {
        // Redirect back from whence we came
        if (bbp_is_subscriptions()) {
            $redirect = bbp_get_subscriptions_permalink($user_id);
        } elseif (bbp_is_single_user()) {
            $redirect = bbp_get_user_profile_url();
        } elseif (is_singular(bbp_get_topic_post_type())) {
            $redirect = bbp_get_topic_permalink($topic_id);
        } elseif (is_single() || is_page()) {
            $redirect = get_permalink();
        }
        wp_safe_redirect($redirect);
        // For good measure
        exit;
        // Fail! Handle errors
    } elseif (true == $is_subscription && 'bbp_unsubscribe' == $action) {
        bbp_add_error('bbp_unsubscribe', __('<strong>ERROR</strong>: There was a problem unsubscribing from that topic!', 'bbpress'));
    } elseif (false == $is_subscription && 'bbp_subscribe' == $action) {
        bbp_add_error('bbp_subscribe', __('<strong>ERROR</strong>: There was a problem subscribing to that topic!', 'bbpress'));
    }
}
开发者ID:hscale,项目名称:webento,代码行数:88,代码来源:functions.php

示例9: ajax_get_forum_subscription

 /**
  * AJAX handler to gettting the Subscribe/Unsubscribe state for a user from a forum
  *
  * @since bbPress (r5155)
  *
  * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
  * @uses bbp_is_user_logged_in() To check if user is logged in
  * @uses bbp_get_current_user_id() To get the current user id
  * @uses current_user_can() To check if the current user can edit the user
  * @uses bbp_get_forum() To get the forum
  * @uses wp_verify_nonce() To verify the nonce
  * @uses bbp_is_user_subscribed() To check if the forum is in user's subscriptions
  * @uses bbp_remove_user_subscriptions() To remove the forum from user's subscriptions
  * @uses bbp_add_user_subscriptions() To add the forum from user's subscriptions
  * @uses bbp_ajax_response() To return JSON
  */
 public function ajax_get_forum_subscription()
 {
     // Bail if subscriptions are not active
     if (!bbp_is_subscriptions_active()) {
         bbp_ajax_response(false, __('Subscriptions are no longer active.', 'bbpress'), 300);
     }
     // Bail if user is not logged in
     if (!is_user_logged_in()) {
         bbp_ajax_response(false, __('Please login to subscribe to this forum.', 'bbpress'), 301);
     }
     // Get user and forum data
     $user_id = bbp_get_current_user_id();
     $id = intval($_POST['id']);
     // Bail if user cannot add favorites for this user
     if (!current_user_can('edit_user', $user_id)) {
         bbp_ajax_response(false, __('You do not have permission to do this.', 'bbpress'), 302);
     }
     // Get the forum
     $forum = bbp_get_forum($id);
     // Bail if forum cannot be found
     if (empty($forum)) {
         bbp_ajax_response(false, __('The forum could not be found.', 'bbpress'), 303);
     }
     // Bail if user did not take this action
     //if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'toggle-subscription_' . $forum->ID ) ) {
     //        bbp_ajax_response( false, __( 'Are you sure you meant to do that?', 'bbpress' ), 304 );
     //}
     // Put subscription attributes in convenient array
     $attrs = array('forum_id' => $forum->ID, 'user_id' => $user_id);
     // Action succeeded
     bbp_ajax_response(true, bbp_get_forum_subscription_link($attrs, $user_id, false), 200);
 }
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:48,代码来源:bbpress-functions.php

示例10: bbp_admin_setting_callback_subscriptions

/**
 * Allow subscriptions setting field
 *
 * @since bbPress (r2737)
 *
 * @uses checked() To display the checked attribute
 */
function bbp_admin_setting_callback_subscriptions()
{
    ?>

	<input id="_bbp_enable_subscriptions" name="_bbp_enable_subscriptions" type="checkbox" id="_bbp_enable_subscriptions" value="1" <?php 
    checked(bbp_is_subscriptions_active(true));
    ?>
 />
	<label for="_bbp_enable_subscriptions"><?php 
    _e('Allow users to subscribe to topics', 'bbpress');
    ?>
</label>

<?php 
}
开发者ID:rmccue,项目名称:bbPress,代码行数:22,代码来源:bbp-settings.php

示例11: cb_bbp_author_details

 function cb_bbp_author_details($cb_author_id, $cb_desc = true)
 {
     $cb_author_email = get_the_author_meta('publicemail', $cb_author_id);
     $cb_author_name = get_the_author_meta('display_name', $cb_author_id);
     $cb_author_position = get_the_author_meta('position', $cb_author_id);
     $cb_author_tw = get_the_author_meta('twitter', $cb_author_id);
     $cb_author_go = get_the_author_meta('googleplus', $cb_author_id);
     $cb_author_www = get_the_author_meta('url', $cb_author_id);
     $cb_author_desc = get_the_author_meta('description', $cb_author_id);
     $cb_author_posts = count_user_posts($cb_author_id);
     $cb_author_output = NULL;
     $cb_author_output .= '<div class="cb-author-details cb-bbp clearfix"><div class="cb-mask"><a href="' . bbp_get_user_profile_url() . '" title="' . bbp_get_displayed_user_field('display_name') . '" rel="me">' . get_avatar(bbp_get_displayed_user_field('user_email', 'raw'), apply_filters('bbp_single_user_details_avatar_size', 150)) . '</a></div><div class="cb-meta"><h3><a href="' . bbp_get_user_profile_url() . '" title="' . bbp_get_displayed_user_field('display_name') . '">' . $cb_author_name . '</a></h3>';
     if ($cb_author_position != NULL) {
         $cb_author_output .= '<div class="cb-author-position">' . $cb_author_position . '</div>';
     }
     if ($cb_author_desc != NULL && $cb_desc == true) {
         $cb_author_output .= '<p class="cb-author-bio">' . $cb_author_desc . '</p>';
     }
     if ($cb_author_email != NULL || $cb_author_www != NULL || $cb_author_tw != NULL || $cb_author_go != NULL) {
         $cb_author_output .= '<div class="cb-author-page-contact">';
     }
     if ($cb_author_email != NULL) {
         $cb_author_output .= '<a href="mailto:' . $cb_author_email . '"><i class="icon-envelope-alt cb-tip-bot" title="' . __('Email', 'cubell') . '"></i></a>';
     }
     if ($cb_author_www != NULL) {
         $cb_author_output .= ' <a href="' . $cb_author_www . '" target="_blank"><i class="icon-link cb-tip-bot" title="' . __('Website', 'cubell') . '"></i></a> ';
     }
     if ($cb_author_tw != NULL) {
         $cb_author_output .= ' <a href="//www.twitter.com/' . $cb_author_tw . '" target="_blank" ><i class="icon-twitter cb-tip-bot" title="Twitter"></i></a>';
     }
     if ($cb_author_go != NULL) {
         $cb_author_output .= ' <a href="' . $cb_author_go . '" rel="publisher" target="_top" title="Google+" class="cb-googleplus cb-tip-bot" ><img src="//ssl.gstatic.com/images/icons/gplus-32.png"  data-src-retina="//ssl.gstatic.com/images/icons/gplus-64.png" alt="Google+" ></a>';
     }
     if ($cb_author_email != NULL || $cb_author_www != NULL || $cb_author_go != NULL || $cb_author_tw != NULL) {
         $cb_author_output .= '</div>';
     }
     $cb_author_output .= '<div id="cb-user-nav"><ul>';
     if (bbp_is_single_user_replies()) {
         $cb_user_current = 'current';
     }
     $cb_author_output .= '<li class="';
     if (bbp_is_single_user_topics()) {
         $cb_author_output .= 'current';
     }
     $cb_author_output .= '"><span class="bbp-user-topics-created-link"><a href="' . bbp_get_user_topics_created_url() . '">' . __('Topics Started', 'bbpress') . '</a></span></li>';
     $cb_author_output .= '<li class="';
     if (bbp_is_single_user_replies()) {
         $cb_author_output .= 'current';
     }
     $cb_author_output .= '"><span class="bbp-user-replies-created-link"><a href="' . bbp_get_user_replies_created_url() . '">' . __('Replies Created', 'bbpress') . '</a></span></li>';
     if (bbp_is_favorites_active()) {
         $cb_author_output .= '<li class="';
         if (bbp_is_favorites()) {
             $cb_author_output .= 'current';
         }
         $cb_author_output .= '"><span class="bbp-user-favorites-link"><a href="' . bbp_get_favorites_permalink() . '">' . __('Favorites', 'bbpress') . '</a></span></li>';
     }
     if (bbp_is_user_home() || current_user_can('edit_users')) {
         if (bbp_is_subscriptions_active()) {
             $cb_author_output .= '<li class="';
             if (bbp_is_subscriptions()) {
                 $cb_author_output .= 'current';
             }
             $cb_author_output .= '"><span class="bbp-user-subscriptions-link"><a href="' . bbp_get_subscriptions_permalink() . '">' . __('Subscriptions', 'bbpress') . '</a></span></li>';
         }
         $cb_author_output .= '<li class="';
         if (bbp_is_single_user_edit()) {
             $cb_author_output .= 'current';
         }
         $cb_author_output .= '"><span class="bbp-user-edit-link"><a href="' . bbp_get_user_profile_edit_url() . '">' . __('Edit', 'bbpress') . '</a></span></li>';
     }
     $cb_author_output .= '</ul></div><!-- #cb-user-nav -->';
     $cb_author_output .= '</div></div>';
     return $cb_author_output;
 }
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:75,代码来源:core.php

示例12: setup_nav

 /**
  * Setup BuddyBar navigation
  *
  * @since 2.1.0 bbPress (r3552)
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Stop if there is no user displayed or logged in
     if (!is_user_logged_in() && !bp_displayed_user_id()) {
         return;
     }
     // Define local variable(s)
     $user_domain = '';
     // Add 'Forums' to the main navigation
     $main_nav = array('name' => __('Forums', 'bbpress'), 'slug' => $this->slug, 'position' => 80, 'screen_function' => 'bbp_member_forums_screen_topics', 'default_subnav_slug' => bbp_get_topic_archive_slug(), 'item_css_id' => $this->id);
     // Determine user to use
     if (bp_displayed_user_id()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     // User link
     $forums_link = trailingslashit($user_domain . $this->slug);
     // Topics started
     $sub_nav[] = array('name' => __('Topics Started', 'bbpress'), 'slug' => bbp_get_topic_archive_slug(), 'parent_url' => $forums_link, 'parent_slug' => $this->slug, 'screen_function' => 'bbp_member_forums_screen_topics', 'position' => 20, 'item_css_id' => 'topics');
     // Replies to topics
     $sub_nav[] = array('name' => __('Replies Created', 'bbpress'), 'slug' => bbp_get_reply_archive_slug(), 'parent_url' => $forums_link, 'parent_slug' => $this->slug, 'screen_function' => 'bbp_member_forums_screen_replies', 'position' => 40, 'item_css_id' => 'replies');
     // Favorite topics
     if (bbp_is_favorites_active()) {
         $sub_nav[] = array('name' => __('Favorites', 'bbpress'), 'slug' => bbp_get_user_favorites_slug(), 'parent_url' => $forums_link, 'parent_slug' => $this->slug, 'screen_function' => 'bbp_member_forums_screen_favorites', 'position' => 60, 'item_css_id' => 'favorites');
     }
     // Subscribed topics (my profile only)
     if (bp_is_my_profile() && bbp_is_subscriptions_active()) {
         $sub_nav[] = array('name' => __('Subscriptions', 'bbpress'), 'slug' => bbp_get_user_subscriptions_slug(), 'parent_url' => $forums_link, 'parent_slug' => $this->slug, 'screen_function' => 'bbp_member_forums_screen_subscriptions', 'position' => 60, 'item_css_id' => 'subscriptions');
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:39,代码来源:loader.php

示例13: roost_bbp_forum_subscription

    public static function roost_bbp_forum_subscription( $post ) {
        global $post;
        $post_id = $post->ID;

        $url = bbp_get_forum_permalink( $post_id );

        $roost_bbp_subscriptions = get_post_meta( $post_id, '_roost_bbp_subscription', true );

        echo( sprintf( "<span id='roost-subscribe-%d' style='display:none;'><a href='%s' data-post='%d' class='roost-forum-subscribe-link' class='subscription-toggle'></a></span>", $post_id, $url, $post_id ) );
        ?>
        <script>
            jQuery(document).ready(function($) {
                var subscribeLink = $('.roost-forum-subscribe-link');
                var subscribeWrap = $('#roost-subscribe-<?php echo( $post_id ); ?>');
                <?php
                    if ( ! empty( $roost_bbp_subscriptions ) ) {
                        $reply_bbp_subscriptions = json_encode( $roost_bbp_subscriptions );
                ?>
                        var registrations = <?php echo( $reply_bbp_subscriptions ); ?>;
                <?php
                    } else {
                ?>
                        var registrations = [];
                <?php
                    }
                ?>

                setTimeout(function(){
                    if ( window.roostEnabled ){
                        if ( 'undefined' !== typeof registrations[window.roostToken] ) {
                            if ( true === registrations[window.roostToken] ) {
                                subscribeLink.text( 'Unsubscribe from Push Notifications' );
                                subscribeLink.data( 'action', 'roost_bbp_unsubscribe' );
                            }
                        } else {
                            subscribeLink.text( 'Subscribe with Push Notifications' );
                            subscribeLink.data( 'action', 'roost_bbp_subscribe' );
                        }
                        <?php
                            if ( true === bbp_is_subscriptions_active() && true === is_user_logged_in() ) {
                        ?>
                            subscribeWrap.detach().appendTo( '#subscription-toggle' ).show();
                            subscribeWrap.prepend( ' | ' );
                        <?php
                            } else {
                        ?>
                            subscribeWrap.wrap( "<div id='subscription-toggle'></div>" ).show();
                        <?php
                            }
                        ?>
                    }
                }, 1500);

                subscribeLink.on( 'click', function( e ){
                    e.preventDefault();
                    var data = {
                        link: subscribeLink.attr( 'href' ),
                        action: subscribeLink.data( 'action' ),
                        roostToken: window.roostToken,
                        postID: subscribeLink.data( 'post' ),
                    };
                    if ( 'roost_bbp_subscribe' === subscribeLink.data( 'action' ) ){
                        subscribeLink.text( 'Unsubscribe from Push Notifications' );
                        subscribeLink.data( 'action', 'roost_bbp_unsubscribe' );
                    } else {
                        subscribeLink.text( 'Subscribe with Push Notifications' );
                        subscribeLink.data( 'action', 'roost_bbp_subscribe' );
                    }

                    $.post( ajaxurl, data, function( response ) {

                    });
                });
            });
        </script>
        <?php
    }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:77,代码来源:class-roost-bbpress.php

示例14: bbp_skeleton_dim_subscription

 /**
  * Subscribe/Unsubscribe a user from a topic
  *
  * @since bbPress (r2668)
  *
  * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
  * @uses bbp_get_current_user_id() To get the current user id
  * @uses current_user_can() To check if the current user can edit the user
  * @uses bbp_get_topic() To get the topic
  * @uses check_ajax_referer() To verify the nonce & check the referer
  * @uses bbp_is_user_subscribed() To check if the topic is in user's
  *                                 subscriptions
  * @uses bbp_remove_user_subscriptions() To remove the topic from user's
  *                                        subscriptions
  * @uses bbp_add_user_subscriptions() To add the topic from user's subscriptions
  */
 function bbp_skeleton_dim_subscription()
 {
     if (!bbp_is_subscriptions_active()) {
         return;
     }
     $user_id = bbp_get_current_user_id();
     $id = intval($_POST['id']);
     if (!current_user_can('edit_user', $user_id)) {
         die('-1');
     }
     if (!($topic = bbp_get_topic($id))) {
         die('0');
     }
     check_ajax_referer("toggle-subscription_{$topic->ID}");
     if (bbp_is_user_subscribed($user_id, $topic->ID)) {
         if (bbp_remove_user_subscription($user_id, $topic->ID)) {
             die('1');
         }
     } else {
         if (bbp_add_user_subscription($user_id, $topic->ID)) {
             die('1');
         }
     }
     die('0');
 }
开发者ID:besimhu,项目名称:legacy,代码行数:41,代码来源:functions.php

示例15: bbp_notify_forum_subscribers

/**
 * Sends notification emails for new topics to subscribed forums
 *
 * Gets new post's ID and check if there are subscribed users to that topic, and
 * if there are, send notifications
 *
 * @since bbPress (r5156)
 *
 * @param int $topic_id ID of the newly made reply
 * @uses bbp_is_subscriptions_active() To check if the subscriptions are active
 * @uses bbp_get_topic_id() To validate the topic ID
 * @uses bbp_get_forum_id() To validate the forum ID
 * @uses bbp_is_topic_published() To make sure the topic is published
 * @uses bbp_get_forum_subscribers() To get the forum subscribers
 * @uses bbp_get_topic_author_display_name() To get the topic author's display name
 * @uses do_action() Calls 'bbp_pre_notify_forum_subscribers' with the topic id,
 *                    forum id and user id
 * @uses apply_filters() Calls 'bbp_forum_subscription_mail_message' with the
 *                    message, topic id, forum id and user id
 * @uses apply_filters() Calls 'bbp_forum_subscription_mail_title' with the
 *                    topic title, topic id, forum id and user id
 * @uses apply_filters() Calls 'bbp_forum_subscription_mail_headers'
 * @uses get_userdata() To get the user data
 * @uses wp_mail() To send the mail
 * @uses do_action() Calls 'bbp_post_notify_forum_subscribers' with the topic,
 *                    id, forum id and user id
 * @return bool True on success, false on failure
 */
function bbp_notify_forum_subscribers($topic_id = 0, $forum_id = 0, $anonymous_data = false, $topic_author = 0)
{
    // Bail if subscriptions are turned off
    if (!bbp_is_subscriptions_active()) {
        return false;
    }
    /** Validation ************************************************************/
    $topic_id = bbp_get_topic_id($topic_id);
    $forum_id = bbp_get_forum_id($forum_id);
    /** Topic *****************************************************************/
    // Bail if topic is not published
    if (!bbp_is_topic_published($topic_id)) {
        return false;
    }
    /** User ******************************************************************/
    // Get forum subscribers and bail if empty
    $user_ids = bbp_get_forum_subscribers($forum_id, true);
    if (empty($user_ids)) {
        return false;
    }
    // Poster name
    $topic_author_name = bbp_get_topic_author_display_name($topic_id);
    /** Mail ******************************************************************/
    do_action('bbp_pre_notify_forum_subscribers', $topic_id, $forum_id, $user_ids);
    // Remove filters from reply content and topic title to prevent content
    // from being encoded with HTML entities, wrapped in paragraph tags, etc...
    remove_all_filters('bbp_get_topic_content');
    remove_all_filters('bbp_get_topic_title');
    // Strip tags from text
    $topic_title = strip_tags(bbp_get_topic_title($topic_id));
    $topic_content = strip_tags(bbp_get_topic_content($topic_id));
    $topic_url = get_permalink($topic_id);
    $blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    // Loop through users
    foreach ((array) $user_ids as $user_id) {
        // Don't send notifications to the person who made the post
        if (!empty($topic_author) && (int) $user_id === (int) $topic_author) {
            continue;
        }
        // For plugins to filter messages per reply/topic/user
        $message = sprintf(__('%1$s wrote:

%2$s

Topic Link: %3$s

-----------

You are receiving this email because you subscribed to a forum.

Login and visit the topic to unsubscribe from these emails.', 'bbpress'), $topic_author_name, $topic_content, $topic_url);
        $message = apply_filters('bbp_forum_subscription_mail_message', $message, $topic_id, $forum_id, $user_id);
        if (empty($message)) {
            continue;
        }
        // For plugins to filter titles per reply/topic/user
        $subject = apply_filters('bbp_forum_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $topic_id, $forum_id, $user_id);
        if (empty($subject)) {
            continue;
        }
        // Custom headers
        $headers = apply_filters('bbp_forum_subscription_mail_headers', array());
        // Get user data of this user
        $user = get_userdata($user_id);
        // Send notification email
        wp_mail($user->user_email, $subject, $message, $headers);
    }
    do_action('bbp_post_notify_forum_subscribers', $topic_id, $forum_id, $user_ids);
    return true;
}
开发者ID:donwea,项目名称:nhap.org,代码行数:98,代码来源:functions.php


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