本文整理汇总了PHP中bbp_get_user_display_role函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_user_display_role函数的具体用法?PHP bbp_get_user_display_role怎么用?PHP bbp_get_user_display_role使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_user_display_role函数的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: bbp_get_reply_author_role
/**
* Return the reply author role
*
* @since bbPress (r3860)
*
* @param array $args Optional.
* @uses bbp_get_reply_id() To get the reply id
* @uses bbp_get_user_display_role() To get the user display role
* @uses bbp_get_reply_author_id() To get the reply author id
* @uses apply_filters() Calls bbp_get_reply_author_role with the author
* role & args
* @return string Reply author role
*/
function bbp_get_reply_author_role($args = array())
{
// Parse arguments against default values
$r = bbp_parse_args($args, array('reply_id' => 0, 'class' => 'bbp-author-role', 'before' => '', 'after' => ''), 'get_reply_author_role');
$reply_id = bbp_get_reply_id($r['reply_id']);
$role = bbp_get_user_display_role(bbp_get_reply_author_id($reply_id));
$author_role = sprintf('%1$s<div class="%2$s">%3$s</div>%4$s', $r['before'], esc_attr($r['class']), esc_html($role), $r['after']);
return apply_filters('bbp_get_reply_author_role', $author_role, $r);
}
示例3: widget
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
//No EDD? Bail
if (!class_exists('Easy_Digital_Downloads')) {
return false;
}
//Not EDD admin? Bail
if (!current_user_can('view_shop_sensitive_data')) {
return false;
}
//Handle before_widget args
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
$user_id = get_the_author_meta('ID');
$user_data = get_userdata($user_id);
?>
<div class="box">
<?php
do_action('wi_bbp_sidebar');
?>
<h3><?php
echo get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name');
?>
</h3>
<p class="bbp-user-forum-role"><?php
printf('Forum Role: %s', bbp_get_user_display_role($user_id));
?>
</p>
<p class="bbp-user-topic-count"><?php
printf('Topics Started: %s', bbp_get_user_topic_count_raw($user_id));
?>
</p>
<p class="bbp-user-reply-count"><?php
printf('Replies Created: %s', bbp_get_user_reply_count_raw($user_id));
?>
</p>
<div class="wi_users_purchases">
<h3><?php
_e('User\'s Purchases:', 'wi_bbp');
?>
</h3>
<?php
$purchases = edd_get_users_purchases($user_data->user_email, 100, false, 'any');
if ($purchases) {
echo '<ul>';
foreach ($purchases as $purchase) {
echo '<li>';
echo '<strong><a href="' . admin_url('edit.php?post_type=download&page=give-payment-history&view=view-order-details&id=' . $purchase->ID) . '">#' . $purchase->ID . ' - ' . edd_get_payment_status($purchase, true) . '</a></strong><br/>';
$downloads = edd_get_payment_meta_downloads($purchase->ID);
foreach ($downloads as $download) {
echo get_the_title($download['id']) . ' - ' . date('F j, Y', strtotime($purchase->post_date)) . '<br/>';
}
//Check license key
if (function_exists('edd_software_licensing')) {
$licenses = edd_software_licensing()->get_licenses_of_purchase($purchase->ID);
if ($licenses) {
echo '<strong>' . __('Licenses:', 'edd') . '</strong><br/>';
foreach ($licenses as $license) {
$key = edd_software_licensing()->get_license_key($license->ID);
$download_id = edd_software_licensing()->get_download_by_license($key);
$title = get_the_title($download_id);
//output license URL
echo $title . ' - <a href="' . admin_url('edit.php?post_type=download&page=give-licenses&s=' . $key) . '">' . $key . '</a>';
echo ' - ' . edd_software_licensing()->get_license_status($license->ID);
echo '<br/>';
}
}
echo '<hr/>';
}
echo '</li>';
}
echo '</ul>';
} else {
echo '<p>' . __('This user has never purchased anything.', 'wi_bbp') . '</p>';
}
?>
</div>
</div>
<?php
//After widget args
echo $args['after_widget'];
return false;
}
示例4: bbp_displayed_user_field
<?php
if (bbp_get_displayed_user_field('description')) {
?>
<p class="bbp-user-description"><?php
bbp_displayed_user_field('description');
?>
</p>
<?php
}
?>
<p class="bbp-user-forum-role"><?php
printf(__('Forum Role: %s', 'bbpress'), bbp_get_user_display_role());
?>
</p>
<p class="bbp-user-topic-count"><?php
printf(__('Topics Started: %s', 'bbpress'), bbp_get_user_topic_count_raw());
?>
</p>
<p class="bbp-user-reply-count"><?php
printf(__('Replies Created: %s', 'bbpress'), bbp_get_user_reply_count_raw());
?>
</p>
</div>
</div><!-- #bbp-author-topics-started -->
<?php
do_action('bbp_template_after_user_profile');
示例5: edd_bbp_sidebar
/**
* EDD Forum Sidebar
*
* @since 1.0.0
* @return void
*/
function edd_bbp_sidebar()
{
global $post;
$user_id = get_the_author_meta('ID');
$user_data = get_userdata($user_id);
?>
<div class="box">
<?php
do_action('edd_bbp_sidebar');
?>
<h3><?php
echo get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name');
?>
</h3>
<p class="bbp-user-forum-role"><?php
printf('Forum Role: %s', bbp_get_user_display_role($user_id));
?>
</p>
<p class="bbp-user-topic-count"><?php
printf('Topics Started: %s', bbp_get_user_topic_count_raw($user_id));
?>
</p>
<p class="bbp-user-reply-count"><?php
printf('Replies Created: %s', bbp_get_user_reply_count_raw($user_id));
?>
</p>
<div class="rcp_support_status">
<h4>Priority Support Access</h4>
<?php
if (function_exists('rcp_is_active')) {
if (rcp_is_active($user_id)) {
?>
<p>Has <strong>Priority Support</strong> access.</p>
<?php
} elseif (rcp_is_expired($user_id)) {
?>
<p><strong>Priority Support</strong> access has <span style="color:red;">expired</span>.</p>
<?php
} else {
?>
<p>Has no priority support accesss</p>
<?php
}
}
?>
</div><!-- /.rcp_support_status -->
<div class="edd_users_purchases">
<h4>User's Purchases:</h4>
<?php
$purchases = edd_get_users_purchases($user_data->user_email, 100, false, 'any');
if ($purchases) {
echo '<ul>';
foreach ($purchases as $purchase) {
echo '<li>';
echo '<strong><a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $purchase->ID) . '">#' . $purchase->ID . ' - ' . edd_get_payment_status($purchase, true) . '</a></strong><br/>';
$downloads = edd_get_payment_meta_downloads($purchase->ID);
foreach ($downloads as $download) {
echo get_the_title($download['id']) . ' - ' . date('F j, Y', strtotime($purchase->post_date)) . '<br/>';
}
if (function_exists('edd_software_licensing')) {
$licenses = edd_software_licensing()->get_licenses_of_purchase($purchase->ID);
if ($licenses) {
echo '<strong>Licenses:</strong><br/>';
foreach ($licenses as $license) {
$key = edd_software_licensing()->get_license_key($license->ID);
echo '<a href="' . admin_url('edit.php?post_type=download&page=edd-licenses&s=' . $key) . '">' . $key . '</a>';
echo ' - ' . edd_software_licensing()->get_license_status($license->ID);
echo '<br/>';
}
}
echo '<hr/>';
}
echo '</li>';
}
echo '</ul>';
} else {
echo '<p>This user has never purchased anything.</p>';
}
?>
</div>
</div>
<?php
}
示例6: bbp_user_display_role
/**
* Output a user's main role for display
*
* @since 2.1.0 bbPress (r3860)
*
* @param int $user_id
* @uses bbp_get_user_display_role To get the user display role
*/
function bbp_user_display_role($user_id = 0)
{
echo bbp_get_user_display_role($user_id);
}
示例7: widget
//.........这里部分代码省略.........
<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
if (bbp_is_user_home() && bbp_is_single_user_profile()) {
echo 'active';
}
?>
">
<span class="glyphicon ipt-icomoon-user4"></span> <?php
printf(__('%s Forum Role', 'ipt_kb'), '<span class="badge">' . bbp_get_user_display_role(bbp_get_current_user_id()) . '</span>');
?>
</a>
<a href="<?php
bbp_user_topics_created_url(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-topic-count <?php
if (bbp_is_user_home() && bbp_is_single_user_topics()) {
echo 'active';
}
?>
">
<span class="glyphicon ipt-icomoon-bubbles4"></span> <?php
printf(__('%s Topics Started', 'ipt_kb'), '<span class="badge">' . bbp_get_user_topic_count_raw(bbp_get_current_user_id()) . '</span>');
?>
</a>
<a href="<?php
bbp_user_replies_created_url(bbp_get_current_user_id());
?>
" class="list-group-item bbp-user-reply-count <?php
if (bbp_is_user_home() && bbp_is_single_user_replies()) {
echo 'active';
}
?>
">
<span class="glyphicon ipt-icomoon-reply"></span> <?php
printf(__('%s Replies Created', 'ipt_kb'), '<span class="badge">' . bbp_get_user_reply_count_raw(bbp_get_current_user_id()) . '</span>');
?>
</a>
<?php
if (bbp_is_favorites_active()) {
?>
<a href="<?php
示例8: bbp_displayed_user_field
<?php
if (bbp_get_displayed_user_field('description')) {
?>
<p class="bbp-user-description"><?php
bbp_displayed_user_field('description');
?>
</p>
<?php
}
?>
<p class="bbp-user-forum-role"><?php
printf(__('Forum Role: %s', 'wpdance'), bbp_get_user_display_role());
?>
</p>
<p class="bbp-user-topic-count"><?php
printf(__('Topics Started: %s', 'wpdance'), bbp_get_user_topic_count_raw());
?>
</p>
<p class="bbp-user-reply-count"><?php
printf(__('Replies Created: %s', 'wpdance'), bbp_get_user_reply_count_raw());
?>
</p>
</div>
</div><!-- #bbp-author-topics-started -->
<?php
do_action('bbp_template_after_user_profile');
示例9: bbp_displayed_user_field
<div class="well well-sm">
<p class="bbp-user-description"><?php
bbp_displayed_user_field('description');
?>
</p>
</div>
<?php
}
?>
<div class="list-group">
<a href="<?php
bbp_user_profile_url();
?>
" class="list-group-item active bbp-user-forum-role"><span class="glyphicon ipt-icon-user4"></span> <?php
printf(__('%s Forum Role', 'ipt_kb'), '<span class="badge">' . bbp_get_user_display_role() . '</span>');
?>
</a>
<a href="<?php
bbp_user_topics_created_url();
?>
" class="list-group-item bbp-user-topic-count"><span class="glyphicon ipt-icon-bubbles4"></span> <?php
printf(__('%s Topics Started:', 'ipt_kb'), '<span class="badge">' . bbp_get_user_topic_count_raw() . '</span>');
?>
</a>
<a href="<?php
bbp_user_replies_created_url();
?>
" class="list-group-item bbp-user-reply-count"><span class="glyphicon ipt-icon-reply"></span> <?php
printf(__('%s Replies Created', 'ipt_kb'), '<span class="badge">' . bbp_get_user_reply_count_raw() . '</span>');
?>
示例10: bbp_get_topic_author_role
/**
* Return the topic author role
*
* @since bbPress (r3860)
*
* @param array $args Optional.
* @uses bbp_get_topic_id() To get the topic id
* @uses bbp_get_user_display_role() To get the user display role
* @uses bbp_get_topic_author_id() To get the topic author id
* @uses apply_filters() Calls bbp_get_topic_author_role with the author
* role & args
* @return string topic author role
*/
function bbp_get_topic_author_role($args = array())
{
$defaults = array('topic_id' => 0, 'class' => 'bbp-author-role', 'before' => '', 'after' => '');
$args = bbp_parse_args($args, $defaults, 'get_topic_author_role');
extract($args, EXTR_SKIP);
$topic_id = bbp_get_topic_id($topic_id);
$role = bbp_get_user_display_role(bbp_get_topic_author_id($topic_id));
$author_role = sprintf('%1$s<div class="%2$s">%3$s</div>%4$s', $before, $class, $role, $after);
return apply_filters('bbp_get_topic_author_role', $author_role, $args);
}
示例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: bbp_displayed_user_field
<?php
if (bbp_get_displayed_user_field('description')) {
?>
<p class="bbp-user-description"><?php
bbp_displayed_user_field('description');
?>
</p>
<?php
}
?>
<p class="bbp-user-forum-role"><?php
printf(esc_html__('Forum Role: %s', 'monsoon'), bbp_get_user_display_role());
?>
</p>
<p class="bbp-user-topic-count"><?php
printf(esc_html__('Topics Started: %s', 'monsoon'), bbp_get_user_topic_count_raw());
?>
</p>
<p class="bbp-user-reply-count"><?php
printf(esc_html__('Replies Created: %s', 'monsoon'), bbp_get_user_reply_count_raw());
?>
</p>
</div>
</div><!-- #bbp-author-topics-started -->
<?php
do_action('bbp_template_after_user_profile');
示例13: wi_bbp_sidebar
/**
* Forum Sidebar
*
* @since 1.0.0
* @return void
*/
function wi_bbp_sidebar()
{
global $post;
$user_id = get_the_author_meta('ID');
$user_data = get_userdata($user_id);
?>
<div class="box">
<?php
do_action('wi_bbp_sidebar');
?>
<h3><?php
echo get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name');
?>
</h3>
<p class="bbp-user-forum-role"><?php
printf('Forum Role: %s', bbp_get_user_display_role($user_id));
?>
</p>
<p class="bbp-user-topic-count"><?php
printf('Topics Started: %s', bbp_get_user_topic_count_raw($user_id));
?>
</p>
<p class="bbp-user-reply-count"><?php
printf('Replies Created: %s', bbp_get_user_reply_count_raw($user_id));
?>
</p>
<div class="wi_users_purchases">
<h3><?php
_e('User\'s Purchases:', 'wi_bbp');
?>
</h3>
<?php
$purchases = edd_get_users_purchases($user_data->user_email, 100, false, 'any');
if ($purchases) {
echo '<ul>';
foreach ($purchases as $purchase) {
echo '<li>';
echo '<strong><a href="' . admin_url('edit.php?post_type=download&page=give-payment-history&view=view-order-details&id=' . $purchase->ID) . '">#' . $purchase->ID . ' - ' . edd_get_payment_status($purchase, true) . '</a></strong><br/>';
$downloads = edd_get_payment_meta_downloads($purchase->ID);
foreach ($downloads as $download) {
echo get_the_title($download['id']) . ' - ' . date('F j, Y', strtotime($purchase->post_date)) . '<br/>';
}
//Check license key
if (function_exists('edd_software_licensing')) {
$licenses = edd_software_licensing()->get_licenses_of_purchase($purchase->ID);
if ($licenses) {
echo '<strong>Licenses:</strong><br/>';
foreach ($licenses as $license) {
$key = edd_software_licensing()->get_license_key($license->ID);
echo '<a href="' . admin_url('edit.php?post_type=download&page=give-licenses&s=' . $key) . '">' . $key . '</a>';
echo ' - ' . edd_software_licensing()->get_license_status($license->ID);
echo '<br/>';
}
}
echo '<hr/>';
}
echo '</li>';
}
echo '</ul>';
} else {
echo '<p>This user has never purchased anything.</p>';
}
?>
</div>
</div>
<?php
}
示例14: bbp_displayed_user_field
<p class="bbp-user-description"><?php
bbp_displayed_user_field('description');
?>
</p>
<?php
}
?>
<dl>
<dt><?php
_e('Forum Role', 'omega-td');
?>
</dt>
<dd><?php
echo bbp_get_user_display_role();
?>
</dd>
<dt><?php
_e('Topics Started', 'omega-td');
?>
</dt>
<dd><?php
echo bbp_get_user_topic_count_raw();
?>
</dd>
<dt><?php
_e('Replies Created', 'omega-td');
?>
</dt>
<dd><?php
示例15: bbp_get_topic_author_role
/**
* Return the topic author role
*
* @since 2.1.0 bbPress (r3860)
*
* @param array $args Optional.
* @uses bbp_get_topic_id() To get the topic id
* @uses bbp_get_user_display_role() To get the user display role
* @uses bbp_get_topic_author_id() To get the topic author id
* @uses apply_filters() Calls bbp_get_topic_author_role with the author
* role & args
* @return string topic author role
*/
function bbp_get_topic_author_role($args = array())
{
// Parse arguments against default values
$r = bbp_parse_args($args, array('topic_id' => 0, 'class' => false, 'before' => '<div class="bbp-author-role">', 'after' => '</div>'), 'get_topic_author_role');
$topic_id = bbp_get_topic_id($r['topic_id']);
$role = bbp_get_user_display_role(bbp_get_topic_author_id($topic_id));
// Backwards compatibilty with old 'class' argument
if (!empty($r['class'])) {
$author_role = sprintf('%1$s<div class="%2$s">%3$s</div>%4$s', $r['before'], $r['class'], $role, $r['after']);
// Simpler before & after arguments
// https://bbpress.trac.wordpress.org/ticket/2557
} else {
$author_role = $r['before'] . $role . $r['after'];
}
return apply_filters('bbp_get_topic_author_role', $author_role, $r);
}