本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: bbp_new_forum_handler
/**
* Handles the front end forum submission
*
* @param string $action The requested action to compare this function to
* @uses bbp_add_error() To add an error message
* @uses bbp_verify_nonce_request() To verify the nonce and check the request
* @uses bbp_is_anonymous() To check if an anonymous post is being made
* @uses current_user_can() To check if the current user can publish forum
* @uses bbp_get_current_user_id() To get the current user id
* @uses bbp_filter_anonymous_post_data() To filter anonymous data
* @uses bbp_set_current_anonymous_user_data() To set the anonymous user cookies
* @uses is_wp_error() To check if the value retrieved is a {@link WP_Error}
* @uses esc_attr() For sanitization
* @uses bbp_is_forum_category() To check if the forum is a category
* @uses bbp_is_forum_closed() To check if the forum is closed
* @uses bbp_is_forum_private() To check if the forum is private
* @uses bbp_check_for_flood() To check for flooding
* @uses bbp_check_for_duplicate() To check for duplicates
* @uses bbp_get_forum_post_type() To get the forum post type
* @uses remove_filter() To remove kses filters if needed
* @uses apply_filters() Calls 'bbp_new_forum_pre_title' with the content
* @uses apply_filters() Calls 'bbp_new_forum_pre_content' with the content
* @uses bbPress::errors::get_error_codes() To get the {@link WP_Error} errors
* @uses wp_insert_post() To insert the forum
* @uses do_action() Calls 'bbp_new_forum' with the forum id, forum id,
* anonymous data and reply author
* @uses bbp_stick_forum() To stick or super stick the forum
* @uses bbp_unstick_forum() To unstick the forum
* @uses bbp_get_forum_permalink() To get the forum permalink
* @uses wp_safe_redirect() To redirect to the forum link
* @uses bbPress::errors::get_error_messages() To get the {@link WP_Error} error
* messages
*/
function bbp_new_forum_handler($action = '')
{
// Bail if action is not bbp-new-forum
if ('bbp-new-forum' !== $action) {
return;
}
// Nonce check
if (!bbp_verify_nonce_request('bbp-new-forum')) {
bbp_add_error('bbp_new_forum_nonce', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress'));
return;
}
// Define local variable(s)
$view_all = $anonymous_data = false;
$forum_parent_id = $forum_author = 0;
$forum_title = $forum_content = '';
/** Forum Author **********************************************************/
// User cannot create forums
if (!current_user_can('publish_forums')) {
bbp_add_error('bbp_forum_permissions', __('<strong>ERROR</strong>: You do not have permission to create new forums.', 'bbpress'));
return;
}
// Forum author is current user
$forum_author = bbp_get_current_user_id();
// Remove kses filters from title and content for capable users and if the nonce is verified
if (current_user_can('unfiltered_html') && !empty($_POST['_bbp_unfiltered_html_forum']) && wp_create_nonce('bbp-unfiltered-html-forum_new') === $_POST['_bbp_unfiltered_html_forum']) {
remove_filter('bbp_new_forum_pre_title', 'wp_filter_kses');
remove_filter('bbp_new_forum_pre_content', 'bbp_encode_bad', 10);
remove_filter('bbp_new_forum_pre_content', 'bbp_filter_kses', 30);
}
/** Forum Title ***********************************************************/
if (!empty($_POST['bbp_forum_title'])) {
$forum_title = esc_attr(strip_tags($_POST['bbp_forum_title']));
}
// Filter and sanitize
$forum_title = apply_filters('bbp_new_forum_pre_title', $forum_title);
// No forum title
if (empty($forum_title)) {
bbp_add_error('bbp_forum_title', __('<strong>ERROR</strong>: Your forum needs a title.', 'bbpress'));
}
/** Forum Content *********************************************************/
if (!empty($_POST['bbp_forum_content'])) {
$forum_content = $_POST['bbp_forum_content'];
}
// Filter and sanitize
$forum_content = apply_filters('bbp_new_forum_pre_content', $forum_content);
// No forum content
if (empty($forum_content)) {
bbp_add_error('bbp_forum_content', __('<strong>ERROR</strong>: Your forum description cannot be empty.', 'bbpress'));
}
/** Forum Parent **********************************************************/
// Forum parent was passed (the norm)
if (!empty($_POST['bbp_forum_parent_id'])) {
$forum_parent_id = bbp_get_forum_id($_POST['bbp_forum_parent_id']);
}
// Filter and sanitize
$forum_parent_id = apply_filters('bbp_new_forum_pre_parent_id', $forum_parent_id);
// No forum parent was passed (should never happen)
if (empty($forum_parent_id)) {
bbp_add_error('bbp_new_forum_missing_parent', __('<strong>ERROR</strong>: Your forum must have a parent.', 'bbpress'));
// Forum exists
} elseif (!empty($forum_parent_id)) {
// Forum is a category
if (bbp_is_forum_category($forum_parent_id)) {
bbp_add_error('bbp_new_forum_forum_category', __('<strong>ERROR</strong>: This forum is a category. No forums can be created in this forum.', 'bbpress'));
}
// Forum is closed and user cannot access
if (bbp_is_forum_closed($forum_parent_id) && !current_user_can('edit_forum', $forum_parent_id)) {
//.........这里部分代码省略.........
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:101,代码来源:functions.php
示例17: widget
//.........这里部分代码省略.........
<a href="<?php
echo esc_url($settings['register']);
?>
" title="<?php
esc_attr_e('Register', 'bbpress');
?>
" class="bbp-register-link btn btn-default"><span class="glyphicon ipt-icomoon-signup"></span> <?php
_e('Register', 'bbpress');
?>
</a>
<?php
}
?>
<button class="btn btn-primary" type="submit" name="user-submit" id="user-submit" tabindex="<?php
bbp_tab_index();
?>
" class="button submit user-submit"><span class="glyphicon ipt-icomoon-switch"></span> <?php
_e('Log In', 'bbpress');
?>
</button>
</div>
<?php
bbp_user_login_fields();
?>
</fieldset>
</form>
<?php
} else {
?>
<div class="bbp-logged-in">
<a href="<?php
bbp_user_profile_url(bbp_get_current_user_id());
?>
" class="submit user-submit thumbnail pull-left"><?php
echo get_avatar(bbp_get_current_user_id(), '64');
?>
</a>
<h4><?php
bbp_user_profile_link(bbp_get_current_user_id());
?>
</h4>
<div class="btn-group">
<a class="btn btn-default btn-sm" href="<?php
bbp_user_profile_edit_url(bbp_get_current_user_id());
?>
" title="<?php
printf(esc_attr__("Edit Your Profile", 'ipt_kb'));
?>
"><span class="glyphicon glyphicon-edit"></span> <?php
_e('Edit', 'bbpress');
?>
</a>
<?php
bbp_logout_link();
?>
</div>
<div class="clearfix"></div>
<div class="list-group">
<a href="<?php
bbp_user_profile_url(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-forum-role <?php
开发者ID:andychoi,项目名称:k-knowledgebase-theme-wp,代码行数:67,代码来源:class-ipt-kb-bbp-login-widget.php
示例18: bbp_is_user_inactive
/**
* Checks if user is not active.
*
* @since bbPress (r3502)
*
* @uses is_user_logged_in() To check if user is logged in
* @uses bbp_get_displayed_user_id() To get current user ID
* @uses bbp_is_user_active() To check if user is active
*
* @param int $user_id The user ID to check. Defaults to current user ID
* @return bool True if inactive, false if active
*/
function bbp_is_user_inactive($user_id = 0)
{
// Default to current user
if (empty($user_id) && is_user_logged_in()) {
$user_id = bbp_get_current_user_id();
}
// No user to check
if (empty($user_id)) {
return false;
}
// Return the inverse of active
return !bbp_is_user_active($user_id);
}
开发者ID:hscale,项目名称:webento,代码行数:25,代码来源:bbp-user-functions.php
示例19: widget
//.........这里部分代码省略.........
<div class="bbp-submit-wrapper">
<?php
do_action('login_form');
?>
<button type="submit" name="user-submit" id="user-submit" tabindex="<?php
bbp_tab_index();
?>
" class="button submit user-submit"><?php
_e('Log In', 'bbpress');
?>
</button>
<?php
bbp_user_login_fields();
?>
</div>
<?php
if (!empty($register) || !empty($lostpass)) {
?>
<div class="bbp-login-links">
<?php
if (!empty($register)) {
?>
<a href="<?php
echo esc_url($register);
?>
" title="<?php
_e('Register', 'bbpress');
?>
" class="bbp-register-link"><?php
_e('Register', 'bbpress');
?>
</a>
<?php
}
?>
<?php
if (!empty($lostpass)) {
?>
<a href="<?php
echo esc_url($lostpass);
?>
" title="<?php
_e('Lost Password', 'bbpress');
?>
" class="bbp-lostpass-link"><?php
_e('Lost Password', 'bbpress');
?>
</a>
<?php
}
?>
</div>
<?php
}
?>
</fieldset>
</form>
<?php
} else {
?>
<div class="bbp-logged-in">
<a href="<?php
bbp_user_profile_url(bbp_get_current_user_id());
?>
" class="submit user-submit"><?php
echo get_avatar(bbp_get_current_user_id(), '40');
?>
</a>
<h4><?php
bbp_user_profile_link(bbp_get_current_user_id());
?>
</h4>
<?php
bbp_logout_link();
?>
</div>
<?php
}
echo $after_widget;
}
开发者ID:rmccue,项目名称:bbPress,代码行数:101,代码来源:bbp-core-widgets.php
示例20: ajax_subscription
/**
* Subscribe/Unsubscribe a user from a topic
*
* @since bbPress (r3732)
*
* @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
*/
public function ajax_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');
}
$topic = bbp_get_topic($id);
if (empty($topic)) {
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:philtrimble,项目名称:GCFB-Portal-Theme---Main,代码行数:42,代码来源:bbpress-functions.php
注:本文中的bbp_get_current_user_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论