本文整理汇总了PHP中bbp_get_reply_author_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_reply_author_id函数的具体用法?PHP bbp_get_reply_author_id怎么用?PHP bbp_get_reply_author_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_reply_author_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: kleo_bbp_add_role_class
function kleo_bbp_add_role_class($author_role, $r)
{
$reply_id = bbp_get_reply_id($r['reply_id']);
$role = strtolower(esc_attr(bbp_get_user_display_role(bbp_get_reply_author_id($reply_id))));
$author_role = str_replace('class="', 'class="role-' . $role . ' ', $author_role);
return $author_role;
}
示例2: origamiez_bbpress_shortcodes
function origamiez_bbpress_shortcodes($content, $reply_id)
{
$reply_author = bbp_get_reply_author_id($reply_id);
if (user_can($reply_author, 'publish_forums')) {
$content = do_shortcode($content);
}
return $content;
}
示例3: test_bbp_get_reply_author_id
/**
* @covers ::bbp_reply_author_id
* @covers ::bbp_get_reply_author_id
*/
public function test_bbp_get_reply_author_id()
{
$u = $this->factory->user->create();
$t = $this->factory->topic->create();
$r = $this->factory->reply->create(array('post_parent' => $t, 'post_author' => $u, 'reply_meta' => array('topic_id' => $t)));
$reply = bbp_get_reply_author_id($r);
$this->assertSame($u, $reply);
}
示例4: pw_bbp_shortcodes
function pw_bbp_shortcodes($content, $reply_id)
{
$reply_author = bbp_get_reply_author_id($reply_id);
if (user_can($reply_author, pw_bbp_parse_capability())) {
return do_shortcode($content);
}
return $content;
}
示例5: site__bbpress_bbp_theme_after_reply_author_details
function site__bbpress_bbp_theme_after_reply_author_details()
{
$twitter = get_user_meta(bbp_get_reply_author_id(), 'twitter', true);
if (preg_match("|https?://(www\\.)?twitter\\.com/(#!/)?@?([^/]*)|", $twitter, $matches)) {
$twitter_username = $matches[3];
} else {
$twitter_username = ltrim(get_user_meta(bbp_get_reply_author_id(), 'twitter', true), '@');
}
if (!empty($twitter_username)) {
echo '<a href="https://twitter.com/' . $twitter_username . '" target="_blank"><i class="fa fa-twitter"></i> ' . $twitter_username . '</a>';
}
}
示例6: bbp_user_online_status
function bbp_user_online_status()
{
global $bbpuos_options;
echo '<ul>';
$user_id = bbp_get_reply_author_id($reply_id);
if ($bbpuos_options['activate'] == true) {
echo '<li>';
if (is_user_online($user_id)) {
echo "Online";
} else {
echo "Offline";
}
echo '</li>';
}
}
示例7: append_message_trigger
function append_message_trigger($author_link, $r)
{
//we need to make sure it is a reply
if (!bbp_get_reply_id()) {
return $author_link;
}
wp_enqueue_script('popoverasync', ig_uploader()->plugin_url . 'assets/popover/popoverasync.js', array('jquery', 'ig-bootstrap', 'jquery-frame-transport'));
wp_enqueue_style('igu-uploader', ig_uploader()->plugin_url . 'assets/style.css');
$new_links = explode($r['sep'], $author_link);
$author_id = bbp_get_reply_author_id(bbp_get_reply_id($r['post_id']));
$message_link = do_shortcode("[pm_user user_id={$author_id} class='btn btn-xs btn-primary']");
$message_link = sprintf('<div style="%s">%s</div>', 'margin-top:5px', $message_link);
array_splice($new_links, 1, 0, array($message_link));
$new_links = implode($r['sep'], $new_links);
//$logger = new IG_Logger('file', 'message_bbpress.txt');
//$logger->log(var_export($new_links, true), IG_Logger::ERROR_LEVEL_DEBUG);
return $new_links;
}
示例8: bbp_template_include_theme_compat
/**
* Reset main query vars and filter 'the_content' to output a bbPress
* template part as needed.
*
* @since bbPress (r3032)
* @param string $template
* @uses bbp_is_single_user() To check if page is single user
* @uses bbp_get_single_user_template() To get user template
* @uses bbp_is_single_user_edit() To check if page is single user edit
* @uses bbp_get_single_user_edit_template() To get user edit template
* @uses bbp_is_single_view() To check if page is single view
* @uses bbp_get_single_view_template() To get view template
* @uses bbp_is_forum_edit() To check if page is forum edit
* @uses bbp_get_forum_edit_template() To get forum edit template
* @uses bbp_is_topic_merge() To check if page is topic merge
* @uses bbp_get_topic_merge_template() To get topic merge template
* @uses bbp_is_topic_split() To check if page is topic split
* @uses bbp_get_topic_split_template() To get topic split template
* @uses bbp_is_topic_edit() To check if page is topic edit
* @uses bbp_get_topic_edit_template() To get topic edit template
* @uses bbp_is_reply_edit() To check if page is reply edit
* @uses bbp_get_reply_edit_template() To get reply edit template
* @uses bbp_set_theme_compat_template() To set the global theme compat template
*/
function bbp_template_include_theme_compat($template = '')
{
// Bail if the template already matches a bbPress template. This includes
// archive-* and single-* WordPress post_type matches (allowing
// themes to use the expected format) as well as all bbPress-specific
// template files for users, topics, forums, etc...
if (!empty(bbpress()->theme_compat->bbpress_template)) {
return $template;
}
/** Users *************************************************************/
if (bbp_is_single_user_edit() || bbp_is_single_user()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => '', 'post_title' => esc_attr(bbp_get_displayed_user_field('display_name')), 'post_status' => bbp_get_public_status_id(), 'is_archive' => false, 'comment_status' => 'closed'));
/** Forums ************************************************************/
// Forum archive
} elseif (bbp_is_forum_archive()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_forum_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed'));
// Single Forum
} elseif (bbp_is_forum_edit() || bbp_is_single_forum()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_forum_id(), 'post_title' => bbp_get_forum_title(), 'post_author' => bbp_get_forum_author_id(), 'post_date' => 0, 'post_content' => get_post_field('post_content', bbp_get_forum_id()), 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_forum_visibility(), 'is_single' => true, 'comment_status' => 'closed'));
/** Topics ************************************************************/
// Topic archive
} elseif (bbp_is_topic_archive()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_topic_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_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()) {
// 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' => get_post_field('post_content', bbp_get_topic_id()), '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' => '', '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()) {
// 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' => get_post_field('post_content', bbp_get_reply_id()), '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' => '', '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'));
// Reset the post with our new title
bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => '', 'post_title' => sprintf(__('Topic Tag: %s', 'bbpress'), '<span>' . bbp_get_topic_tag_name() . '</span>'), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
}
/**
* If we are relying on bbPress's built in theme compatibility to load
* the proper content, we need to intercept the_content, replace the
* output, and display ours instead.
*
* To do this, we first remove all filters from 'the_content' and hook
* our own function into it, which runs a series of checks to determine
* the context, and then uses the built in shortcodes to output the
* correct results from inside an output buffer.
*
* Uses bbp_get_theme_compat_templates() to provide fall-backs that
* should be coded without superfluous mark-up and logic (prev/next
* navigation, comments, date/time, etc...)
*
* Hook into the 'bbp_get_bbpress_template' to override the array of
* possible templates, or 'bbp_bbpress_template' to override the result.
*/
if (bbp_is_theme_compat_active()) {
// Remove all filters from the_content
bbp_remove_all_filters('the_content');
// Add a filter on the_content late, which we will later remove
add_filter('the_content', 'bbp_replace_the_content');
// Find the appropriate template file
$template = bbp_get_theme_compat_templates();
//.........这里部分代码省略.........
示例9: bbp_get_reply_class
/**
* Return the row class of a reply
*
* @since bbPress (r2678)
*
* @param int $reply_id Optional. Reply ID
* @param array Extra classes you can pass when calling this function
* @uses bbp_get_reply_id() To validate the reply id
* @uses bbp_get_reply_forum_id() To get the reply's forum id
* @uses bbp_get_reply_topic_id() To get the reply's topic id
* @uses get_post_class() To get all the classes including ours
* @uses apply_filters() Calls 'bbp_get_reply_class' with the classes
* @return string Row class of the reply
*/
function bbp_get_reply_class($reply_id = 0, $classes = array())
{
$bbp = bbpress();
$reply_id = bbp_get_reply_id($reply_id);
$count = isset($bbp->reply_query->current_post) ? $bbp->reply_query->current_post : 1;
$classes = (array) $classes;
$classes[] = (int) $count % 2 ? 'even' : 'odd';
$classes[] = 'bbp-parent-forum-' . bbp_get_reply_forum_id($reply_id);
$classes[] = 'bbp-parent-topic-' . bbp_get_reply_topic_id($reply_id);
$classes[] = 'bbp-reply-position-' . bbp_get_reply_position($reply_id);
$classes[] = 'user-id-' . bbp_get_reply_author_id($reply_id);
$classes[] = bbp_get_reply_author_id($reply_id) === bbp_get_topic_author_id(bbp_get_reply_topic_id($reply_id)) ? 'topic-author' : '';
$classes = array_filter($classes);
$classes = get_post_class($classes, $reply_id);
$classes = apply_filters('bbp_get_reply_class', $classes, $reply_id);
$retval = 'class="' . implode(' ', $classes) . '"';
return $retval;
}
示例10: reply_update
/**
* Update the activity stream entry when a reply status changes
*
* @param int $post_id
* @param obj $post
* @uses get_post_type()
* @uses bbp_get_reply_post_type()
* @uses bbp_get_reply_id()
* @uses bbp_is_reply_anonymous()
* @uses bbp_get_public_status_id()
* @uses bbp_get_closed_status_id()
* @uses bbp_get_reply_topic_id()
* @uses bbp_get_reply_forum_id()
* @uses bbp_get_reply_author_id()
* @return Bail early if not a reply, or reply is by anonymous user
*/
public function reply_update($reply_id, $post)
{
// Bail early if not a reply
if (get_post_type($post) != bbp_get_reply_post_type()) {
return;
}
$reply_id = bbp_get_reply_id($reply_id);
// Bail early if reply is by anonymous user
if (bbp_is_reply_anonymous($reply_id)) {
return;
}
$anonymous_data = array();
// Action based on new status
if ($post->post_status == bbp_get_public_status_id()) {
// Validate reply data
$topic_id = bbp_get_reply_topic_id($reply_id);
$forum_id = bbp_get_reply_forum_id($reply_id);
$reply_author_id = bbp_get_reply_author_id($reply_id);
$this->reply_create($reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author_id);
} else {
$this->reply_delete($reply_id);
}
}
示例11: bbp_edit_reply_handler
/**
* Handles the front end edit reply submission
*
* @param string $action The requested action to compare this function to
* @uses bbp_add_error() To add an error message
* @uses bbp_get_reply() To get the reply
* @uses bbp_verify_nonce_request() To verify the nonce and check the request
* @uses bbp_is_reply_anonymous() To check if the reply was by an anonymous user
* @uses current_user_can() To check if the current user can edit that reply
* @uses bbp_filter_anonymous_post_data() To filter anonymous data
* @uses is_wp_error() To check if the value retrieved is a {@link WP_Error}
* @uses remove_filter() To remove kses filters if needed
* @uses esc_attr() For sanitization
* @uses apply_filters() Calls 'bbp_edit_reply_pre_title' with the title and
* reply id
* @uses apply_filters() Calls 'bbp_edit_reply_pre_content' with the content
* reply id
* @uses wp_set_post_terms() To set the topic tags
* @uses bbp_has_errors() To get the {@link WP_Error} errors
* @uses wp_save_post_revision() To save a reply revision
* @uses bbp_update_reply_revision_log() To update the reply revision log
* @uses wp_update_post() To update the reply
* @uses bbp_get_reply_topic_id() To get the reply topic id
* @uses bbp_get_topic_forum_id() To get the topic forum id
* @uses bbp_get_reply_to() To get the reply to id
* @uses do_action() Calls 'bbp_edit_reply' with the reply id, topic id, forum
* id, anonymous data, reply author, bool true (for edit),
* and the reply to id
* @uses bbp_get_reply_url() To get the paginated url to the reply
* @uses wp_safe_redirect() To redirect to the reply url
* @uses bbPress::errors::get_error_message() To get the {@link WP_Error} error
* message
*/
function bbp_edit_reply_handler($action = '')
{
// Bail if action is not bbp-edit-reply
if ('bbp-edit-reply' !== $action) {
return;
}
// Define local variable(s)
$revisions_removed = false;
$reply = $reply_id = $reply_author = $topic_id = $forum_id = $anonymous_data = 0;
$reply_title = $reply_content = $reply_edit_reason = $terms = '';
/** Reply *****************************************************************/
// Reply id was not passed
if (empty($_POST['bbp_reply_id'])) {
bbp_add_error('bbp_edit_reply_id', __('<strong>ERROR</strong>: Reply ID not found.', 'bbpress'));
return;
// Reply id was passed
} elseif (is_numeric($_POST['bbp_reply_id'])) {
$reply_id = (int) $_POST['bbp_reply_id'];
$reply = bbp_get_reply($reply_id);
}
// Nonce check
if (!bbp_verify_nonce_request('bbp-edit-reply_' . $reply_id)) {
bbp_add_error('bbp_edit_reply_nonce', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress'));
return;
}
// Reply does not exist
if (empty($reply)) {
bbp_add_error('bbp_edit_reply_not_found', __('<strong>ERROR</strong>: The reply you want to edit was not found.', 'bbpress'));
return;
// Reply exists
} else {
// Check users ability to create new reply
if (!bbp_is_reply_anonymous($reply_id)) {
// User cannot edit this reply
if (!current_user_can('edit_reply', $reply_id)) {
bbp_add_error('bbp_edit_reply_permissions', __('<strong>ERROR</strong>: You do not have permission to edit that reply.', 'bbpress'));
return;
}
// Set reply author
$reply_author = bbp_get_reply_author_id($reply_id);
// It is an anonymous post
} else {
// Filter anonymous data
$anonymous_data = bbp_filter_anonymous_post_data();
}
}
// 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_reply']) && wp_create_nonce('bbp-unfiltered-html-reply_' . $reply_id) === $_POST['_bbp_unfiltered_html_reply']) {
remove_filter('bbp_edit_reply_pre_title', 'wp_filter_kses');
remove_filter('bbp_edit_reply_pre_content', 'bbp_encode_bad', 10);
remove_filter('bbp_edit_reply_pre_content', 'bbp_filter_kses', 30);
}
/** Reply Topic ***********************************************************/
$topic_id = bbp_get_reply_topic_id($reply_id);
/** Topic Forum ***********************************************************/
$forum_id = bbp_get_topic_forum_id($topic_id);
// Forum exists
if (!empty($forum_id) && $forum_id !== bbp_get_reply_forum_id($reply_id)) {
// Forum is a category
if (bbp_is_forum_category($forum_id)) {
bbp_add_error('bbp_edit_reply_forum_category', __('<strong>ERROR</strong>: This forum is a category. No replies can be created in this forum.', 'bbpress'));
// Forum is not a category
} else {
// Forum is closed and user cannot access
if (bbp_is_forum_closed($forum_id) && !current_user_can('edit_forum', $forum_id)) {
bbp_add_error('bbp_edit_reply_forum_closed', __('<strong>ERROR</strong>: This forum has been closed to new replies.', 'bbpress'));
}
//.........这里部分代码省略.........
示例12: add_author_post_date_count_ip
/**
* Add post date, author post count and author ip to the author element.
*/
public function add_author_post_date_count_ip()
{
?>
<div class="bbp-reply-post-date"><?php
bbp_reply_post_date(bbp_get_reply_id());
?>
</div>
<div class="bbps-post-count"><?php
printf(__('Post count: %s', 'Avada'), bbp_get_user_reply_count_raw(bbp_get_reply_author_id()) + bbp_get_user_topic_count_raw(bbp_get_reply_author_id()));
?>
</div>
<?php
if (bbp_is_user_keymaster()) {
?>
<?php
do_action('bbp_theme_before_topic_author_admin_details');
?>
<div class="bbp-reply-ip fusion-reply-id"><?php
bbp_author_ip(bbp_get_topic_id());
?>
</div>
<?php
do_action('bbp_theme_after_topic_author_admin_details');
?>
<?php
}
}
示例13: Apoc_User
<?php
/**
* Apocrypha Theme Forum Single Reply
* Andrew Clayton
* Version 2.0
* 7-22-2014
*/
// Get the reply author object
$author = new Apoc_User(bbp_get_reply_author_id(), 'reply');
?>
<li id="post-<?php
bbp_reply_id();
?>
" class="reply">
<header class="reply-header">
<time class="reply-time" datetime="<?php
echo get_the_time('Y-m-d\\TH:i');
?>
"><?php
echo bp_core_time_since(strtotime(get_the_time('c')), current_time('timestamp'));
?>
</time>
<?php
apoc_report_post_button('reply');
?>
<div class="reply-admin-links">
<?php
示例14: bbp_display_badge
/**
* Display the Support status of an User under his replies or topics in the Forum
**/
function bbp_display_badge()
{
$user_id = bbp_get_reply_author_id();
/*$caps = get_user_meta($user_id, 'wp_capabilities', true);
$roles = array_keys((array)$caps);
if (strtolower($roles[0]) == 'keymaster' || strtolower($roles[0]) == 'administrator' || strtolower($roles[0]) == 'moderator') {
return;
}
*/
$dat = get_userdata($user_id);
$roles = implode(', ', $dat->roles);
if (strpos(strtolower($roles), 'keymaster') !== false || strpos(strtolower($roles), 'administrator') !== false || strpos(strtolower($roles), 'moderator') !== false) {
return;
}
px_verify_badge_style();
$buy_date = get_user_meta($user_id, 'px_envato_purchase_date');
// $support_amount = get_user_meta( $user_id, 'px_envato_support_amount'); NOT WORKING YET
// $support_until = get_user_meta( $user_id, 'px_envato_support_until');
// Calculate the if support is valid
if (isset($buy_date[0]) && $buy_date[0] != 0) {
$short_date = explode('T', $buy_date[0]);
$short_date = $short_date[0];
$date1 = new DateTime($short_date);
$date2 = new DateTime(current_time('Y-m-d'));
$interval = $date1->diff($date2);
if ($interval->days <= 182) {
$supported = 1;
} else {
$supported = 2;
}
} else {
if (strpos(strtolower($roles), 'blocked') !== false) {
$supported = 3;
} else {
$supported = 4;
}
}
if ($supported == 1) {
?>
<div id="user-badge-<?php
echo $user_id;
?>
" class="badge-supported">
Supported
</div>
<?php
} else {
if ($supported == 2) {
?>
<div id="user-badge-<?php
echo $user_id;
?>
" class="badge-unsupported">
Support Expired
</div>
<?php
} else {
if ($supported == 3) {
?>
<div id="user-badge-<?php
echo $user_id;
?>
" class="badge-blocked">
Blocked
</div>
<?php
} else {
if ($supported == 4) {
?>
<div id="user-badge-<?php
echo $user_id;
?>
" class="badge-unknowen">
Unknowen Support Status
</div>
<?php
}
}
}
}
}
示例15: insert_rank_bb_reply
/**
* Insert Rank In bbPress Reply
* @since 1.6
* @version 1.0
*/
public function insert_rank_bb_reply()
{
$output = '';
$user_id = bbp_get_reply_author_id();
if ($user_id == 0) {
return;
}
foreach ($this->point_types as $type_id => $label) {
// Load type
$mycred = mycred($type_id);
// User is excluded from this type
if ($mycred->exclude_user($user_id)) {
continue;
}
// No settings
if (!isset($mycred->rank['bp_location'])) {
continue;
}
// Not shown
if (!in_array($mycred->rank['bp_location'], array('reply', 'both'))) {
continue;
}
// Get rank (if user has one
$users_rank = mycred_get_users_rank_id($user_id, $type_id);
if ($users_rank === NULL) {
continue;
}
// Parse template
$template = $mycred->rank['bp_template'];
$template = str_replace('%rank_title%', get_the_title($users_rank), $template);
$template = str_replace('%rank_logo%', mycred_get_rank_logo($users_rank), $template);
// Let others play
$output .= apply_filters('mycred_bb_reply_ranks_row', $template, $user_id, $users_rank, $mycred, $this);
}
if ($output == '') {
return;
}
echo '<div id="mycred-my-rank">' . apply_filters('mycred_bb_rank_in_reply', $output, $user_id, $this) . '</div>';
}