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


PHP bbp_get_current_user_id函数代码示例

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


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

示例1: test_bbp_topic_deleted_reply_counts

 /**
  * Generic function to test the topic counts on a deleted reply
  */
 public function test_bbp_topic_deleted_reply_counts()
 {
     $f = $this->factory->forum->create();
     $t = $this->factory->topic->create(array('post_parent' => $f, 'post_author' => bbp_get_current_user_id(), 'topic_meta' => array('forum_id' => $f)));
     $r1 = $this->factory->reply->create(array('post_parent' => $t, 'post_author' => bbp_get_current_user_id(), 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     $u = $this->factory->user->create();
     $count = bbp_update_topic_reply_count($t);
     $this->assertSame(1, $count);
     $count = bbp_update_topic_reply_count_hidden($t);
     $this->assertSame(0, $count);
     $count = bbp_update_topic_voice_count($t);
     $this->assertSame(1, $count);
     $r2 = $this->factory->reply->create(array('post_parent' => $t, 'post_author' => $u, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     $count = bbp_update_topic_reply_count($t);
     $this->assertSame(2, $count);
     $count = bbp_update_topic_reply_count_hidden($t);
     $this->assertSame(0, $count);
     $count = bbp_update_topic_voice_count($t);
     $this->assertSame(2, $count);
     // ToDo: Update this to use bbp_delete_reply().
     bbp_clean_post_cache($t);
     wp_delete_post($r2, true);
     $count = bbp_get_topic_reply_count($t, true);
     $this->assertSame(1, $count);
     $count = bbp_get_topic_reply_count_hidden($t, true);
     $this->assertSame(0, $count);
     $count = bbp_get_topic_voice_count($t, true);
     $this->assertSame(1, $count);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:32,代码来源:counts.php

示例2: test_bbp_forum_new_topic_counts

 /**
  * Generic function to test the forum counts with a new topic
  */
 public function test_bbp_forum_new_topic_counts()
 {
     $f = $this->factory->forum->create();
     $t1 = $this->factory->topic->create(array('post_parent' => $f, 'post_author' => bbp_get_current_user_id(), 'topic_meta' => array('forum_id' => $f)));
     $u = $this->factory->user->create();
     // Cheating here, but we need $_SERVER['SERVER_NAME'] to be set.
     $this->setUp_wp_mail(false);
     // Simulate the 'bbp_new_topic' action.
     do_action('bbp_new_topic', $t1, $f, false, bbp_get_current_user_id(), $t1);
     // Reverse our changes.
     $this->tearDown_wp_mail(false);
     $count = bbp_get_forum_topic_count($f, true, true);
     $this->assertSame(1, $count);
     $count = bbp_get_forum_topic_count_hidden($f, true, true);
     $this->assertSame(0, $count);
     $t2 = $this->factory->topic->create(array('post_parent' => $f, 'post_author' => $u, 'topic_meta' => array('forum_id' => $f)));
     // Cheating here, but we need $_SERVER['SERVER_NAME'] to be set.
     $this->setUp_wp_mail(false);
     // Simulate the 'bbp_new_topic' action.
     do_action('bbp_new_topic', $t2, $f, false, $u, $t2);
     // Reverse our changes.
     $this->tearDown_wp_mail(false);
     $count = bbp_get_forum_topic_count($f, true, true);
     $this->assertSame(2, $count);
     $count = bbp_get_forum_topic_count_hidden($f, true, true);
     $this->assertSame(0, $count);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:30,代码来源:counts.php

示例3: test_bbp_forum_new_topic_counts

 /**
  * Generic function to test the forum counts with a new topic
  */
 public function test_bbp_forum_new_topic_counts()
 {
     remove_action('bbp_insert_topic', 'bbp_insert_topic_update_counts', 10);
     $f = $this->factory->forum->create();
     $t1 = $this->factory->topic->create(array('post_parent' => $f, 'post_author' => bbp_get_current_user_id(), 'topic_meta' => array('forum_id' => $f)));
     $u = $this->factory->user->create();
     // Don't attempt to send an email. This is for speed and PHP errors.
     remove_action('bbp_new_topic', 'bbp_notify_forum_subscribers', 11, 4);
     // Simulate the 'bbp_new_topic' action.
     do_action('bbp_new_topic', $t1, $f, false, bbp_get_current_user_id(), $t1);
     $count = bbp_get_forum_topic_count($f, true, true);
     $this->assertSame(1, $count);
     $count = bbp_get_forum_topic_count_hidden($f, true, true);
     $this->assertSame(0, $count);
     $t2 = $this->factory->topic->create(array('post_parent' => $f, 'post_author' => $u, 'topic_meta' => array('forum_id' => $f)));
     // Simulate the 'bbp_new_topic' action.
     do_action('bbp_new_topic', $t2, $f, false, $u, $t2);
     $count = bbp_get_forum_topic_count($f, true, true);
     $this->assertSame(2, $count);
     $count = bbp_get_forum_topic_count_hidden($f, true, true);
     $this->assertSame(0, $count);
     // Re-add removed actions.
     add_action('bbp_insert_topic', 'bbp_insert_topic_update_counts', 10, 2);
     add_action('bbp_new_topic', 'bbp_notify_forum_subscribers', 11, 4);
 }
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:28,代码来源:counts.php

示例4: EnrolledCourse

 public static function EnrolledCourse($student_id, $course_id, $status)
 {
     global $wpdb;
     $group_id = get_post_meta($course_id, 'buddypress_id', true);
     // Get BuddyPress
     $bp = buddypress();
     $group = $wpdb->get_row($wpdb->prepare("SELECT g.* FROM {$bp->groups->table_name} g WHERE g.id = %d", $group_id));
     groups_invite_user(array('user_id' => $student_id, 'group_id' => $group_id, 'inviter_id' => $group->creator_id, 'date_modified' => bp_core_current_time(), 'is_confirmed' => 1));
     $forums = bbp_get_group_forum_ids($group_id);
     bbp_add_user_forum_subscription(bbp_get_current_user_id(), $forums[0]);
 }
开发者ID:Bnei-Baruch,项目名称:mailchimpNamasteIntegration,代码行数:11,代码来源:CreateGroupAndForumForCourse.php

示例5: test_bbp_get_current_user_id

 /**
  * @covers ::bbp_current_user_id
  * @covers ::bbp_get_current_user_id
  */
 public function test_bbp_get_current_user_id()
 {
     $int_value = $this->keymaster_userdata->ID;
     $formatted_value = bbp_number_format($int_value);
     // Integer.
     $user_id = bbp_get_current_user_id();
     $this->assertSame($this->keymaster_id, $user_id);
     // Output.
     $this->expectOutputString($formatted_value);
     bbp_current_user_id($this->keymaster_id);
 }
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:15,代码来源:user.php

示例6: checkbox

    /**
     * Outputs the "Set as private reply" checkbox
     *
     * @since 1.0
     *
     * @return void
     */
    public function checkbox()
    {
        ?>
		<p>

			<input name="bbp_private_reply" id="bbp_private_reply" type="checkbox"<?php 
        checked('1', $this->is_private(bbp_get_reply_id()));
        ?>
 value="1" tabindex="<?php 
        bbp_tab_index();
        ?>
" />

			<?php 
        if (bbp_is_reply_edit() && get_the_author_meta('ID') != bbp_get_current_user_id()) {
            ?>

				<label for="bbp_private_reply"><?php 
            _e('Set author\'s post as private.', 'bbp_private_replies');
            ?>
</label>

			<?php 
        } else {
            ?>

				<label for="bbp_private_reply"><?php 
            _e('Set as private reply', 'bbp_private_replies');
            ?>
</label>

			<?php 
        }
        ?>

		</p>
<?php 
    }
开发者ID:KingYes,项目名称:bbPress-Private-replies,代码行数:45,代码来源:bbp-private-replies.php

示例7: bbp_is_user_home_edit

/**
 * Check if current page is the currently logged in users author edit page
 *
 * @since bbPress (r3918)
 * @uses bbp_is_single_user_edit() Check query variable
 * @uses is_user_logged_in() Must be logged in to be home
 * @uses bbp_get_displayed_user_id()
 * @uses bbp_get_current_user_id()
 * @return bool True if it's the user's home, false if not
 */
function bbp_is_user_home_edit()
{
    // Assume false
    $retval = false;
    if (bbp_is_single_user_edit() && is_user_logged_in()) {
        $retval = (bool) (bbp_get_displayed_user_id() == bbp_get_current_user_id());
    }
    return (bool) apply_filters('bbp_is_user_home_edit', $retval);
}
开发者ID:rmccue,项目名称:bbPress,代码行数:19,代码来源:bbp-common-template.php

示例8: do_action

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

							<p>
								<input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php 
        bbp_form_topic_subscribed();
        ?>
 tabindex="<?php 
        bbp_tab_index();
        ?>
" />

								<?php 
        if (bbp_is_topic_edit() && $post->post_author != bbp_get_current_user_id()) {
            ?>

									<label for="bbp_topic_subscription"><?php 
            _e('Notify the author of follow-up replies via email', 'bbpress');
            ?>
</label>

								<?php 
        } else {
            ?>

									<label for="bbp_topic_subscription"><?php 
            _e('Notify me of follow-up replies via email', 'bbpress');
            ?>
</label>
开发者ID:besimhu,项目名称:legacy,代码行数:30,代码来源:form-topic.php

示例9: test_should_return_true_for_keymasterss_to_bypass_blacklist_check

 /**
  * @covers ::bbp_check_for_blacklist
  */
 public function test_should_return_true_for_keymasterss_to_bypass_blacklist_check()
 {
     // Create a keymaster user.
     $old_current_user = 0;
     $this->old_current_user = get_current_user_id();
     $this->set_current_user($this->factory->user->create(array('role' => 'subscriber')));
     $this->keymaster_id = get_current_user_id();
     bbp_set_user_role($this->keymaster_id, bbp_get_keymaster_role());
     $t = $this->factory->topic->create(array('post_author' => bbp_get_current_user_id(), 'post_title' => 'Sting', 'post_content' => 'Beware, there maybe bees hibernating.'));
     $anonymous_data = false;
     $author_id = bbp_get_topic_author_id($t);
     $title = bbp_get_topic_title($t);
     $content = bbp_get_topic_content($t);
     update_option('blacklist_keys', "hibernating\nfoo");
     $result = bbp_check_for_blacklist($anonymous_data, $author_id, $title, $content);
     $this->assertTrue($result);
     // Retore the original user.
     $this->set_current_user($this->old_current_user);
 }
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:22,代码来源:functions.php

示例10: bbp_user_can_view_forum

/**
 * Check if the user can access a specific forum
 *
 * @since bbPress (r3127)
 *
 * @uses bbp_get_current_user_id()
 * @uses bbp_get_forum_id()
 * @uses bbp_allow_anonymous()
 * @uses bbp_parse_args()
 * @uses bbp_get_user_id()
 * @uses current_user_can()
 * @uses is_super_admin()
 * @uses bbp_is_forum_public()
 * @uses bbp_is_forum_private()
 * @uses bbp_is_forum_hidden()
 * @uses current_user_can()
 * @uses apply_filters()
 *
 * @return bool
 */
function bbp_user_can_view_forum($args = '')
{
    // Default arguments
    $defaults = array('user_id' => bbp_get_current_user_id(), 'forum_id' => bbp_get_forum_id(), 'check_ancestors' => false);
    $r = bbp_parse_args($args, $defaults, 'user_can_view_forum');
    extract($r);
    // Validate parsed values
    $user_id = bbp_get_user_id($user_id, false, false);
    $forum_id = bbp_get_forum_id($forum_id);
    $retval = false;
    // User is a super admin
    if (is_super_admin()) {
        $retval = true;
    } elseif (bbp_is_forum_public($forum_id, $check_ancestors)) {
        $retval = true;
    } elseif (bbp_is_forum_private($forum_id, $check_ancestors) && current_user_can('read_private_forums')) {
        $retval = true;
    } elseif (bbp_is_forum_hidden($forum_id, $check_ancestors) && current_user_can('read_hidden_forums')) {
        $retval = true;
    }
    return apply_filters('bbp_user_can_view_forum', $retval, $forum_id, $user_id);
}
开发者ID:rmccue,项目名称:bbPress,代码行数:42,代码来源:bbp-user-template.php

示例11: bbp_displayed_user_field

bbp_displayed_user_field('user_email', 'edit');
?>
" class="regular-text" tabindex="<?php 
bbp_tab_index();
?>
" />

			<?php 
// Handle address change requests
$new_email = get_option(bbp_get_displayed_user_id() . '_new_email');
if (!empty($new_email) && $new_email !== bbp_get_displayed_user_field('user_email', 'edit')) {
    ?>

				<span class="updated inline">
					<?php 
    printf(wp_kses(__('There is a pending email address change to <code>%1$s</code>. <a href="%2$s">Cancel</a>', 'monsoon'), array('code' => array(), 'a' => array())), $new_email['newemail'], esc_url(self_admin_url('user.php?dismiss=' . bbp_get_current_user_id() . '_new_email')));
    ?>
				</span>
			<?php 
}
?>
		</div>

		<div id="password">
			<label for="pass1"><?php 
esc_html_e('New Password', 'monsoon');
?>
</label>
			<fieldset class="bbp-form password">
				<input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" tabindex="<?php 
bbp_tab_index();
开发者ID:estrategasdigitales,项目名称:flazam,代码行数:31,代码来源:form-user-edit.php

示例12: do_action

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

						<p>
							<input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php 
        bbp_form_topic_subscribed();
        ?>
 tabindex="<?php 
        bbp_tab_index();
        ?>
" />

							<?php 
        if (bbp_is_topic_edit() && bbp_get_topic_author_id() !== bbp_get_current_user_id()) {
            ?>

								<label for="bbp_topic_subscription"><?php 
            _e('Notify the author of follow-up replies via email', 'bbpress');
            ?>
</label>

							<?php 
        } else {
            ?>

								<label for="bbp_topic_subscription"><?php 
            _e('Notify me of follow-up replies via email', 'bbpress');
            ?>
</label>
开发者ID:severnrescue,项目名称:web,代码行数:30,代码来源:form-topic.php

示例13: bbp_tab_index

?>
" class="regular-text" tabindex="<?php 
bbp_tab_index();
?>
" />

			<?php 
// Handle address change requests
$new_email = get_option(bbp_get_displayed_user_id() . '_new_email');
if (!empty($new_email) && $new_email !== bbp_get_displayed_user_field('user_email', 'edit')) {
    ?>

				<span class="updated inline">

					<?php 
    printf(__('There is a pending email address change to <code>%1$s</code>. <a href="%2$s">Cancel</a>', 'bbpress'), $new_email['newemail'], esc_url(self_admin_url('user.php?dismiss=' . bbp_get_current_user_id() . '_new_email')));
    ?>

				</span>

			<?php 
}
?>

		</div>

		<div id="password">
			<label for="pass1"><?php 
_e('New Password', 'bbpress');
?>
</label>
开发者ID:roycocup,项目名称:enclothed,代码行数:31,代码来源:form-user-edit.php

示例14: bbp_user_profile_url

    ?>
    <div class="fullwidth">
			<a id="author-avatar" href="<?php 
    bbp_user_profile_url(bbp_get_current_user_id());
    ?>
">
				<?php 
    echo get_avatar(bbp_get_current_user_id(), '64');
    ?>
			</a>
			<h4>Welcome back, <?php 
    bbp_user_profile_link(bbp_get_current_user_id());
    ?>
!</h4>
				<a href="<?php 
    echo bbp_get_user_profile_url(bbp_get_current_user_id());
    ?>
">Your Profile</a>
				 | 
				<a href="<?php 
    echo wp_logout_url();
    ?>
" title="Log Out">Logout</a>
			<div class="clear"></div>
		</div>
		
		<?php 
} else {
    ?>
			
    <div class="one_third">
开发者ID:JMulligan,项目名称:skeleton_wp,代码行数:31,代码来源:archive-forum.php

示例15: bbp_get_form_topic_subscribed

/**
 * Return checked value of topic subscription
 *
 * @since 2.0.0 bbPress (r2976)
 *
 * @uses bbp_is_topic_edit() To check if it's the topic edit page
 * @uses bbp_is_user_subscribed_to_topic() To check if the user is
 *                                          subscribed to the topic
 * @uses apply_filters() Calls 'bbp_get_form_topic_subscribed' with the
 *                        option
 * @return string Checked value of topic subscription
 */
function bbp_get_form_topic_subscribed()
{
    // Get _POST data
    if (bbp_is_topic_form_post_request() && isset($_POST['bbp_topic_subscription'])) {
        $topic_subscribed = (bool) $_POST['bbp_topic_subscription'];
        // Get edit data
    } elseif (bbp_is_topic_edit() || bbp_is_reply_edit()) {
        // Get current posts author
        $post_author = bbp_get_global_post_field('post_author', 'raw');
        // Post author is not the current user
        if (bbp_get_current_user_id() !== $post_author) {
            $topic_subscribed = bbp_is_user_subscribed_to_topic($post_author);
            // Post author is the current user
        } else {
            $topic_subscribed = bbp_is_user_subscribed_to_topic(bbp_get_current_user_id());
        }
        // Get current status
    } elseif (bbp_is_single_topic()) {
        $topic_subscribed = bbp_is_user_subscribed_to_topic(bbp_get_current_user_id());
        // No data
    } else {
        $topic_subscribed = false;
    }
    // Get checked output
    $checked = checked($topic_subscribed, true, false);
    return apply_filters('bbp_get_form_topic_subscribed', $checked, $topic_subscribed);
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:39,代码来源:template.php


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