本文整理汇总了PHP中bbp_get_topic_author_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_topic_author_id函数的具体用法?PHP bbp_get_topic_author_id怎么用?PHP bbp_get_topic_author_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_topic_author_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: td_bbp_change_avatar_size
function td_bbp_change_avatar_size($author_avatar, $topic_id, $size)
{
$author_avatar = '';
if ($size == 14) {
$size = 40;
}
$topic_id = bbp_get_topic_id($topic_id);
if (!empty($topic_id)) {
if (!bbp_is_topic_anonymous($topic_id)) {
$author_avatar = get_avatar(bbp_get_topic_author_id($topic_id), $size);
} else {
$author_avatar = get_avatar(get_post_meta($topic_id, '_bbp_anonymous_email', true), $size);
}
}
return $author_avatar;
}
示例2: test_bbp_get_topic_author_id
/**
* @covers ::bbp_topic_author_id
* @covers ::bbp_get_topic_author_id
*/
public function test_bbp_get_topic_author_id()
{
$u = $this->factory->user->create();
$t = $this->factory->topic->create(array('post_author' => $u));
$topic = bbp_get_topic_author_id($t);
$this->assertSame($u, $topic);
}
示例3: bbps_voting_is_admin
function bbps_voting_is_admin()
{
global $current_user;
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
$topic_author_id = bbp_get_topic_author_id();
$permissions = get_option('_bbps_status_permissions');
$can_edit = "";
//check the users permission this is easy
if ($permissions['admin'] == 1 && current_user_can('administrator') || $permissions['mod'] == 1 && current_user_can('bbp_moderator')) {
$can_edit = true;
}
return $can_edit;
}
示例4: new_reply
/**
* New Reply
* @since 0.1
* @version 1.5
*/
public function new_reply($reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author)
{
// Check if user is excluded
if ($this->core->exclude_user($reply_author)) {
return;
}
// Check if topic author gets points for their own replies
if ((bool) $this->prefs['new_reply']['author'] === false && bbp_get_topic_author_id($topic_id) == $reply_author) {
return;
}
// Limit
if ($this->over_hook_limit('new_reply', 'new_forum_reply', $reply_author)) {
return;
}
// Make sure this is unique event
if ($this->has_entry('new_forum_reply', $reply_id, $reply_author)) {
return;
}
// Execute
$this->core->add_creds('new_forum_reply', $reply_author, $this->prefs['new_reply']['creds'], $this->prefs['new_reply']['log'], $reply_id, array('ref_type' => 'post'), $this->mycred_type);
}
示例5: subscription_email
/**
* Sends the new reply notification email to moderators on private replies
*
* @since 1.2
*
* @param $message string The email message
* @param $reply_id int The ID of the reply
* @param $topic_id int The ID of the reply's topic
*
* @return void
*/
public function subscription_email($message, $reply_id, $topic_id)
{
if (!$this->is_private($reply_id)) {
return false;
// reply isn't private so do nothing
}
$topic_author = bbp_get_topic_author_id($topic_id);
$reply_author = bbp_get_reply_author_id($reply_id);
$reply_author_name = bbp_get_reply_author_display_name($reply_id);
// Strip tags from text and setup mail data
$topic_title = strip_tags(bbp_get_topic_title($topic_id));
$reply_content = strip_tags(bbp_get_reply_content($reply_id));
$reply_url = bbp_get_reply_url($reply_id);
$blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$do_not_reply = '<noreply@' . ltrim(get_home_url(), '^(http|https)://') . '>';
$subject = apply_filters('bbp_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $reply_id, $topic_id);
// Array to hold BCC's
$headers = array();
// Setup the From header
$headers[] = 'From: ' . get_bloginfo('name') . ' ' . $do_not_reply;
// Get topic subscribers and bail if empty
$user_ids = bbp_get_topic_subscribers($topic_id, true);
if (empty($user_ids)) {
return false;
}
// Loop through users
foreach ((array) $user_ids as $user_id) {
// Don't send notifications to the person who made the post
if (!empty($reply_author) && (int) $user_id === (int) $reply_author) {
continue;
}
if (user_can($user_id, 'moderate') || (int) $topic_author === (int) $user_id) {
// Get email address of subscribed user
$headers[] = 'Bcc: ' . get_userdata($user_id)->user_email;
}
}
wp_mail($do_not_reply, $subject, $message, $headers);
}
示例6: attributes_metabox_save
/**
* Pass the topic attributes for processing
*
* @since 2.0.0 bbPress (r2746)
*
* @param int $topic_id Topic id
* @uses current_user_can() To check if the current user is capable of
* editing the topic
* @uses do_action() Calls 'bbp_topic_attributes_metabox_save' with the
* topic id and parent id
* @return int Parent id
*/
public function attributes_metabox_save($topic_id)
{
if ($this->bail()) {
return $topic_id;
}
// Bail if doing an autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $topic_id;
}
// Bail if not a post request
if (!bbp_is_post_request()) {
return $topic_id;
}
// Nonce check
if (empty($_POST['bbp_topic_metabox']) || !wp_verify_nonce($_POST['bbp_topic_metabox'], 'bbp_topic_metabox_save')) {
return $topic_id;
}
// Bail if current user cannot edit this topic
if (!current_user_can('edit_topic', $topic_id)) {
return $topic_id;
}
// Get the forum ID
$forum_id = !empty($_POST['parent_id']) ? (int) $_POST['parent_id'] : 0;
// Get topic author data
$anonymous_data = bbp_filter_anonymous_post_data();
$author_id = bbp_get_topic_author_id($topic_id);
$is_edit = isset($_POST['hidden_post_status']) && $_POST['hidden_post_status'] !== 'draft';
// Formally update the topic
bbp_update_topic($topic_id, $forum_id, $anonymous_data, $author_id, $is_edit);
// Stickies
if (!empty($_POST['bbp_stick_topic']) && in_array($_POST['bbp_stick_topic'], array('stick', 'super', 'unstick'))) {
// What's the haps?
switch ($_POST['bbp_stick_topic']) {
// Sticky in this forum
case 'stick':
bbp_stick_topic($topic_id);
break;
// Super sticky in all forums
// Super sticky in all forums
case 'super':
bbp_stick_topic($topic_id, true);
break;
// Normal
// Normal
case 'unstick':
default:
bbp_unstick_topic($topic_id);
break;
}
}
// Allow other fun things to happen
do_action('bbp_topic_attributes_metabox_save', $topic_id, $forum_id);
do_action('bbp_author_metabox_save', $topic_id, $anonymous_data);
return $topic_id;
}
示例7: save_meta_boxes
/**
* Pass the topic attributes for processing
*
* @since 2.0.0 bbPress (r2746)
*
* @param int $topic_id Topic id
* @uses current_user_can() To check if the current user is capable of
* editing the topic
* @uses do_action() Calls 'bbp_topic_attributes_metabox_save' with the
* topic id and parent id
* @return int Parent id
*/
public function save_meta_boxes($topic_id)
{
if ($this->bail()) {
return $topic_id;
}
// Bail if doing an autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $topic_id;
}
// Bail if not a post request
if (!bbp_is_post_request()) {
return $topic_id;
}
// Nonce check
if (empty($_POST['bbp_topic_metabox']) || !wp_verify_nonce($_POST['bbp_topic_metabox'], 'bbp_topic_metabox_save')) {
return $topic_id;
}
// Bail if current user cannot edit this topic
if (!current_user_can('edit_topic', $topic_id)) {
return $topic_id;
}
// Get the forum ID
$forum_id = !empty($_POST['parent_id']) ? (int) $_POST['parent_id'] : 0;
// Get topic author data
$anonymous_data = bbp_filter_anonymous_post_data();
$author_id = bbp_get_topic_author_id($topic_id);
$is_edit = isset($_POST['hidden_post_status']) && $_POST['hidden_post_status'] !== 'draft';
// Formally update the topic
bbp_update_topic($topic_id, $forum_id, $anonymous_data, $author_id, $is_edit);
// Allow other fun things to happen
do_action('bbp_topic_attributes_metabox_save', $topic_id, $forum_id);
do_action('bbp_author_metabox_save', $topic_id, $anonymous_data);
return $topic_id;
}
示例8: bbp_get_topic_class
/**
* Return the row class of a topic
*
* @since 2.0.0 bbPress (r2667)
*
* @param int $topic_id Optional. Topic id
* @param array Extra classes you can pass when calling this function
* @uses bbp_is_topic_sticky() To check if the topic is a sticky
* @uses bbp_is_topic_super_sticky() To check if the topic is a super sticky
* @uses bbp_get_topic_forum_id() To get the topic forum id
* @uses get_post_class() To get the topic classes
* @uses apply_filters() Calls 'bbp_get_topic_class' with the classes
* and topic id
* @return string Row class of a topic
*/
function bbp_get_topic_class($topic_id = 0, $classes = array())
{
$bbp = bbpress();
$topic_id = bbp_get_topic_id($topic_id);
$count = isset($bbp->topic_query->current_post) ? $bbp->topic_query->current_post : 1;
$classes = (array) $classes;
$classes[] = (int) $count % 2 ? 'even' : 'odd';
$classes[] = bbp_is_topic_sticky($topic_id, false) ? 'sticky' : '';
$classes[] = bbp_is_topic_super_sticky($topic_id) ? 'super-sticky' : '';
$classes[] = 'bbp-parent-forum-' . bbp_get_topic_forum_id($topic_id);
$classes[] = 'user-id-' . bbp_get_topic_author_id($topic_id);
$classes = array_filter($classes);
$classes = get_post_class($classes, $topic_id);
$classes = apply_filters('bbp_get_topic_class', $classes, $topic_id);
$retval = 'class="' . implode(' ', $classes) . '"';
return $retval;
}
示例9: bbp_template_include_theme_compat
//.........这里部分代码省略.........
$page = bbp_get_page_by_path(bbp_get_topic_archive_slug());
// Should we replace the content...
if (empty($page->post_content)) {
$new_content = $bbp_shortcodes->display_topic_index();
// ...or use the existing page content?
} else {
$new_content = apply_filters('the_content', $page->post_content);
}
// Should we replace the title...
if (empty($page->post_title)) {
$new_title = bbp_get_topic_archive_title();
// ...or use the existing page title?
} else {
$new_title = apply_filters('the_title', $page->post_title);
}
// Reset post
bbp_theme_compat_reset_post(array('ID' => !empty($page->ID) ? $page->ID : 0, 'post_title' => bbp_get_topic_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed'));
// Single Topic
} elseif (bbp_is_topic_edit() || bbp_is_single_topic()) {
// Split
if (bbp_is_topic_split()) {
$new_content = bbp_buffer_template_part('form', 'topic-split', false);
// Merge
} elseif (bbp_is_topic_merge()) {
$new_content = bbp_buffer_template_part('form', 'topic-merge', false);
// Edit
} elseif (bbp_is_topic_edit()) {
$new_content = $bbp_shortcodes->display_topic_form();
// Single
} else {
$new_content = $bbp_shortcodes->display_topic(array('id' => bbp_get_topic_id()));
}
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_topic_id(), 'post_title' => bbp_get_topic_title(), 'post_author' => bbp_get_topic_author_id(), 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_topic_status(), 'is_single' => true, 'comment_status' => 'closed'));
/** Replies ***********************************************************/
// Reply archive
} elseif (is_post_type_archive(bbp_get_reply_post_type())) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Replies', 'bbpress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_reply_index(), 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
// Single Reply
} elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
// Move
if (bbp_is_reply_move()) {
$new_content = bbp_buffer_template_part('form', 'reply-move', false);
// Edit
} elseif (bbp_is_reply_edit()) {
$new_content = $bbp_shortcodes->display_reply_form();
// Single
} else {
$new_content = $bbp_shortcodes->display_reply(array('id' => get_the_ID()));
}
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_reply_id(), 'post_title' => bbp_get_reply_title(), 'post_author' => bbp_get_reply_author_id(), 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_reply_status(), 'comment_status' => 'closed'));
/** Views *************************************************************/
} elseif (bbp_is_single_view()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_view_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_view(array('id' => get_query_var(bbp_get_view_rewrite_id()))), 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
/** Search ************************************************************/
} elseif (bbp_is_search()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_search_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_search(array('search' => get_query_var(bbp_get_search_rewrite_id()))), 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
/** Topic Tags ********************************************************/
// Topic Tag Edit
} elseif (bbp_is_topic_tag_edit() || bbp_is_topic_tag()) {
// Stash the current term in a new var
set_query_var('bbp_topic_tag', get_query_var('term'));
示例10: bbps_modify_title
function bbps_modify_title($title, $topic_id = 0)
{
$topic_id = bbp_get_topic_id($topic_id);
$title = "";
$topic_author_id = bbp_get_topic_author_id();
global $current_user;
get_currentuserinfo();
$user_id = $current_user->ID;
$claimed_user_id = get_post_meta($topic_id, '_bbps_topic_claimed', true);
if ($claimed_user_id > 0) {
$user_info = get_userdata($claimed_user_id);
$claimed_user_name = $user_info->user_login;
}
//2 is the resolved status ID
if (get_post_meta($topic_id, '_bbps_topic_status', true) == 2) {
echo '<span class="resolved"> [Resolved] </span>';
}
//we only want to display the urgent topic status to admin and moderators
if (get_post_meta($topic_id, '_bbps_urgent_topic', true) == 1 && (current_user_can('administrator') || current_user_can('bbp_moderator'))) {
echo '<span class="urgent"> [Urgent] </span>';
}
//claimed topics also only get shown to admin and moderators and the person who owns the topic
if (get_post_meta($topic_id, '_bbps_topic_claimed', true) > 0 && (current_user_can('administrator') || current_user_can('bbp_moderator') || $topic_author_id == $user_id)) {
//if this option == 1 we display the users name not [claimed]
if (get_option('_bbps_claim_topic_display') == 1) {
echo '<span class="claimed">[' . $claimed_user_name . ']</span>';
} else {
echo '<span class="claimed"> [Claimed] </span>';
}
}
}
示例11: ntwb_bbpress_topic_css_role
function ntwb_bbpress_topic_css_role()
{
$role = strtolower(bbp_get_user_display_role(bbp_get_topic_author_id($topic_id)));
$args['class'] = 'bbp-author-role bbp-author-role-' . $role;
$args['before'] = '';
$args['after'] = '';
return $args;
}
示例12: no_self_favorite
/**
* Prevent users from favoriting their own posts
* @version 2.0
*/
function no_self_favorite($html, $r, $user_id, $topic_id)
{
// Prevent a topic author from favoriting him/herself
if ($user_id == bbp_get_topic_author_id()) {
return false;
} else {
return $html;
}
}
示例13: elseif
<?php
if ($postUser->has_cap('bbp_keymaster')) {
echo "<small>(Администратор форума)</small>";
} elseif ($postUser->has_cap('bbp_moderator')) {
echo "<small>(Преподаватель)</small>";
}
?>
</div>
<div
class="date"><?php
echo get_post_time('j F ', false, bbp_get_topic_id(), true) . __('at', 'qode') . get_post_time(' H:i', false, bbp_get_topic_id(), true);
?>
</div>
</div>
<?php
if (bbp_get_topic_author_id() == get_current_user_id()) {
?>
<a href="#" class="addi_actions_open"></a>
<div class="addi_actions" style="display:none">
<ul>
<li><a class="edit_action" href="#">Редактировать</a>
</li>
<li><a class="remove_action"
href="#">Удалить</a></li>
</ul>
</div>
<?php
}
?>
</div>
<div class="single_topic_content">
示例14: bbp_decrease_user_topic_count
/**
* Helper function used to decrease (by one) the count of topics for a user when
* a topic is unpublished.
*
* @since 2.6.0 bbPress (r5309)
*
* @param $topic_id
*/
function bbp_decrease_user_topic_count($topic_id = 0)
{
$user_id = bbp_get_topic_author_id($topic_id);
return bbp_bump_user_topic_count($user_id, -1);
}
示例15: get_avatar
/**
* Retrieve the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post.
*
* @since 2.5.0
* @since 4.2.0 Optional `$args` parameter added.
*
* @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash,
* user email, WP_User object, WP_Post object, or comment object.
* @param int $size Optional. Height and width of the avatar image file in pixels. Default 96.
* @param string $default Optional. URL for the default image or a default type. Accepts '404'
* (return a 404 instead of a default image), 'retro' (8bit), 'monsterid'
* (monster), 'wavatar' (cartoon face), 'indenticon' (the "quilt"),
* 'mystery', 'mm', or 'mysterman' (The Oyster Man), 'blank' (transparent GIF),
* or 'gravatar_default' (the Gravatar logo). Default is the value of the
* 'avatar_default' option, with a fallback of 'mystery'.
* @param string $alt Optional. Alternative text to use in <img> tag. Default empty.
* @param array $args {
* Optional. Extra arguments to retrieve the avatar.
*
* @type int $height Display height of the avatar in pixels. Defaults to $size.
* @type int $width Display width of the avatar in pixels. Defaults to $size.
* @type bool $force_default Whether to always show the default image, never the Gravatar. Default false.
* @type string $rating What rating to display avatars up to. Accepts 'G', 'PG', 'R', 'X', and are
* judged in that order. Default is the value of the 'avatar_rating' option.
* @type string $scheme URL scheme to use. See set_url_scheme() for accepted values.
* Default null.
* @type array|string $class Array or string of additional classes to add to the <img> element.
* Default null.
* @type bool $force_display Whether to always show the avatar - ignores the show_avatars option.
* Default false.
* @type string $extra_attr HTML attributes to insert in the IMG element. Is not sanitized. Default empty.
* }
* @return false|string `<img>` tag for the user's avatar. False on failure.
*/
function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args = null)
{
$defaults = array('size' => 96, 'height' => null, 'width' => null, 'default' => get_option('avatar_default', 'mystery'), 'force_default' => false, 'rating' => get_option('avatar_rating'), 'scheme' => null, 'alt' => '', 'class' => null, 'force_display' => false, 'extra_attr' => '');
if (empty($args)) {
$args = array();
}
$args['size'] = (int) $size;
$args['default'] = $default;
$args['alt'] = $alt;
$args = wp_parse_args($args, $defaults);
if (empty($args['height'])) {
$args['height'] = $args['size'];
}
if (empty($args['width'])) {
$args['width'] = $args['size'];
}
/**
* Filter whether to retrieve the avatar URL early.
*
* Passing a non-null value will effectively short-circuit get_avatar(), passing
* the value through the {@see 'pre_get_avatar'} filter and returning early.
*
* @since 4.2.0
*
* @param string $avatar HTML for the user's avatar. Default null.
* @param int|object|string $id_or_email A user ID, email address, or comment object.
* @param array $args Arguments passed to get_avatar_url(), after processing.
*/
$avatar = apply_filters('pre_get_avatar', null, $id_or_email, $args);
if (!is_null($avatar)) {
/** This filter is documented in wp-includes/pluggable.php */
return apply_filters('get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args);
}
if (!$args['force_display'] && !get_option('show_avatars')) {
return false;
}
$url2x = get_avatar_url($id_or_email, array_merge($args, array('size' => $args['size'] * 2)));
$args = get_avatar_data($id_or_email, $args);
$url = $args['url'];
if (!$url || is_wp_error($url)) {
return false;
}
$class = array('avatar', 'avatar-' . (int) $args['size'], 'photo');
if (!$args['found_avatar'] || $args['force_default']) {
$class[] = 'avatar-default';
}
if ($args['class']) {
if (is_array($args['class'])) {
$class = array_merge($class, $args['class']);
} else {
$class[] = $args['class'];
}
}
// Author : John Robert jerodiaz - Roy =================================================================
$current_user = wp_get_current_user();
$current_id = $current_user->ID;
$avtar_image = get_user_meta(bbp_get_topic_author_id(), 'avtar_image');
/*$user_info = get_userdata($current_id);
$user_description = $user_info->user_description;*/
$avatar = sprintf("<img alt='%s' src='%s' srcset='%s' class='%s' height='%d' width='%d' %s/>", esc_attr($args['alt']), esc_url(isset($avtar_image[0]) ? $avtar_image[0] : ''), esc_attr("{$url2x} 2x"), esc_attr(join(' ', $class)), (int) $args['height'], (int) $args['width'], $args['extra_attr']);
// End of file by John Robert Jerodiaz =================================================================
/**
* Filter the avatar to retrieve.
*
* @since 2.5.0
* @since 4.2.0 The `$args` parameter was added.
//.........这里部分代码省略.........