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


PHP bbp_get_user_profile_url函数代码示例

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


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

示例1: wp_ulike_prize_user

function wp_ulike_prize_user($user_id, $user_score, $level)
{
    $user_ids = [$user_id];
    // Проверяем пользователя по чёрному списку
    $mail_ids = apply_filters('wp_ulike_mailing_ids', $user_ids);
    if (!in_array($user_id, $mail_ids)) {
        // Пользователь в чёрном списке?
        return;
    }
    // Оставляем только белый список
    $mail_ids = array_diff($mail_ids, $user_ids);
    $site_url = get_bloginfo('url');
    $site_name = get_bloginfo('name');
    $site_desc = get_bloginfo('description');
    // Если уровень больше 3 используем настройки уровня 3
    $settings = $level < 4 ? "wp_ulike_mailing_level_{$level}" : "wp_ulike_mailing_level_3";
    $user_id = stripslashes($user_id);
    $user_score = stripslashes($user_score);
    $user_info = get_userdata($user_id);
    if ($user_info) {
        $user_profile = bbp_get_user_profile_url($user_id);
        // url профиля пользователя
        $subject = wp_ulike_get_setting($settings, 'top_user_mail_subject');
        $subject = str_replace(['%user_name%', '%user_id%', '%user_profile%', '%user_score%', '%user_level%', '%site_url%', '%site_name%'], [mb_convert_case(rtrim($user_info->first_name), MB_CASE_TITLE, 'UTF-8'), $user_id, $user_profile, $user_score, $level, $site_url, $site_name], $subject);
        $content = wp_ulike_get_setting($settings, 'top_user_mail_template');
        $content = str_replace(['%user_name%', '%user_id%', '%user_profile%', '%user_score%', '%user_level%', '%site_url%', '%site_name%'], [mb_convert_case(rtrim($user_info->first_name), MB_CASE_TITLE, 'UTF-8'), $user_id, $user_profile, $user_score, $level, $site_url, $site_name], $content);
        $buf = ob_start();
        if ($buf) {
            include plugin_dir_path(__FILE__) . 'mail-template.php';
            // Подключаем шаблон
            $mail_body = ob_get_clean();
            if ($mail_body) {
                $from = wp_ulike_get_setting('wp_ulike_general', 'mail_from');
                if (!$from) {
                    $from = 'noreply@domain.com';
                }
                $headers = ['Content-Type: text/html; charset=UTF-8', 'From: ' . $from];
                // Отправляем уведомление пользователю
                if (wp_mail($user_info->user_email, $subject, $mail_body, $headers)) {
                    wp_ulike_mark_mailing_done($user_id, $level);
                }
                // Отправляем копии по белому списку
                while (list($i, $id) = each($mail_ids)) {
                    $user_info = get_userdata($id);
                    if ($user_info) {
                        wp_mail($user_info->user_email, $subject, $mail_body, $headers);
                    }
                }
            }
        }
    }
}
开发者ID:NickIvanter,项目名称:wp-ulike,代码行数:52,代码来源:wp-mailing.php

示例2: replace_tags

 /**
  * replace_tags function.
  *
  * @param mixed $text
  */
 public function replace_tags($text)
 {
     if ($this->user) {
         $text = str_replace(array('%username%', '%userid%', '%firstname%', '%lastname%', '%name%'), array(ucwords($this->user->display_name), $this->user->ID, $this->user->first_name, $this->user->last_name, trim($this->user->first_name . ' ' . $this->user->last_name)), $text);
         // Buddypress
         if (function_exists('bp_loggedin_user_domain')) {
             $text = str_replace(array('%buddypress_profile_url%'), array(bp_loggedin_user_domain()), $text);
         }
         // BBpress
         if (function_exists('bbp_get_user_profile_url')) {
             $text = str_replace(array('%bbpress_profile_url%'), array(bbp_get_user_profile_url($this->user->ID)), $text);
         }
     }
     $logout_redirect = wp_logout_url(empty($this->instance['logout_redirect_url']) ? $this->current_url('nologout') : $this->instance['logout_redirect_url']);
     $text = str_replace(array('%admin_url%', '%logout_url%'), array(untrailingslashit(admin_url()), apply_filters('sidebar_login_widget_logout_redirect', $logout_redirect)), $text);
     $text = do_shortcode($text);
     return $text;
 }
开发者ID:raj-rk,项目名称:Raj,代码行数:23,代码来源:class-sidebar-login-widget.php

示例3: foreach

 $count = 1;
 foreach ($ratings as $rating) {
     $urid = $rating->urid;
     $wp_object = null;
     $excerpt = '';
     $permalink = '';
     if ('users' === $type) {
         $user_id = RatingWidgetPlugin::Urid2UserId($urid);
         $wp_object = get_user_by('id', $user_id);
         if (function_exists('is_buddypress')) {
             $title = trim(strip_tags(bp_core_get_user_displayname($user_id)));
             $permalink = bp_core_get_user_domain($user_id);
         } else {
             if (function_exists('is_bbpress')) {
                 $title = trim(strip_tags(bbp_get_user_display_name($user_id)));
                 $permalink = bbp_get_user_profile_url($user_id);
             } else {
                 $wp_object = null;
             }
         }
         // If valid WP_User object, retrieve the avatar URL
         if ($wp_object) {
             $thumbnail = ratingwidget()->get_user_avatar($user_id);
         }
     } else {
         $post_id = RatingWidgetPlugin::Urid2PostId($urid);
         $wp_object = get_post($post_id);
         $title = get_the_title($post_id);
         $excerpt = ratingwidget()->GetPostExcerpt($wp_object, 15);
         $permalink = get_permalink($post_id);
         $thumbnail = ratingwidget()->GetPostImage($wp_object);
开发者ID:zakaria340,项目名称:critique,代码行数:31,代码来源:top-rated.php

示例4: bbp_get_topic_author_url

/**
 * Return the author url of the topic
 *
 * @since 2.0.0 bbPress (r2590)
 *
 * @param int $topic_id Optional. Topic id
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_is_topic_anonymous() To check if the topic is by an anonymous
 *                                 user or not
 * @uses bbp_user_has_profile() To check if the user has a profile
 * @uses bbp_get_topic_author_id() To get topic author id
 * @uses bbp_get_user_profile_url() To get profile url
 * @uses get_post_meta() To get anonmous user's website
 * @uses apply_filters() Calls 'bbp_get_topic_author_url' with the link &
 *                        topic id
 * @return string Author URL of topic
 */
function bbp_get_topic_author_url($topic_id = 0)
{
    $topic_id = bbp_get_topic_id($topic_id);
    // Check for anonymous user or non-existant user
    if (!bbp_is_topic_anonymous($topic_id) && bbp_user_has_profile(bbp_get_topic_author_id($topic_id))) {
        $author_url = bbp_get_user_profile_url(bbp_get_topic_author_id($topic_id));
    } else {
        $author_url = get_post_meta($topic_id, '_bbp_anonymous_website', true);
        // Set empty author_url as empty string
        if (empty($author_url)) {
            $author_url = '';
        }
    }
    return apply_filters('bbp_get_topic_author_url', $author_url, $topic_id);
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:32,代码来源:template.php

示例5: bbp_check_user_edit

/**
 * Redirect if unathorized user is attempting to edit another user
 *
 * This is hooked to 'bbp_template_redirect' and controls the conditions under
 * which a user can edit another user (or themselves.) If these conditions are
 * met. We assume a user cannot perform this task, and look for ways they can
 * earn the ability to access this template.
 * 
 * @since bbPress (r3605)
 *
 * @uses bbp_is_topic_edit()
 * @uses current_user_can()
 * @uses bbp_get_topic_id()
 * @uses wp_safe_redirect()
 * @uses bbp_get_topic_permalink()
 */
function bbp_check_user_edit()
{
    // Bail if not editing a topic
    if (!bbp_is_single_user_edit()) {
        return;
    }
    // Default to false
    $redirect = true;
    // Allow user to edit their own profile
    if (bbp_is_user_home_edit()) {
        $redirect = false;
        // Allow if current user can edit the displayed user
    } elseif (current_user_can('edit_user', bbp_get_displayed_user_id())) {
        $redirect = false;
        // Allow if user can manage network users, or edit-any is enabled
    } elseif (current_user_can('manage_network_users') || apply_filters('enable_edit_any_user_configuration', false)) {
        $redirect = false;
    }
    // Maybe redirect back to profile page
    if (true === $redirect) {
        wp_safe_redirect(bbp_get_user_profile_url(bbp_get_displayed_user_id()));
        exit;
    }
}
开发者ID:hscale,项目名称:webento,代码行数:40,代码来源:functions.php

示例6: _bbpress_items

 protected function _bbpress_items()
 {
     $item = array();
     $post_type_object = get_post_type_object(bbp_get_forum_post_type());
     if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
         $item[] = '<span typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '"  property="v:title" rel="v:url"><span>' . bbp_get_forum_archive_title() . '</span></a></span>';
     }
     if (bbp_is_forum_archive()) {
         $item[] = bbp_get_forum_archive_title();
     } elseif (bbp_is_topic_archive()) {
         $item[] = bbp_get_topic_archive_title();
     } elseif (bbp_is_single_view()) {
         $item[] = bbp_get_view_title();
     } elseif (bbp_is_single_topic()) {
         $topic_id = get_queried_object_id();
         $item = array_merge($item, $this->_get_parents(bbp_get_topic_forum_id($topic_id)));
         if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
             $item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_topic_permalink($topic_id) . '"  property="v:title" rel="v:url"><span>' . bbp_get_topic_title($topic_id) . '</span></a></span>';
         } else {
             $item[] = bbp_get_topic_title($topic_id);
         }
         if (bbp_is_topic_split()) {
             $item[] = __('Split', DH_DOMAIN);
         } elseif (bbp_is_topic_merge()) {
             $item[] = __('Merge', DH_DOMAIN);
         } elseif (bbp_is_topic_edit()) {
             $item[] = __('Edit', DH_DOMAIN);
         }
     } elseif (bbp_is_single_reply()) {
         $reply_id = get_queried_object_id();
         $item = array_merge($item, $this->_get_parents(bbp_get_reply_topic_id($reply_id)));
         if (!bbp_is_reply_edit()) {
             $item[] = bbp_get_reply_title($reply_id);
         } else {
             $item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_reply_url($reply_id) . '"  property="v:title" rel="v:url"><span>' . bbp_get_reply_title($reply_id) . '</span></a></span>';
             $item[] = __('Edit', DH_DOMAIN);
         }
     } elseif (bbp_is_single_forum()) {
         $forum_id = get_queried_object_id();
         $forum_parent_id = bbp_get_forum_parent_id($forum_id);
         if (0 !== $forum_parent_id) {
             $item = array_merge($item, $this->_get_parents($forum_parent_id));
         }
         $item[] = bbp_get_forum_title($forum_id);
     } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
         if (bbp_is_single_user_edit()) {
             $item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_user_profile_url() . '"  property="v:title" rel="v:url" ><span>' . bbp_get_displayed_user_field('display_name') . '</span></a></span>';
             $item[] = __('Edit', DH_DOMAIN);
         } else {
             $item[] = bbp_get_displayed_user_field('display_name');
         }
     }
     return $item;
 }
开发者ID:mysia84,项目名称:mnassalska,代码行数:54,代码来源:breadcrumb.php

示例7: action_bbpress_button

    /**
     * Adds a 'Switch To' link to each member's profile page in bbPress.
     */
    public function action_bbpress_button()
    {
        if (!($user = get_userdata(bbp_get_user_id()))) {
            return;
        }
        if (!($link = self::maybe_switch_url($user))) {
            return;
        }
        $link = add_query_arg(array('redirect_to' => urlencode(bbp_get_user_profile_url($user->ID))), $link);
        ?>
		<ul id="user_switching_switch_to">
			<li><a href="<?php 
        echo esc_url($link);
        ?>
"><?php 
        esc_html_e('Switch&nbsp;To', 'user-switching');
        ?>
</a></li>
		</ul>
		<?php 
    }
开发者ID:fia3876,项目名称:iqmas-portal,代码行数:24,代码来源:user-switching.php

示例8: mk_theme_breadcrumbs


//.........这里部分代码省略.........
                 foreach ($breadcrumbs as $crumb) {
                     echo $crumb . '' . $delimiter;
                 }
                 echo get_the_title();
             } elseif (is_attachment()) {
                 $parent = get_post($post->post_parent);
                 $cat = get_the_category($parent->ID);
                 $cat = $cat[0];
                 /* admin@innodron.com patch:
                 			   Fix for Catchable fatal error: Object of class WP_Error could not be converted to string
                 			   ref: https://wordpress.org/support/topic/catchable-fatal-error-object-of-class-wp_error-could-not-be-converted-to-string-11
                 			*/
                 echo is_wp_error($cat_parents = get_category_parents($cat, TRUE, '' . $delimiter . '')) ? '' : $cat_parents;
                 /* end admin@innodron.com patch */
                 echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a>' . $delimiter;
                 echo get_the_title();
             } elseif (is_search()) {
                 echo __('Search results for &ldquo;', 'mk_framework') . get_search_query() . '&rdquo;';
             } elseif (is_tag()) {
                 echo __('Tag &ldquo;', 'mk_framework') . single_tag_title('', false) . '&rdquo;';
             } elseif (is_author()) {
                 $userdata = get_userdata(get_the_author_meta('ID'));
                 echo __('Author:', 'mk_framework') . ' ' . $userdata->display_name;
             } elseif (is_day()) {
                 echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $delimiter;
                 echo '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a>' . $delimiter;
                 echo get_the_time('d');
             } elseif (is_month()) {
                 echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $delimiter;
                 echo get_the_time('F');
             } elseif (is_year()) {
                 echo get_the_time('Y');
             }
         }
     }
     if (get_query_var('paged')) {
         echo ' (' . __('Page', 'mk_framework') . ' ' . get_query_var('paged') . ')';
     }
     if (is_tax()) {
         $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
         if (function_exists('is_woocommerce') && is_woocommerce() && is_archive()) {
             echo $delimiter;
         }
         echo '<span>' . $term->name . '</span>';
     }
     if (function_exists('is_bbpress') && is_bbpress()) {
         $item = array();
         $post_type_object = get_post_type_object(bbp_get_forum_post_type());
         if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
             $item[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>';
         }
         if (bbp_is_forum_archive()) {
             $item[] = bbp_get_forum_archive_title();
         } elseif (bbp_is_topic_archive()) {
             $item[] = bbp_get_topic_archive_title();
         } elseif (bbp_is_single_view()) {
             $item[] = bbp_get_view_title();
         } elseif (bbp_is_single_topic()) {
             $topic_id = get_queried_object_id();
             $item = array_merge($item, mk_breadcrumbs_get_parents(bbp_get_topic_forum_id($topic_id)));
             if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
                 $item[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>';
             } else {
                 $item[] = bbp_get_topic_title($topic_id);
             }
             if (bbp_is_topic_split()) {
                 $item[] = __('Split', 'mk_framework');
             } elseif (bbp_is_topic_merge()) {
                 $item[] = __('Merge', 'mk_framework');
             } elseif (bbp_is_topic_edit()) {
                 $item[] = __('Edit', 'mk_framework');
             }
         } elseif (bbp_is_single_reply()) {
             $reply_id = get_queried_object_id();
             $item = array_merge($item, mk_breadcrumbs_get_parents(bbp_get_reply_topic_id($reply_id)));
             if (!bbp_is_reply_edit()) {
                 $item[] = bbp_get_reply_title($reply_id);
             } else {
                 $item[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>';
                 $item[] = __('Edit', 'mk_framework');
             }
         } elseif (bbp_is_single_forum()) {
             $forum_id = get_queried_object_id();
             $forum_parent_id = bbp_get_forum_parent_id($forum_id);
             if (0 !== $forum_parent_id) {
                 $item = array_merge($item, mk_breadcrumbs_get_parents($forum_parent_id));
             }
             $item[] = bbp_get_forum_title($forum_id);
         } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
             if (bbp_is_single_user_edit()) {
                 $item[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>';
                 $item[] = __('Edit', 'mk_framework');
             } else {
                 $item[] = bbp_get_displayed_user_field('display_name');
             }
         }
         echo implode($delimiter, $item);
     }
     echo "</div></div>";
 }
开发者ID:nikintharan,项目名称:campaign,代码行数:101,代码来源:general.php

示例9: tehnik_bbp_has_topics


//.........这里部分代码省略.........
                unset($post_offsets);
            }
            // Cleanup
            unset($sticky_offset);
            // If any posts have been excluded specifically, Ignore those that are sticky.
            if (!empty($stickies) && !empty($r['post__not_in'])) {
                $stickies = array_diff($stickies, $r['post__not_in']);
            }
            // Fetch sticky posts that weren't in the query results
            if (!empty($stickies)) {
                // Query to use in get_posts to get sticky posts
                $sticky_query = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => 'any', 'meta_key' => '_bbp_last_active_time', 'orderby' => 'meta_value', 'order' => 'DESC', 'include' => $stickies);
                //Get an array of IDs which the current user has permissions to view
                $allowed_forums = tehnik_bpp_get_permitted_post_ids(new WP_Query($sticky_query));
                // The default forum query with allowed forum ids array added
                $sticky_query['post__in'] = $allowed_forums;
                // Cleanup
                unset($stickies);
                // What are the default allowed statuses (based on user caps)
                if (bbp_get_view_all()) {
                    $sticky_query['post_status'] = $r['post_status'];
                    // Lean on the 'perm' query var value of 'readable' to provide statuses
                } else {
                    $sticky_query['post_status'] = $r['perm'];
                }
                // Get all stickies
                $sticky_posts = get_posts($sticky_query);
                if (!empty($sticky_posts)) {
                    // Get a count of the visible stickies
                    $sticky_count = count($sticky_posts);
                    // Merge the stickies topics with the query topics .
                    $bbp->topic_query->posts = array_merge($sticky_posts, $bbp->topic_query->posts);
                    // Adjust loop and counts for new sticky positions
                    $bbp->topic_query->found_posts = (int) $bbp->topic_query->found_posts + (int) $sticky_count;
                    $bbp->topic_query->post_count = (int) $bbp->topic_query->post_count + (int) $sticky_count;
                    // Cleanup
                    unset($sticky_posts);
                }
            }
        }
    }
    // If no limit to posts per page, set it to the current post_count
    if (-1 == $r['posts_per_page']) {
        $r['posts_per_page'] = $bbp->topic_query->post_count;
    }
    // Add pagination values to query object
    $bbp->topic_query->posts_per_page = $r['posts_per_page'];
    $bbp->topic_query->paged = $r['paged'];
    // Only add pagination if query returned results
    if (((int) $bbp->topic_query->post_count || (int) $bbp->topic_query->found_posts) && (int) $bbp->topic_query->posts_per_page) {
        // Limit the number of topics shown based on maximum allowed pages
        if (!empty($r['max_num_pages']) && $bbp->topic_query->found_posts > $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count) {
            $bbp->topic_query->found_posts = $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count;
        }
        // If pretty permalinks are enabled, make our pagination pretty
        if ($wp_rewrite->using_permalinks()) {
            // User's topics
            if (bbp_is_single_user_topics()) {
                $base = bbp_get_user_topics_created_url(bbp_get_displayed_user_id());
                // User's favorites
            } elseif (bbp_is_favorites()) {
                $base = bbp_get_favorites_permalink(bbp_get_displayed_user_id());
                // User's subscriptions
            } elseif (bbp_is_subscriptions()) {
                $base = bbp_get_subscriptions_permalink(bbp_get_displayed_user_id());
                // Root profile page
            } elseif (bbp_is_single_user()) {
                $base = bbp_get_user_profile_url(bbp_get_displayed_user_id());
                // View
            } elseif (bbp_is_single_view()) {
                $base = bbp_get_view_url();
                // Topic tag
            } elseif (bbp_is_topic_tag()) {
                $base = bbp_get_topic_tag_link();
                // Page or single post
            } elseif (is_page() || is_single()) {
                $base = get_permalink();
                // Topic archive
            } elseif (bbp_is_topic_archive()) {
                $base = bbp_get_topics_url();
                // Default
            } else {
                $base = get_permalink((int) $r['post_parent']);
            }
            // Use pagination base
            $base = trailingslashit($base) . user_trailingslashit($wp_rewrite->pagination_base . '/%#%/');
            // Unpretty pagination
        } else {
            $base = add_query_arg('paged', '%#%');
        }
        // Pagination settings with filter
        $bbp_topic_pagination = apply_filters('bbp_topic_pagination', array('base' => $base, 'format' => '', 'total' => $r['posts_per_page'] == $bbp->topic_query->found_posts ? 1 : ceil((int) $bbp->topic_query->found_posts / (int) $r['posts_per_page']), 'current' => (int) $bbp->topic_query->paged, 'prev_text' => is_rtl() ? '&rarr;' : '&larr;', 'next_text' => is_rtl() ? '&larr;' : '&rarr;', 'mid_size' => 1));
        // Add pagination to query object
        $bbp->topic_query->pagination_links = paginate_links($bbp_topic_pagination);
        // Remove first page from pagination
        $bbp->topic_query->pagination_links = str_replace($wp_rewrite->pagination_base . "/1/'", "'", $bbp->topic_query->pagination_links);
    }
    // Return object
    return array($bbp->topic_query->have_posts(), $bbp->topic_query);
}
开发者ID:dnaleor,项目名称:Tehnik-bbPress-Permissions,代码行数:101,代码来源:tehnik_bpp_forum_widgets.php

示例10: get_currentuserinfo

<?php

global $current_user;
get_currentuserinfo();
$cb_author_id = $current_user->ID;
$cb_author_posts = count_user_posts($cb_author_id);
$cb_author_profile_url = get_edit_user_link($cb_author_id);
if (class_exists('bbpress')) {
    $cb_author_profile_url = bbp_get_user_profile_url($cb_author_id);
}
if (class_exists('buddypress')) {
    global $bp;
    $cb_buddypress_user_profile_link = $cb_buddypress_user_profile_link = NULL;
    $cb_buddypress_current_user_id = $bp->loggedin_user->id;
    if (function_exists('bp_loggedin_user_domain')) {
        $cb_buddypress_user_profile_link = bp_loggedin_user_domain();
    }
    if (isset($bp->profile->slug)) {
        $cb_author_profile_url = $cb_buddypress_user_profile_link . $bp->profile->slug;
    }
    if (function_exists('bp_get_groups_root_slug')) {
        $cb_buddypress_user_group_link = $cb_buddypress_user_profile_link . bp_get_groups_root_slug();
    }
    if (function_exists('bp_get_messages_slug')) {
        $cb_buddypress_user_message_link = $cb_buddypress_user_profile_link . bp_get_messages_slug();
    }
    if (function_exists('bp_get_activity_slug')) {
        $cb_buddypress_user_activity_link = $cb_buddypress_user_profile_link . bp_get_activity_slug();
    }
    $cb_buddypress_user_avatar = bp_core_fetch_avatar(array('item_id' => $cb_buddypress_current_user_id, 'type' => 'full', 'width' => 120, 'height' => 120, 'class' => 'cb-circle'));
    $cb_buddypress_mystery_man = 'mystery-man.jpg';
开发者ID:walkthenight,项目名称:walkthenight-wordpress,代码行数:31,代码来源:widget_in.php

示例11: bbp_get_author_link

/**
 * Return the author link of the post
 *
 * @since bbPress (r2875)
 *
 * @param mixed $args Optional. If an integer, it is used as reply id.
 * @uses bbp_is_topic() To check if it's a topic page
 * @uses bbp_get_topic_author_link() To get the topic author link
 * @uses bbp_is_reply() To check if it's a reply page
 * @uses bbp_get_reply_author_link() To get the reply author link
 * @uses get_post_field() To get the post author
 * @uses bbp_is_reply_anonymous() To check if the reply is by an
 *                                 anonymous user
 * @uses get_the_author_meta() To get the author name
 * @uses bbp_get_user_profile_url() To get the author profile url
 * @uses get_avatar() To get the author avatar
 * @uses apply_filters() Calls 'bbp_get_reply_author_link' with the
 *                        author link and args
 * @return string Author link of reply
 */
function bbp_get_author_link($args = '')
{
    // Default arguments
    $defaults = array('post_id' => 0, 'link_title' => '', 'type' => 'both', 'size' => 80);
    $r = bbp_parse_args($args, $defaults, 'get_author_link');
    extract($r);
    // Used as reply_id
    if (is_numeric($args)) {
        $post_id = $args;
    }
    // Confirmed topic
    if (bbp_is_topic($post_id)) {
        return bbp_get_topic_author_link($args);
    } elseif (bbp_is_reply($post_id)) {
        return bbp_get_reply_author_link($args);
    } else {
        $user_id = get_post_field('post_author', $post_id);
    }
    // Neither a reply nor a topic, so could be a revision
    if (!empty($post_id)) {
        // Generate title with the display name of the author
        if (empty($link_title)) {
            $link_title = sprintf(!bbp_is_reply_anonymous($post_id) ? __('View %s\'s profile', 'bbpress') : __('Visit %s\'s website', 'bbpress'), get_the_author_meta('display_name', $user_id));
        }
        // Assemble some link bits
        $link_title = !empty($link_title) ? ' title="' . $link_title . '"' : '';
        $author_url = bbp_get_user_profile_url($user_id);
        $anonymous = bbp_is_reply_anonymous($post_id);
        // Get avatar
        if ('avatar' == $type || 'both' == $type) {
            $author_links[] = get_avatar($user_id, $size);
        }
        // Get display name
        if ('name' == $type || 'both' == $type) {
            $author_links[] = get_the_author_meta('display_name', $user_id);
        }
        // Add links if not anonymous
        if (empty($anonymous)) {
            foreach ($author_links as $link_text) {
                $author_link[] = sprintf('<a href="%1$s"%2$s>%3$s</a>', $author_url, $link_title, $link_text);
            }
            $author_link = join('&nbsp;', $author_link);
            // No links if anonymous
        } else {
            $author_link = join('&nbsp;', $author_links);
        }
        // No post so link is empty
    } else {
        $author_link = '';
    }
    return apply_filters('bbp_get_author_link', $author_link, $args);
}
开发者ID:rmccue,项目名称:bbPress,代码行数:72,代码来源:bbp-user-template.php

示例12: submit_post

 /**
  * Submit a post for spamming or hamming
  *
  * @since bbPress (r3277)
  *
  * @param int $post_id
  *
  * @global WP_Query $wpdb
  * @global string $akismet_api_host
  * @global string $akismet_api_port
  * @global object $current_user
  * @global object $current_site
  *
  * @uses current_filter() To get the reply_id
  * @uses get_post() To get the post object
  * @uses get_the_author_meta() To get the author meta
  * @uses get_post_meta() To get the post meta
  * @uses bbp_get_user_profile_url() To get a user's profile url
  * @uses get_permalink() To get the permalink of the post_parent
  * @uses akismet_get_user_roles() To get the role(s) of the post_author
  * @uses bbp_current_author_ip() To get the IP address of the current user
  * @uses BBP_Akismet::maybe_spam() To submit the post as ham or spam
  * @uses update_post_meta() To update the post meta with some Akismet data
  * @uses do_action() To call the 'bbp_akismet_submit_spam_post' and 'bbp_akismet_submit_ham_post' hooks
  *
  * @return array Array of existing topic terms
  */
 public function submit_post($post_id = 0)
 {
     global $current_user, $current_site;
     // Innocent until proven guilty
     $request_type = 'ham';
     $current_filter = current_filter();
     // Check this filter and adjust the $request_type accordingly
     switch ($current_filter) {
         // Mysterious, and straight from the can
         case 'bbp_spammed_topic':
         case 'bbp_spammed_reply':
             $request_type = 'spam';
             break;
             // Honey-glazed, a straight off the bone
         // Honey-glazed, a straight off the bone
         case 'bbp_unspammed_topic':
         case 'bbp_unspammed_reply':
             $request_type = 'ham';
             break;
             // Possibly poison...
         // Possibly poison...
         default:
             return;
     }
     // Setup some variables
     $post_id = (int) $post_id;
     // Make sure we have a post
     $_post = get_post($post_id);
     // Bail if get_post() fails
     if (empty($_post)) {
         return;
     }
     // Bail if we're spamming, but the post_status isn't spam
     if ('spam' == $request_type && bbp_get_spam_status_id() != $_post->post_status) {
         return;
     }
     // Set some default post_data
     $post_data = array('comment_approved' => $_post->post_status, 'comment_author' => $_post->post_author ? get_the_author_meta('display_name', $_post->post_author) : get_post_meta($post_id, '_bbp_anonymous_name', true), 'comment_author_email' => $_post->post_author ? get_the_author_meta('email', $_post->post_author) : get_post_meta($post_id, '_bbp_anonymous_email', true), 'comment_author_url' => $_post->post_author ? bbp_get_user_profile_url($_post->post_author) : get_post_meta($post_id, '_bbp_anonymous_website', true), 'comment_content' => $_post->post_content, 'comment_date' => $_post->post_date, 'comment_ID' => $post_id, 'comment_post_ID' => $_post->post_parent, 'comment_type' => $_post->post_type, 'permalink' => get_permalink($post_id), 'user_ID' => $_post->post_author, 'user_ip' => get_post_meta($post_id, '_bbp_author_ip', true), 'user_role' => akismet_get_user_roles($_post->post_author));
     // Use the original version stored in post_meta if available
     $as_submitted = get_post_meta($post_id, '_bbp_akismet_as_submitted', true);
     if ($as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content'])) {
         $post_data = array_merge($post_data, $as_submitted);
     }
     // Add the reporter IP address
     $post_data['reporter_ip'] = bbp_current_author_ip();
     // Add some reporter info
     if (is_object($current_user)) {
         $post_data['reporter'] = $current_user->user_login;
     }
     // Add the current site domain
     if (is_object($current_site)) {
         $post_data['site_domain'] = $current_site->domain;
     }
     // Place your slide beneath the microscope
     $post_data = $this->maybe_spam($post_data, 'submit', $request_type);
     // Manual user action
     if (isset($post_data['reporter'])) {
         // What kind of action
         switch ($request_type) {
             // Spammy
             case 'spam':
                 $this->update_post_history($post_id, sprintf(__('%1$s reported this %2$s as spam', 'bbpress'), $post_data['reporter'], $post_data['comment_type']), 'report-spam');
                 update_post_meta($post_id, '_bbp_akismet_user_result', 'true');
                 update_post_meta($post_id, '_bbp_akismet_user', $post_data['reporter']);
                 break;
                 // Hammy
             // Hammy
             case 'ham':
                 $this->update_post_history($post_id, sprintf(__('%1$s reported this %2$s as not spam', 'bbpress'), $post_data['reporter'], $post_data['comment_type']), 'report-ham');
                 update_post_meta($post_id, '_bbp_akismet_user_result', 'false');
                 update_post_meta($post_id, '_bbp_akismet_user', $post_data['reporter']);
                 // @todo Topic term revision history
                 break;
//.........这里部分代码省略.........
开发者ID:rmccue,项目名称:bbPress,代码行数:101,代码来源:bbp-extend-akismet.php

示例13: do_action

/**
 * User Details
 *
 * @package bbPress
 * @subpackage Theme
 */
?>

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

	<span class="page-title author">

		<?php 
printf(__('Profile: %s', 'bbpress'), "<span class='vcard'><a class='url fn n' href='" . bbp_get_user_profile_url() . "' title='" . esc_attr(bbp_get_displayed_user_field('display_name')) . "' rel='me'>" . bbp_get_displayed_user_field('display_name') . "</a></span>");
?>

		<?php 
if (bbp_is_user_home() || current_user_can('edit_users')) {
    ?>

			<span class="edit_user_link"><a href="<?php 
    bbp_user_profile_edit_url();
    ?>
" title="<?php 
    printf(__('Edit Profile of User %s', 'bbpress'), esc_attr(bbp_get_displayed_user_field('display_name')));
    ?>
"><?php 
    _e('(Edit)', 'bbpress');
    ?>
开发者ID:hscale,项目名称:webento,代码行数:31,代码来源:user-details.php

示例14: format_user

 /**
  * Formats the given user as html.
  *
  * @param WP_User $user The user to format (object of type WP_User).
  *
  * @uses apply_filters() Calls 'aa_user_template' hook
  * @return String html
  */
 function format_user($user)
 {
     $tpl_vars = array('{class}' => '', '{user}' => '');
     $avatar_size = intval($this->avatar_size);
     if (!$avatar_size) {
         $avatar_size = false;
     }
     $name = "";
     if ($this->show_name) {
         $name = $user->display_name;
     }
     $alt = $title = $name;
     $divcss = array('user');
     if ($this->show_name) {
         $divcss[] = 'with-name';
     }
     $link = false;
     $link_type = $this->user_link;
     // always use 'website' for commentators
     $type = isset($user->type) ? $user->type : null;
     if ($user->user_id == -1 && "guest-author" != $type) {
         $link_type = 'website';
     }
     switch ($link_type) {
         case 'authorpage':
             if ("guest-author" == $type) {
                 $link = get_author_posts_url($user->user_id, $user->user_nicename);
             } else {
                 $link = get_author_posts_url($user->user_id);
             }
             break;
         case 'website':
             if ("guest-author" == $type) {
                 $link = get_the_author_meta('url', $user->ID);
             } else {
                 $link = $user->user_url;
                 if (empty($link) || $link == 'http://') {
                     $link = false;
                 }
             }
             break;
         case 'blog':
             if (AA_is_wpmu()) {
                 $blog = get_active_blog_for_user($user->user_id);
                 if (!empty($blog->siteurl)) {
                     $link = $blog->siteurl;
                 }
             }
             break;
         case 'bp_memberpage':
             if (function_exists('bp_core_get_user_domain')) {
                 $link = bp_core_get_user_domain($user->user_id);
             } elseif (function_exists('bp_core_get_userurl')) {
                 // BP versions < 1.1
                 $link = bp_core_get_userurl($user->user_id);
             }
             break;
         case 'bbpress_memberpage':
             if (function_exists('bbp_get_user_profile_url')) {
                 $link = bbp_get_user_profile_url($user->user_id);
             }
             if (empty($link) || $link == 'http://') {
                 $link = false;
             }
             break;
         case 'last_post':
             $recent = get_posts(array('author' => $user->user_id, 'orderby' => 'date', 'order' => 'desc', 'numberposts' => 1));
             $link = get_permalink($recent[0]->ID);
             break;
         case 'last_post_all':
             $last_post = get_most_recent_post_of_user($user->user_id);
             $link = get_permalink($last_post['post_id']);
             break;
     }
     if ($this->show_postcount) {
         $postcount = 0;
         if ($user->user_id == -1 && "guest-author" != $type) {
             $postcount = $this->get_comment_count($user->user_email);
             $title .= ' (' . sprintf(_n("%d comment", "%d comments", $postcount, 'author-avatars'), $postcount) . ')';
         } else {
             // this is passing 1 for coauthors
             if ("guest-author" == $type && $user->linked_account) {
                 $linked_user = get_user_by('login', $user->linked_account);
                 // fetch the linked account and show thats count
                 $postcount = $this->get_user_postcount($linked_user->ID);
             } else {
                 $postcount = $this->get_user_postcount($user->user_id);
             }
             $title .= ' (' . sprintf(_n("%d post", "%d posts", $postcount, 'author-avatars'), $postcount) . ')';
         }
         $name .= sprintf(apply_filters('aa_post_count', ' (%d)', $postcount), $postcount);
     }
//.........这里部分代码省略.........
开发者ID:arildoosilva,项目名称:besm_restricted_area,代码行数:101,代码来源:UserList.class.php

示例15: cb_bbp_author_details

 function cb_bbp_author_details($cb_author_id, $cb_desc = true)
 {
     $cb_author_email = get_the_author_meta('publicemail', $cb_author_id);
     $cb_author_name = get_the_author_meta('display_name', $cb_author_id);
     $cb_author_position = get_the_author_meta('position', $cb_author_id);
     $cb_author_tw = get_the_author_meta('twitter', $cb_author_id);
     $cb_author_go = get_the_author_meta('googleplus', $cb_author_id);
     $cb_author_www = get_the_author_meta('url', $cb_author_id);
     $cb_author_desc = get_the_author_meta('description', $cb_author_id);
     $cb_author_posts = count_user_posts($cb_author_id);
     $cb_author_output = NULL;
     $cb_author_output .= '<div class="cb-author-details cb-bbp clearfix"><div class="cb-mask"><a href="' . bbp_get_user_profile_url() . '" title="' . bbp_get_displayed_user_field('display_name') . '" rel="me">' . get_avatar(bbp_get_displayed_user_field('user_email', 'raw'), apply_filters('bbp_single_user_details_avatar_size', 150)) . '</a></div><div class="cb-meta"><h3><a href="' . bbp_get_user_profile_url() . '" title="' . bbp_get_displayed_user_field('display_name') . '">' . $cb_author_name . '</a></h3>';
     if ($cb_author_position != NULL) {
         $cb_author_output .= '<div class="cb-author-position">' . $cb_author_position . '</div>';
     }
     if ($cb_author_desc != NULL && $cb_desc == true) {
         $cb_author_output .= '<p class="cb-author-bio">' . $cb_author_desc . '</p>';
     }
     if ($cb_author_email != NULL || $cb_author_www != NULL || $cb_author_tw != NULL || $cb_author_go != NULL) {
         $cb_author_output .= '<div class="cb-author-page-contact">';
     }
     if ($cb_author_email != NULL) {
         $cb_author_output .= '<a href="mailto:' . $cb_author_email . '"><i class="icon-envelope-alt cb-tip-bot" title="' . __('Email', 'cubell') . '"></i></a>';
     }
     if ($cb_author_www != NULL) {
         $cb_author_output .= ' <a href="' . $cb_author_www . '" target="_blank"><i class="icon-link cb-tip-bot" title="' . __('Website', 'cubell') . '"></i></a> ';
     }
     if ($cb_author_tw != NULL) {
         $cb_author_output .= ' <a href="//www.twitter.com/' . $cb_author_tw . '" target="_blank" ><i class="icon-twitter cb-tip-bot" title="Twitter"></i></a>';
     }
     if ($cb_author_go != NULL) {
         $cb_author_output .= ' <a href="' . $cb_author_go . '" rel="publisher" target="_top" title="Google+" class="cb-googleplus cb-tip-bot" ><img src="//ssl.gstatic.com/images/icons/gplus-32.png"  data-src-retina="//ssl.gstatic.com/images/icons/gplus-64.png" alt="Google+" ></a>';
     }
     if ($cb_author_email != NULL || $cb_author_www != NULL || $cb_author_go != NULL || $cb_author_tw != NULL) {
         $cb_author_output .= '</div>';
     }
     $cb_author_output .= '<div id="cb-user-nav"><ul>';
     if (bbp_is_single_user_replies()) {
         $cb_user_current = 'current';
     }
     $cb_author_output .= '<li class="';
     if (bbp_is_single_user_topics()) {
         $cb_author_output .= 'current';
     }
     $cb_author_output .= '"><span class="bbp-user-topics-created-link"><a href="' . bbp_get_user_topics_created_url() . '">' . __('Topics Started', 'bbpress') . '</a></span></li>';
     $cb_author_output .= '<li class="';
     if (bbp_is_single_user_replies()) {
         $cb_author_output .= 'current';
     }
     $cb_author_output .= '"><span class="bbp-user-replies-created-link"><a href="' . bbp_get_user_replies_created_url() . '">' . __('Replies Created', 'bbpress') . '</a></span></li>';
     if (bbp_is_favorites_active()) {
         $cb_author_output .= '<li class="';
         if (bbp_is_favorites()) {
             $cb_author_output .= 'current';
         }
         $cb_author_output .= '"><span class="bbp-user-favorites-link"><a href="' . bbp_get_favorites_permalink() . '">' . __('Favorites', 'bbpress') . '</a></span></li>';
     }
     if (bbp_is_user_home() || current_user_can('edit_users')) {
         if (bbp_is_subscriptions_active()) {
             $cb_author_output .= '<li class="';
             if (bbp_is_subscriptions()) {
                 $cb_author_output .= 'current';
             }
             $cb_author_output .= '"><span class="bbp-user-subscriptions-link"><a href="' . bbp_get_subscriptions_permalink() . '">' . __('Subscriptions', 'bbpress') . '</a></span></li>';
         }
         $cb_author_output .= '<li class="';
         if (bbp_is_single_user_edit()) {
             $cb_author_output .= 'current';
         }
         $cb_author_output .= '"><span class="bbp-user-edit-link"><a href="' . bbp_get_user_profile_edit_url() . '">' . __('Edit', 'bbpress') . '</a></span></li>';
     }
     $cb_author_output .= '</ul></div><!-- #cb-user-nav -->';
     $cb_author_output .= '</div></div>';
     return $cb_author_output;
 }
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:75,代码来源:core.php


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