本文整理汇总了PHP中bbp_get_topic_permalink函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_topic_permalink函数的具体用法?PHP bbp_get_topic_permalink怎么用?PHP bbp_get_topic_permalink使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_topic_permalink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notify_new_topic
/**
* Notify user roles on new topic
*/
public function notify_new_topic($topic_id = 0, $forum_id = 0, $anonymous_data = 0, $topic_author = 0)
{
$user_roles = Falcon::get_option('bbsub_topic_notification', array());
// bail out if no user roles found
if (!$user_roles) {
return;
}
$recipients = array();
foreach ($user_roles as $role) {
$users = get_users(array('role' => $role, 'fields' => array('ID', 'user_email', 'display_name')));
$recipients = array_merge($recipients, $users);
}
// still no users?
if (!$recipients) {
return;
}
// subscribe the users automatically
foreach ($recipients as $user) {
bbp_add_user_subscription($user->ID, $topic_id);
}
// Sanitize the HTML into text
$content = apply_filters('bbsub_html_to_text', bbp_get_topic_content($topic_id));
// Build email
$text = "%1\$s\n\n";
$text .= "---\nReply to this email directly or view it online:\n%2\$s\n\n";
$text .= "You are receiving this email because you subscribed to it. Login and visit the topic to unsubscribe from these emails.";
$text = sprintf($text, $content, bbp_get_topic_permalink($topic_id));
$text = apply_filters('bbsub_topic_email_message', $text, $topic_id, $content);
$subject = apply_filters('bbsub_topic_email_subject', 'Re: [' . get_option('blogname') . '] ' . bbp_get_topic_title($topic_id), $topic_id);
$options = array('author' => bbp_get_topic_author_display_name($topic_id), 'id' => $topic_id);
$this->handler->send_mail($recipients, $subject, $text, $options);
do_action('bbp_post_notify_topic_subscribers', $topic_id, $recipients);
}
示例2: wp_slack_bbpress
/**
* Plugin Name: WP Slack bbPress
* Plugin URI: https://github.com/rolfkleef/wp-slack-bbpress
* Description: Send notifications to Slack channels for events in bbPress.
* Version: 0.5
* Author: Rolf Kleef
* Author URI: https://drostan.org
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-slack-bbpress
*/
function wp_slack_bbpress($events)
{
$events['wp_slack_bbp_new_topic'] = array('action' => 'bbp_new_topic', 'description' => __('When a new topic is added in bbPress', 'wp-slack-bbpress'), 'message' => function ($topic_id, $forum_id, $anonymous_data, $topic_author) {
return array(array('fallback' => sprintf(__('<%1$s|New topic "%2$s"> in forum <%3$s|%4$s>', 'wp-slack-bbpress'), bbp_get_topic_permalink($topic_id), bbp_get_topic_title($topic_id), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id)), 'pretext' => sprintf(__('New topic in forum <%1$s|%2$s>', 'wp-slack-bbpress'), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id)), 'author_name' => bbp_get_topic_author_display_name($topic_id), 'author_link' => bbp_get_topic_author_link($topic_id), 'author_icon' => get_avatar_url($topic_author, array('size' => 16)), 'title' => sprintf('%1$s', bbp_get_topic_title($topic_id)), 'title_link' => bbp_get_topic_permalink($topic_id), 'text' => html_entity_decode(bbp_get_topic_excerpt($topic_id, 150))));
});
$events['wp_slack_bbp_new_reply'] = array('action' => 'bbp_new_reply', 'description' => __('When a new reply is added in bbPress', 'wp-slack-bbpress'), 'message' => function ($reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author, $bool, $reply_to) {
return array(array('fallback' => sprintf(__('<%1$s|New reply> in forum <%2$s|%3$s> on topic <%4$s|%5$s>', 'wp-slack-bbpress'), bbp_get_reply_url($reply_id), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id), bbp_get_topic_permalink($topic_id), bbp_get_topic_title($topic_id)), 'pretext' => sprintf(__('New reply in forum <%1$s|%2$s> on topic <%3$s|%4$s>', 'wp-slack-bbpress'), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id), bbp_get_topic_permalink($topic_id), bbp_get_topic_title($topic_id)), 'author_name' => bbp_get_reply_author_display_name($reply_id), 'author_link' => bbp_get_reply_author_link($reply_id), 'author_icon' => get_avatar_url($reply_author, array('size' => 16)), 'title' => sprintf(__('New reply to "%1$s"', 'wp-slack-bbpress'), bbp_get_topic_title($topic_id)), 'title_link' => bbp_get_reply_url($reply_id), 'text' => html_entity_decode(bbp_get_reply_excerpt($reply_id, 150))));
});
return $events;
}
示例3: test_bbp_get_topic_permalink
/**
* @covers ::bbp_topic_permalink
* @covers ::bbp_get_topic_permalink
*/
public function test_bbp_get_topic_permalink()
{
if (is_multisite()) {
$this->markTestSkipped('Skipping URL tests in multiste for now.');
}
$f = $this->factory->forum->create();
$t = $this->factory->topic->create(array('post_title' => 'Topic 1', 'post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
$topic_permalink = bbp_get_topic_permalink($t);
$this->expectOutputString($topic_permalink);
bbp_topic_permalink($t);
$this->assertSame('http://' . WP_TESTS_DOMAIN . '/?topic=topic-1', $topic_permalink);
}
示例4: topic_message
public static function topic_message($message, $topic_id, $forum_id, $user_id)
{
$topic_content = strip_tags(bbp_get_topic_content($topic_id));
$topic_url = bbp_get_topic_permalink($topic_id);
$topic_author = bbp_get_topic_author_display_name($topic_id);
$custom_message = get_option('_bbp_topic_notice_body');
$message = $custom_message ? $custom_message : $message;
$message = str_replace('{author}', $topic_author, $message);
$message = str_replace('{content}', $topic_content, $message);
$message = str_replace('{url}', $topic_url, $message);
return $message;
}
示例5: notify_topic
/**
* Notify admins on new topic
*
* @param type $topic_id
* @param type $forum_id
* @param type $anonymous_data
* @param type $topic_author
* @return boolean
*/
public function notify_topic($topic_id, $forum_id, $anonymous_data, $topic_author)
{
$topic_id = bbp_get_topic_id($topic_id);
$forum_id = bbp_get_forum_id($forum_id);
remove_all_filters('bbp_get_topic_content');
remove_all_filters('bbp_get_topic_title');
$topic_title = strip_tags(bbp_get_topic_title($topic_id));
$topic_content = strip_tags(bbp_get_topic_content($topic_id));
$topic_url = bbp_get_topic_permalink($topic_id);
$topic_author_name = bbp_get_topic_author_display_name($topic_id);
$message = sprintf(__('%1$s created new topic:
%2$s
Topic Link: %3$s
-----------
You are receiving this email because you askd for it.
Login and visit the settings to disable these emails.', 'bbp-notify-admin'), $topic_author_name, $topic_content, $topic_url);
$message = apply_filters('bbp_notify_admin_topic_mail_message', $message, $topic_id, $forum_id);
if (empty($message)) {
return;
}
$subject = apply_filters('bbp_notify_admin_reply_mail_title', $this->get_subject(__('New Topic: ', 'bbp-notify-admin') . $topic_title), $topic_id, $forum_id);
if (empty($subject)) {
return;
}
$headers = $this->get_headers();
//get the users to send an email
$users = $this->get_users_to_notify('topic');
$users = apply_filters('bbp_notify_admin_topic_notifiable_users', $users);
if (empty($users)) {
return false;
}
//get all users emails
$emails = $this->get_emails($users, 'topic');
if (empty($emails)) {
return false;
//no one to send to
}
$to_email = array_shift($emails);
// Loop through users
foreach ($emails as $email) {
//add all other users as bcc(only applies in case we have more than 1 admin )
$headers[] = 'Bcc:' . $email;
}
//send email
//even if an admin posts, It will notify everyone including him
$this->notify(array('subject' => $subject, 'message' => $message, 'to' => $to_email, 'headers' => $headers));
}
示例6: bbp_skeleton_topic_script_localization
/**
* Load localizations for topic script.
*
* These localizations require information that may not be loaded even by init.
*
* @since bbPress (r2652)
*
* @uses bbp_is_single_topic() To check if it's the topic page
* @uses bbp_get_current_user_id() To get the current user id
* @uses bbp_get_topic_id() To get the topic id
* @uses bbp_get_favorites_permalink() To get the favorites permalink
* @uses bbp_is_user_favorite() To check if the topic is in user's favorites
* @uses bbp_is_subscriptions_active() To check if the subscriptions are active
* @uses bbp_is_user_subscribed() To check if the user is subscribed to topic
* @uses bbp_get_topic_permalink() To get the topic permalink
* @uses wp_localize_script() To localize the script
*/
function bbp_skeleton_topic_script_localization()
{
if (!bbp_is_single_topic()) {
return;
}
$user_id = bbp_get_current_user_id();
$localizations = array('currentUserId' => $user_id, 'topicId' => bbp_get_topic_id());
// Favorites
if (bbp_is_favorites_active()) {
$localizations['favoritesActive'] = 1;
$localizations['favoritesLink'] = bbp_get_favorites_permalink($user_id);
$localizations['isFav'] = (int) bbp_is_user_favorite($user_id);
$localizations['favLinkYes'] = __('favorites', 'bbpress');
$localizations['favLinkNo'] = __('?', 'bbpress');
$localizations['favYes'] = __('This topic is one of your %favLinkYes% [%favDel%]', 'bbpress');
$localizations['favNo'] = __('%favAdd% (%favLinkNo%)', 'bbpress');
$localizations['favDel'] = __('×', 'bbpress');
$localizations['favAdd'] = __('Add this topic to your favorites', 'bbpress');
} else {
$localizations['favoritesActive'] = 0;
}
// Subscriptions
if (bbp_is_subscriptions_active()) {
$localizations['subsActive'] = 1;
$localizations['isSubscribed'] = (int) bbp_is_user_subscribed($user_id);
$localizations['subsSub'] = __('Subscribe', 'bbpress');
$localizations['subsUns'] = __('Unsubscribe', 'bbpress');
$localizations['subsLink'] = bbp_get_topic_permalink();
} else {
$localizations['subsActive'] = 0;
}
wp_localize_script('bbp_topic', 'bbpTopicJS', $localizations);
}
示例7: reply_create
/**
* Record an activity stream entry when a reply is created
*
* @since bbPress (r3395)
* @param int $topic_id
* @param int $forum_id
* @param array $anonymous_data
* @param int $topic_author_id
* @uses bbp_get_reply_id()
* @uses bbp_get_topic_id()
* @uses bbp_get_forum_id()
* @uses bbp_get_user_profile_link()
* @uses bbp_get_reply_url()
* @uses bbp_get_reply_content()
* @uses bbp_get_topic_permalink()
* @uses bbp_get_topic_title()
* @uses bbp_get_forum_permalink()
* @uses bbp_get_forum_title()
* @uses bp_create_excerpt()
* @uses apply_filters()
* @return Bail early if topic is by anonywous user
*/
public function reply_create($reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author_id)
{
// Do not log activity of anonymous users
if (!empty($anonymous_data)) {
return;
}
// Bail if site is private
if (!bbp_is_site_public()) {
return;
}
// Validate activity data
$user_id = $reply_author_id;
$reply_id = bbp_get_reply_id($reply_id);
$topic_id = bbp_get_topic_id($topic_id);
$forum_id = bbp_get_forum_id($forum_id);
// Bail if user is not active
if (bbp_is_user_inactive($user_id)) {
return;
}
// Bail if reply is not published
if (!bbp_is_reply_published($reply_id)) {
return;
}
// Setup links for activity stream
$user_link = bbp_get_user_profile_link($user_id);
// Reply
$reply_url = bbp_get_reply_url($reply_id);
$reply_content = get_post_field('post_content', $reply_id, 'raw');
// Topic
$topic_permalink = bbp_get_topic_permalink($topic_id);
$topic_title = get_post_field('post_title', $topic_id, 'raw');
$topic_link = '<a href="' . $topic_permalink . '" title="' . $topic_title . '">' . $topic_title . '</a>';
// Forum
$forum_permalink = bbp_get_forum_permalink($forum_id);
$forum_title = get_post_field('post_title', $forum_id, 'raw');
$forum_link = '<a href="' . $forum_permalink . '" title="' . $forum_title . '">' . $forum_title . '</a>';
// Activity action & text
$activity_text = sprintf(__('%1$s replied to the topic %2$s in the forum %3$s', 'bbpress'), $user_link, $topic_link, $forum_link);
$activity_action = apply_filters('bbp_activity_reply_create', $activity_text, $user_id, $reply_id, $topic_id);
$activity_content = apply_filters('bbp_activity_reply_create_excerpt', bp_create_excerpt($reply_content), $reply_content);
// Compile the activity stream results
$activity = array('id' => $this->get_activity_id($reply_id), 'user_id' => $user_id, 'action' => $activity_action, 'content' => $activity_content, 'primary_link' => $reply_url, 'type' => $this->reply_create, 'item_id' => $reply_id, 'secondary_item_id' => $topic_id, 'recorded_time' => get_post_time('Y-m-d H:i:s', true, $reply_id), 'hide_sitewide' => !bbp_is_forum_public($forum_id, false));
// Record the activity
$activity_id = $this->record_activity($activity);
// Add the activity entry ID as a meta value to the reply
if (!empty($activity_id)) {
update_post_meta($reply_id, '_bbp_activity_id', $activity_id);
}
}
示例8: cupid_breadcrumb_get_bbpress_items
function cupid_breadcrumb_get_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[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a></li>';
}
if (bbp_is_forum_archive()) {
$item['last'] = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$item['last'] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item['last'] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a></li>';
} else {
$item['last'] = bbp_get_topic_title($topic_id);
}
if (bbp_is_topic_split()) {
$item['last'] = __('Split', 'cupid');
} elseif (bbp_is_topic_merge()) {
$item['last'] = __('Merge', 'cupid');
} elseif (bbp_is_topic_edit()) {
$item['last'] = __('Edit', 'cupid');
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item['last'] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a></li>';
$item['last'] = __('Edit', 'cupid');
}
} 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, cupid_breadcrumb_get_parents($forum_parent_id));
}
$item['last'] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a></li>';
$item['last'] = __('Edit', 'cupid');
} else {
$item['last'] = bbp_get_displayed_user_field('display_name');
}
}
return apply_filters('cupid_breadcrumb_get_bbpress_items', $item);
}
示例9: edd_bbp_close_old_tickets_and_notify
/**
* Find all tickets that are 10 days old, close them, and send notices to the customer
*
* @since 2.1
* @return void
*/
function edd_bbp_close_old_tickets_and_notify()
{
$args = array('post_type' => 'topic', 'meta_query' => array('relation' => 'AND', array('key' => '_bbps_topic_status', 'value' => '1'), array('key' => '_bbp_last_active_time', 'value' => date('Y-n-d H:i:s', strtotime('-10 days')), 'compare' => '<=', 'type' => 'DATETIME'), array('key' => '_bbp_override_auto_close', 'compare' => 'NOT EXISTS'), array('key' => '_bbp_voice_count', 'value' => '1', 'compare' => '>')), 'posts_per_page' => 50, 'post_parent__not_in' => array(318));
$tickets = get_posts($args);
if ($tickets) {
$emails = EDD()->emails;
$emails->__set('from_address', 'no-reply@easydigitaldownloads.com');
$emails->heading = 'Support Alert';
foreach ($tickets as $ticket) {
$author_name = get_the_author_meta('display_name', $ticket->post_author);
$author_email = get_the_author_meta('user_email', $ticket->post_author);
$url = bbp_get_topic_permalink($ticket->ID);
$to = array();
$to[] = $author_email;
$to[] = 'pippin@pippinsplugins.com';
$message = "Hello {$author_name},\n\n";
$message .= "This email is to alert you that your ticket titled {$ticket->post_title} at https://easydigitaldownloads.com has been automatically closed due to inactivity.\n\n";
$message .= "If you believe this is in error or you are still needing assistance with this issue, simply reply to the ticket again and let us know: \n\n";
$message .= "Ticket URL: {$url}";
$emails->send($to, 'Support Ticket Closed', $message);
update_post_meta($ticket->ID, '_bbps_topic_status', '2');
}
$emails->__set('from_address', false);
}
}
示例10: bbp_get_forum_last_topic_permalink
/**
* Return the link to the last topic in a forum
*
* @since bbPress (r2464)
*
* @param int $forum_id Optional. Forum id
* @uses bbp_get_forum_id() To get the forum id
* @uses bbp_get_forum_last_topic_id() To get the forum's last topic id
* @uses bbp_get_topic_permalink() To get the topic's permalink
* @uses apply_filters() Calls 'bbp_get_forum_last_topic_permalink' with
* the topic link and forum id
* @return string Permanent link to topic
*/
function bbp_get_forum_last_topic_permalink($forum_id = 0)
{
$forum_id = bbp_get_forum_id($forum_id);
return apply_filters('bbp_get_forum_last_topic_permalink', bbp_get_topic_permalink(bbp_get_forum_last_topic_id($forum_id)), $forum_id);
}
示例11: 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 “', 'mk_framework') . get_search_query() . '”';
} elseif (is_tag()) {
echo __('Tag “', 'mk_framework') . single_tag_title('', false) . '”';
} 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>";
}
示例12: breadcrumbs_plus_get_bbpress_items
/**
* Gets the items for the breadcrumb item if bbPress is installed.
*
* @since 0.4
*
* @param array $args Mixed arguments for the menu.
* @return array List of items to be shown in the item.
*/
function breadcrumbs_plus_get_bbpress_items($args = array())
{
$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()) {
if (function_exists('bp_is_active')) {
global $bp;
// we're outside the loop!
// Assign some variables here
$page1 = isset($bp->members->root_slug) ? $bp->members->root_slug : '';
// slug for the Members page. The BuddyPress default is 'members'.
$page2 = isset($bp->groups->root_slug) ? $bp->groups->root_slug : '';
// slug for the Groups page. The BuddyPress default is 'groups'.
$page3 = isset($bp->activity->root_slug) ? $bp->activity->root_slug : '';
// slug for the Activity page. The BuddyPress default is 'activity'.
$page4 = isset($bp->forums->root_slug) ? $bp->forums->root_slug : '';
// slug for the Forums page. The BuddyPress default is 'forums'.
$page5 = isset($bp->achievements->root_slug) ? $bp->achievements->root_slug : '';
// slug for the Achievements page. The BuddyPress default is 'achievements'.
if (!bp_is_blog_page() && (is_page() || is_page($page1) || is_page($page2) || is_page($page3) || is_page($page4) || is_page($page5)) && !bp_is_user() && !bp_is_single_item() && !bp_is_register_page()) {
$item[] = '';
}
if (bp_is_user() && !bp_is_register_page()) {
$item[] = '';
}
} else {
//$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link( bbp_get_forum_post_type() ) . '" rel="v:url" property="v:title">' . bbp_get_forum_archive_title() . '</a></div>';
}
}
if (bbp_is_forum_archive()) {
$item[] = bbp_get_forum_archive_title();
} else {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '" rel="v:url" property="v:title">' . bbp_get_forum_archive_title() . '</a></div>';
}
if (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, breadcrumbs_plus_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_topic_permalink($topic_id) . '" rel="v:url" property="v:title">' . bbp_get_topic_title($topic_id) . '</a></div>';
} else {
$item[] = '';
}
if (bbp_is_topic_split()) {
$item[] = __('Split', 'framework');
} elseif (bbp_is_topic_merge()) {
$item[] = __('Merge', 'framework');
} elseif (bbp_is_topic_edit()) {
$item[] = __('Edit', 'framework');
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item[] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_reply_url($reply_id) . '" rel="v:url" property="v:title">' . bbp_get_reply_title($reply_id) . '</a></div>';
$item[] = __('Edit', '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, breadcrumbs_plus_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[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_user_profile_url() . '" rel="v:url" property="v:title">' . bbp_get_displayed_user_field('display_name') . '</a></div>';
$item[] = __('Edit', 'framework');
} else {
$item[] = bbp_get_displayed_user_field('display_name');
}
}
return apply_filters('breadcrumbs_plus_get_bbpress_items', $item, $args);
}
示例13: hook_bbp_new_topic
function hook_bbp_new_topic($topic_id)
{
$topic_url = bbp_get_topic_permalink($topic_id);
//$dir = $this->get_folder() . '' . substr($topic_url, strlen(get_option('home'))) . '/';
$dir = $this->get_folder() . '/' . substr($topic_url, strpos($topic_url, '://') + 3) . '/';
$this->remove_dir($dir);
$forum_id = bbp_get_topic_forum_id($topic_id);
$forum_url = bbp_get_forum_permalink($forum_id);
$dir = $this->get_folder() . '/' . substr($topic_url, strpos($forum_url, '://') + 3) . '/';
//$dir = $this->get_folder() . '' . substr($forum_url, strlen(get_option('home'))) . '/';
$this->remove_dir($dir);
}
示例14: _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;
}
示例15: ct_bbp_new_pre_content
/**
* Public filter 'bbp_*' - Checks topics, replies by cleantalk
* @param mixed[] $comment Comment string
* @return mixed[] $comment Comment string
*/
function ct_bbp_new_pre_content($comment)
{
global $ct_options, $ct_data;
$ct_options = ct_get_options();
$ct_data = ct_get_data();
if (ct_is_user_enable() === false || $ct_options['comments_test'] == 0 || is_user_logged_in()) {
return $comment;
}
$checkjs = js_test('ct_checkjs', $_COOKIE, true);
if ($checkjs === null) {
$checkjs = js_test('ct_checkjs', $_POST, true);
}
$example = null;
$sender_info = array('sender_url' => isset($_POST['bbp_anonymous_website']) ? $_POST['bbp_anonymous_website'] : null);
$post_info['comment_type'] = 'bbpress_comment';
$post_info['post_url'] = bbp_get_topic_permalink();
$post_info = json_encode($post_info);
if ($post_info === false) {
$post_info = '';
}
$ct_base_call_result = ct_base_call(array('message' => $comment, 'example' => $example, 'sender_email' => isset($_POST['bbp_anonymous_email']) ? $_POST['bbp_anonymous_email'] : null, 'sender_nickname' => isset($_POST['bbp_anonymous_name']) ? $_POST['bbp_anonymous_name'] : null, 'post_info' => $post_info, 'checkjs' => $checkjs, 'sender_info' => $sender_info));
$ct = $ct_base_call_result['ct'];
$ct_result = $ct_base_call_result['ct_result'];
if ($ct_result->stop_queue == 1 || $ct_result->spam == 1 || $ct_result->allow == 0 && $ct_result->stop_words !== null) {
bbp_add_error('bbp_reply_content', $ct_result->comment);
}
return $comment;
}