} ?> <li class="<?php if (bbp_is_single_user_edit()) { ?> current<?php } ?> "> <span class="bbp-user-edit-link"> <a href="<?php bbp_user_profile_edit_url(); ?> " title="<?php printf(esc_attr__("Edit %s's profile", 'govintranet'), bbp_get_displayed_user_field('display_name')); ?> "><?php _e('Edit profile', 'govintranet'); ?> </a> </span> </li> <?php } ?> </ul> </div><!-- #bbp-user-navigation --> </div><!-- #bbp-single-user-details -->
} ?> <li class="<?php if (bbp_is_single_user_edit()) { ?> current<?php } ?> "> <span class="bbp-user-edit-link"> <a href="<?php bbp_user_profile_edit_url(); ?> " title="<?php printf(esc_attr__("Edit %s's Profile", 'bbpress'), bbp_get_displayed_user_field('display_name')); ?> "><?php _e('Edit', 'bbpress'); ?> </a> </span> </li> <?php } ?> </ul> </div><!-- #bbp-user-navigation --> </div><!-- #bbp-single-user-details -->
*/ ?> <?php do_action('bbp_template_before_user_profile'); ?> <div id="bbp-user-profile" class="bbp-user-profile"> <h2 class="entry-title"><?php _e('Profile', 'bbpress'); ?> </h2> <div class="bbp-user-section"> <?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"><span class="bold"><?php printf(__('Forum Role:', 'corporative')); ?> </span><?php
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; }
/** * Handles the front end user editing * * @uses is_multisite() To check if it's a multisite * @uses bbp_is_user_home() To check if the user is at home (the display page * is the one of the logged in user) * @uses get_option() To get the displayed user's new email id option * @uses wpdb::prepare() To sanitize our sql query * @uses wpdb::get_var() To execute our query and get back the variable * @uses wpdb::query() To execute our query * @uses wp_update_user() To update the user * @uses delete_option() To delete the displayed user's email id option * @uses bbp_get_user_profile_edit_url() To get the edit profile url * @uses wp_safe_redirect() To redirect to the url * @uses bbp_verify_nonce_request() To verify the nonce and check the request * @uses current_user_can() To check if the current user can edit the user * @uses do_action() Calls 'personal_options_update' or * 'edit_user_options_update' (based on if it's the user home) * with the displayed user id * @uses edit_user() To edit the user based on the post data * @uses get_userdata() To get the user data * @uses is_email() To check if the string is an email id or not * @uses wpdb::get_blog_prefix() To get the blog prefix * @uses is_network_admin() To check if the user is the network admin * @uses is_super_admin() To check if the user is super admin * @uses revoke_super_admin() To revoke super admin priviledges * @uses grant_super_admin() To grant super admin priviledges * @uses is_wp_error() To check if the value retrieved is a {@link WP_Error} */ function bbp_edit_user_handler() { // Bail if not a POST action if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) { return; } // Bail if action is not 'bbp-update-user' if (empty($_POST['action']) || 'bbp-update-user' !== $_POST['action']) { return; } // Get the displayed user ID $user_id = bbp_get_displayed_user_id(); // Execute confirmed email change. See send_confirmation_on_profile_email(). if (is_multisite() && bbp_is_user_home_edit() && isset($_GET['newuseremail'])) { $new_email = get_option($user_id . '_new_email'); if ($new_email['hash'] == $_GET['newuseremail']) { $user = new stdClass(); $user->ID = $user_id; $user->user_email = esc_html(trim($new_email['newemail'])); global $wpdb; if ($wpdb->get_var($wpdb->prepare("SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", bbp_get_displayed_user_field('user_login')))) { $wpdb->query($wpdb->prepare("UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, bbp_get_displayed_user_field('user_login'))); } wp_update_user(get_object_vars($user)); delete_option($user_id . '_new_email'); wp_safe_redirect(add_query_arg(array('updated' => 'true'), bbp_get_user_profile_edit_url($user_id))); exit; } // Delete new email address from user options } elseif (is_multisite() && bbp_is_user_home_edit() && !empty($_GET['dismiss']) && $user_id . '_new_email' == $_GET['dismiss']) { delete_option($user_id . '_new_email'); wp_safe_redirect(add_query_arg(array('updated' => 'true'), bbp_get_user_profile_edit_url($user_id))); exit; } // Nonce check if (!bbp_verify_nonce_request('update-user_' . $user_id)) { bbp_add_error('bbp_update_user_nonce', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress')); return; } // Cap check if (!current_user_can('edit_user', $user_id)) { bbp_add_error('bbp_update_user_capability', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress')); return; } // Do action based on who's profile you're editing $edit_action = bbp_is_user_home_edit() ? 'personal_options_update' : 'edit_user_profile_update'; do_action($edit_action, $user_id); // Handle user edit $edit_user = edit_user($user_id); // Error(s) editng the user, so copy them into the global if (is_wp_error($edit_user)) { bbpress()->errors = $edit_user; // Successful edit to redirect } elseif (is_integer($edit_user)) { // Maybe update super admin ability if (is_multisite() && !bbp_is_user_home_edit()) { empty($_POST['super_admin']) ? revoke_super_admin($edit_user) : grant_super_admin($edit_user); } $redirect = add_query_arg(array('updated' => 'true'), bbp_get_user_profile_edit_url($edit_user)); wp_safe_redirect($redirect); exit; } }
function mk_theme_breadcrumbs() { global $mk_options, $post; $post_id = global_get_post_id(); if ($post_id) { $local_skining = get_post_meta($post_id, '_enable_local_backgrounds', true); $breadcrumb_skin = get_post_meta($post_id, '_breadcrumb_skin', true); if ($local_skining == 'true' && !empty($breadcrumb_skin)) { $breadcrumb_skin_class = $breadcrumb_skin; } else { $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; } } else { $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; } $delimiter = ' / '; echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; if (!is_front_page()) { echo '<a href="'; echo home_url(); echo '">' . __('Home', 'mk_framework'); echo "</a>" . $delimiter; } if (function_exists('is_woocommerce') && is_woocommerce() && is_archive()) { $shop_page_id = wc_get_page_id('shop'); $shop_page = get_post($shop_page_id); $permalinks = get_option('woocommerce_permalinks'); if ($shop_page_id && $shop_page && get_option('page_on_front') !== $shop_page_id) { echo '<a href="' . get_permalink($shop_page) . '">' . $shop_page->post_title . '</a> '; } } if (is_category() && !is_singular('portfolio')) { $category = get_the_category(); $ID = $category[0]->cat_ID; echo is_wp_error($cat_parents = get_category_parents($ID, TRUE, '', FALSE)) ? '' : '<span>' . $cat_parents . '</span>'; } else { if (is_singular('news')) { echo '<span>' . get_the_title() . '</span>'; } else { if (is_single() && !is_attachment()) { if (get_post_type() == 'product') { if ($terms = wc_get_product_terms($post->ID, 'product_cat', array('orderby' => 'parent', 'order' => 'DESC'))) { $main_term = $terms[0]; $ancestors = get_ancestors($main_term->term_id, 'product_cat'); $ancestors = array_reverse($ancestors); foreach ($ancestors as $ancestor) { $ancestor = get_term($ancestor, 'product_cat'); if (!is_wp_error($ancestor) && $ancestor) { echo '<a href="' . get_term_link($ancestor->slug, 'product_cat') . '">' . $ancestor->name . '</a>' . $delimiter; } } echo '<a href="' . get_term_link($main_term->slug, 'product_cat') . '">' . $main_term->name . '</a>' . $delimiter; } echo get_the_title(); } elseif (is_singular('portfolio')) { $portfolio_category = get_the_term_list($post->ID, 'portfolio_category', '', ' / '); if (!empty($portfolio_category)) { echo $portfolio_category . $delimiter; } echo '<span>' . get_the_title() . '</span>'; } elseif (get_post_type() != 'post') { if (function_exists('is_bbpress') && is_bbpress()) { } else { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo '<a href="' . get_post_type_archive_link(get_post_type()) . '">' . $post_type->labels->singular_name . '</a>' . $delimiter; echo get_the_title(); } } else { $cat = current(get_the_category()); echo get_category_parents($cat, true, $delimiter); echo get_the_title(); } } elseif (is_page() && !$post->post_parent) { echo get_the_title(); } elseif (is_page() && $post->post_parent) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>'; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($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>"; }
/** * Add priority support status to users * * @since 1.0.0 * @return void */ function edd_bbp_add_user_priority_support_status() { if (!current_user_can('moderate')) { return; } elseif (!function_exists('rcp_get_status')) { return; } $user_id = bbp_get_displayed_user_field('ID'); echo '<div class="rcp_support_status">'; echo '<h4>Priority Support Access</h4>'; if (rcp_is_active($user_id)) { echo '<p>Has <strong>Priority Support</strong> access.</p>'; } elseif (rcp_is_expired($user_id)) { echo '<p><strong>Priority Support</strong> access has <span style="color:red;">expired</span>.</p>'; } else { echo '<p>Has no priority support accesss</p>'; } echo '</div>'; }
/** * Gets the items for the breadcrumb trail if bbPress is installed. * * @since 0.5.0 * @access public * @param array $args Mixed arguments for the menu. * @return array List of items to be shown in the trail. */ function breadcrumb_trail_get_bbpress_items($args = array()) { /* Set up a new trail items array. */ $trail = array(); /* Get the forum post type object. */ $post_type_object = get_post_type_object(bbp_get_forum_post_type()); /* If not viewing the forum root/archive page and a forum archive exists, add it. */ if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) { $trail[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>'; } /* If viewing the forum root/archive. */ if (bbp_is_forum_archive()) { $trail[] = "<span>" . bbp_get_forum_archive_title() . "</span>"; } elseif (bbp_is_topic_archive()) { $trail[] = "<span>" . bbp_get_topic_archive_title() . "</span>"; } elseif (bbp_is_topic_tag()) { $trail[] = "<span>" . bbp_get_topic_tag_name() . "</span>"; } elseif (bbp_is_topic_tag_edit()) { $trail[] = '<a href="' . bbp_get_topic_tag_link() . '">' . bbp_get_topic_tag_name() . '</a>'; $trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>"; } elseif (bbp_is_single_view()) { $trail[] = '<span>' . bbp_get_view_title() . '</span>'; } elseif (bbp_is_single_topic()) { /* Get the queried topic. */ $topic_id = get_queried_object_id(); /* Get the parent items for the topic, which would be its forum (and possibly forum grandparents). */ $trail = array_merge($trail, breadcrumb_trail_get_parents(bbp_get_topic_forum_id($topic_id))); /* If viewing a split, merge, or edit topic page, show the link back to the topic. Else, display topic title. */ if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) { $trail[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>'; } else { $trail[] = '<span>' . bbp_get_topic_title($topic_id) . '</span>'; } /* If viewing a topic split page. */ if (bbp_is_topic_split()) { $trail[] = "<span>" . __('Split', 'kleo_framework') . "</span>"; } elseif (bbp_is_topic_merge()) { $trail[] = "<span>" . __('Merge', 'kleo_framework') . "</span>"; } elseif (bbp_is_topic_edit()) { $trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>"; } } elseif (bbp_is_single_reply()) { /* Get the queried reply object ID. */ $reply_id = get_queried_object_id(); /* Get the parent items for the reply, which should be its topic. */ $trail = array_merge($trail, breadcrumb_trail_get_parents(bbp_get_reply_topic_id($reply_id))); /* If viewing a reply edit page, link back to the reply. Else, display the reply title. */ if (bbp_is_reply_edit()) { $trail[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>'; $trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>"; } else { $trail[] = '<span>' . bbp_get_reply_title($reply_id) . '</span>'; } } elseif (bbp_is_single_forum()) { /* Get the queried forum ID and its parent forum ID. */ $forum_id = get_queried_object_id(); $forum_parent_id = bbp_get_forum_parent_id($forum_id); /* If the forum has a parent forum, get its parent(s). */ if (0 !== $forum_parent_id) { $trail = array_merge($trail, breadcrumb_trail_get_parents($forum_parent_id)); } /* Add the forum title to the end of the trail. */ $trail[] = '<span>' . bbp_get_forum_title($forum_id) . '</span>'; } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) { if (bbp_is_single_user_edit()) { $trail[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>'; $trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>"; } else { $trail[] = '<span>' . bbp_get_displayed_user_field('display_name') . '</span>'; } } /* Return the bbPress breadcrumb trail items. */ return apply_filters('breadcrumb_trail_get_bbpress_items', $trail, $args); }
/** * Sends an email when an email address change occurs on POST requests * * @since 2.6.0 bbPress (r5660) * * @see send_confirmation_on_profile_email() * * @uses bbp_parse_args() To parse the option arguments * @uses bbp_add_error() To provide feedback to user * @uses bbp_get_displayed_user_field() To get the user_login * @uses bbp_get_user_profile_edit_url() To get the user profile edit link * @uses add_query_arg() To add arguments the link * @uses wp_mail() To send the notification */ function bbp_edit_user_email_send_notification($user_id = 0, $args = array()) { // Parse args $r = bbp_parse_args($args, array('hash' => '', 'newemail' => '')); // Bail if any relevant parameters are empty if (empty($user_id) || empty($r['hash']) || empty($r['newemail'])) { bbp_add_error('bbp_user_email_invalid_hash', __('<strong>ERROR</strong>: An error occurred while updating your email address.', 'bbpress'), array('form-field' => 'email')); return; } // Build the nonced URL to dismiss the pending change $user_login = bbp_get_displayed_user_field('user_login', 'raw'); $user_url = bbp_get_user_profile_edit_url($user_id); $confirm_url = add_query_arg(array('action' => 'bbp-update-user-email', 'newuseremail' => $r['hash']), $user_url); $email_text = __('%1$s Someone requested a change to the email address on your account. Please click the following link to confirm this change: %2$s If you did not request this, you can safely ignore and delete this notification. This email was sent to: %3$s Regards, The %4$s Team %5$s', 'bbpress'); /** * Filter the email text sent when a user changes emails. * * The following strings have a special meaning and will get replaced dynamically: * * %1$s - The current user's username * %2$s - The link to click on to confirm the email change * %3$s - The new email * %4$s - The name of the site * %5$s - The URL to the site * * @param string $email_text Text in the email. * @param string $r New user email that the current user has changed to. */ $content = apply_filters('bbp_user_email_update_content', $email_text, $r); // Build the email message $message = sprintf($content, $user_login, $confirm_url, $r['newemail'], get_site_option('site_name'), network_home_url()); // Build the email subject $subject = sprintf(__('[%s] New Email Address', 'bbpress'), wp_specialchars_decode(get_option('blogname'))); // Send the email wp_mail($r['newemail'], $subject, $message); }
/** * Get the user profile edit template * * @since bbPress (r3311) * * @uses bbp_get_displayed_user_id() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_single_user_edit_template() { $nicename = bbp_get_displayed_user_field('user_nicename'); $user_id = bbp_get_displayed_user_id(); $templates = array('single-user-edit-' . $nicename . '.php', 'single-user-edit-' . $user_id . '.php', 'single-user-edit.php', 'user-edit.php', 'user.php'); return bbp_get_query_template('profile_edit', $templates); }
public function bbpen_preferences_area() { ?> <div> <label for="">Email notifications</label> <label> <input type="checkbox" name="bbpen_email_me" style="width: auto;" <?php echo $this->can_notify(bbp_get_displayed_user_field('ID')) ? 'checked="checked"' : ''; ?> /> <?php echo $this->settings['pref_label']; ?> </label> </div> <?php }
?> <?php do_action( 'bbp_template_before_user_details' ); ?> <div id="bbp-single-user-details"> <div id="bbp-user-avatar"> <span class='vcard'> <a class="url fn n" href="<?php bbp_user_profile_url(); ?>" title="<?php bbp_displayed_user_field( 'display_name' ); ?>" rel="me"> <?php echo get_avatar( bbp_get_displayed_user_field( 'user_email' ), apply_filters( 'bbp_single_user_details_avatar_size', 150 ) ); ?> </a> </span> </div><!-- #author-avatar --> <div id="bbp-user-navigation"> <ul> <li class="<?php if ( bbp_is_single_user_profile() ) :?>current<?php endif; ?>"> <span class="vcard bbp-user-profile-link"> <a class="url fn n" href="<?php bbp_user_profile_url(); ?>" title="<?php printf( __( "%s's Profile", 'bbpress' ), esc_attr( bbp_get_displayed_user_field( 'display_name' ) ) ); ?>" rel="me"><?php _e( 'Profile', 'bbpress' ); ?></a> </span> </li> <li class="<?php if ( bbp_is_single_user_topics() ) :?>current<?php endif; ?>"> <span class='bbp-user-topics-created-link'> <a href="<?php bbp_user_topics_created_url(); ?>" title="<?php printf( __( "%s's Topics Started", 'bbpress' ), esc_attr( bbp_get_displayed_user_field( 'display_name' ) ) ); ?>"><?php _e( 'Topics Started', 'bbpress' ); ?></a> </span> </li> <li class="<?php if ( bbp_is_single_user_replies() ) :?>current<?php endif;
?> </legend> <?php do_action('bbp_user_edit_before_signature'); ?> <div> <label for="signature"><?php _e("Signature", "gd-bbpress-tools"); ?> </label> <fieldset class="bbp-form password"> <textarea name="signature" id="signature" rows="5" cols="30" tabindex="<?php bbp_tab_index(); ?> " style="width: 100%;"><?php echo esc_attr(bbp_get_displayed_user_field('signature')); ?> </textarea> <span class="description"> <?php echo sprintf(__("Signature length is limited to %s characters.", "gd-bbpress-tools"), $this->max_length); ?> <br/> <?php do_action('bbp_user_edit_signature_info'); ?> </span> </fieldset> </div> <?php do_action('bbp_user_edit_after_signature');
} ?> </span> <div id="entry-author-info"> <div id="author-avatar"> <?php echo get_avatar(bbp_get_displayed_user_field('user_email'), apply_filters('twentyten_author_bio_avatar_size', 60)); ?> </div><!-- #author-avatar --> <div id="author-description"> <h1><?php printf(__('About %s', 'bbpress'), bbp_get_displayed_user_field('display_name')); ?> </h1> <?php bbp_displayed_user_field('description'); ?> </div><!-- #author-description --> </div><!-- #entry-author-info --> <?php $user_id = bbp_get_user_id(); $curr_user_id = bbp_get_user_id('', false, true); $items = get_user_meta($user_id, $key = 'purchased_items', $single = true); if (current_user_can('manage_options') || $user_id == $curr_user_id && is_user_logged_in()) {
/** * Output a sanitized user field value * * This function relies on the $filter parameter to decide how to sanitize * the field value that it finds. Since it uses the WP_User object's magic * __get() method, it can also be used to get user_meta values. * * @since 2.0.0 bbPress (r2688) * * @param string $field Field to get * @param string $filter How to filter the field value (null|raw|db|display|edit) * @uses bbp_get_displayed_user_field() To get the field */ function bbp_displayed_user_field($field = '', $filter = 'display') { echo bbp_get_displayed_user_field($field, $filter); }
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; }
/** * 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); }
/** * Reset main query vars and filter 'the_content' to output a bbPress * template part as needed. * * @since 2.0.0 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_search() To check if page is search * @uses bbp_get_search_template() To get search 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_move() To check if page is reply move * @uses bbp_get_reply_move_template() To get reply move 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 a root template was already found. This prevents unintended * recursive filtering of 'the_content'. * * @link https://bbpress.trac.wordpress.org/ticket/2429 */ if (bbp_is_template_included()) { return $template; } /** * If BuddyPress is activated at a network level, the action order is * reversed, which causes the template integration to fail. If we're looking * at a BuddyPress page here, bail to prevent the extra processing. * * This is a bit more brute-force than is probably necessary, but gets the * job done while we work towards something more elegant. */ if (function_exists('is_buddypress') && is_buddypress()) { return $template; } // Define local variable(s) $bbp_shortcodes = bbpress()->shortcodes; // Bail if shortcodes are unset somehow if (!is_a($bbp_shortcodes, 'BBP_Shortcodes')) { 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' => bbp_buffer_template_part('content', 'single-user', false), 'post_type' => '', 'post_title' => bbp_get_displayed_user_field('display_name'), 'post_status' => bbp_get_public_status_id(), 'is_single' => true, 'is_archive' => false, 'comment_status' => 'closed')); /** Forums ************************************************************/ // Forum archive } elseif (bbp_is_forum_archive()) { // Page exists where this archive should be $page = bbp_get_page_by_path(bbp_get_root_slug()); // Should we replace the content... if (empty($page->post_content)) { // Use the topics archive if ('topics' === bbp_show_on_root()) { $new_content = $bbp_shortcodes->display_topic_index(); // No page so show the archive } else { $new_content = $bbp_shortcodes->display_forum_index(); } // ...or use the existing page content? } else { $new_content = apply_filters('the_content', $page->post_content); } // Should we replace the title... if (empty($page->post_title)) { // Use the topics archive if ('topics' === bbp_show_on_root()) { $new_title = bbp_get_topic_archive_title(); // No page so show the archive } else { $new_title = bbp_get_forum_archive_title(); } // ...or use the existing page title? } else { $new_title = apply_filters('the_title', $page->post_title); } // Reset post bbp_theme_compat_reset_post(array('ID' => !empty($page->ID) ? $page->ID : 0, 'post_title' => $new_title, 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_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()) { // 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' => $bbp_shortcodes->display_forum_form(), 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_forum_visibility(), 'is_single' => true, 'comment_status' => 'closed')); } elseif (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' => $bbp_shortcodes->display_forum(array('id' => 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()) { // Page exists where this archive should be $page = bbp_get_page_by_path(bbp_get_topic_archive_slug()); // Should we replace the content... if (empty($page->post_content)) { $new_content = $bbp_shortcodes->display_topic_index(); // ...or use the existing page content? } else { $new_content = apply_filters('the_content', $page->post_content); } // Should we replace the title... if (empty($page->post_title)) { $new_title = bbp_get_topic_archive_title(); // ...or use the existing page title? } else { $new_title = apply_filters('the_title', $page->post_title); } // Reset post bbp_theme_compat_reset_post(array('ID' => !empty($page->ID) ? $page->ID : 0, 'post_title' => bbp_get_topic_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed')); // Single Topic } elseif (bbp_is_topic_edit() || bbp_is_single_topic()) { // Split if (bbp_is_topic_split()) { $new_content = bbp_buffer_template_part('form', 'topic-split', false); // Merge } elseif (bbp_is_topic_merge()) { $new_content = bbp_buffer_template_part('form', 'topic-merge', false); // Edit } elseif (bbp_is_topic_edit()) { $new_content = $bbp_shortcodes->display_topic_form(); // Single } else { $new_content = $bbp_shortcodes->display_topic(array('id' => bbp_get_topic_id())); } // Reset post bbp_theme_compat_reset_post(array('ID' => bbp_get_topic_id(), 'post_title' => bbp_get_topic_title(), 'post_author' => bbp_get_topic_author_id(), 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_topic_status(), 'is_single' => true, 'comment_status' => 'closed')); /** Replies ***********************************************************/ // Reply archive } elseif (is_post_type_archive(bbp_get_reply_post_type())) { // Reset post bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Replies', 'bbpress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_reply_index(), 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed')); // Single Reply } elseif (bbp_is_reply_edit() || bbp_is_single_reply()) { // Move if (bbp_is_reply_move()) { $new_content = bbp_buffer_template_part('form', 'reply-move', false); // Edit } elseif (bbp_is_reply_edit()) { $new_content = $bbp_shortcodes->display_reply_form(); // Single } else { $new_content = $bbp_shortcodes->display_reply(array('id' => get_the_ID())); } // Reset post bbp_theme_compat_reset_post(array('ID' => bbp_get_reply_id(), 'post_title' => bbp_get_reply_title(), 'post_author' => bbp_get_reply_author_id(), 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_reply_status(), 'comment_status' => 'closed')); /** Views *************************************************************/ } elseif (bbp_is_single_view()) { // Reset post bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_view_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_view(array('id' => get_query_var(bbp_get_view_rewrite_id()))), 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed')); /** Search ************************************************************/ } elseif (bbp_is_search()) { // Reset post bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_search_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_search(array('search' => get_query_var(bbp_get_search_rewrite_id()))), 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed')); /** Topic Tags ********************************************************/ // Topic Tag Edit } elseif (bbp_is_topic_tag_edit() || bbp_is_topic_tag()) { // Stash the current term in a new var set_query_var('bbp_topic_tag', get_query_var('term')); // Show topics of tag if (bbp_is_topic_tag()) { $new_content = $bbp_shortcodes->display_topics_of_tag(array('id' => bbp_get_topic_tag_id())); // Edit topic tag } elseif (bbp_is_topic_tag_edit()) { $new_content = $bbp_shortcodes->display_topic_tag_form(); } // Reset the post with our new title bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_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', 'is_tax' => true)); } /** * 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... * * We do this after the above checks to prevent incorrect 404 body classes * and header statuses, as well as to set the post global as needed. * * @see https://bbpress.trac.wordpress.org/ticket/1478/ */ if (bbp_is_template_included()) { return $template; /** * 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. */ } elseif (bbp_is_theme_compat_active()) { bbp_remove_all_filters('the_content'); $template = bbp_get_theme_compat_templates(); } return apply_filters('bbp_template_include_theme_compat', $template); }
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); }
public function editor_form_bbpress() { $_signature = bbp_get_displayed_user_field('signature'); $form = apply_filters('d4p_bbpresstools_signature_editor_file', GDBBPRESSTOOLS_PATH.'forms/tools/signature_bbpress.php'); include_once($form); }
_e('Email', 'bbpress'); ?> </label> <input type="text" name="email" id="email" value="<?php echo esc_attr(bbp_get_displayed_user_field('user_email')); ?> " class="regular-text" tabindex="<?php bbp_tab_index(); ?> " /> <?php // Handle address change requests $new_email = get_option(bbp_get_displayed_user_id() . '_new_email'); if ($new_email && $new_email != bbp_get_displayed_user_field('user_email')) { ?> <span class="updated inline"> <?php printf(__('There is a pending email address change to <code>%1$s</code>. <a href="%2$s">Cancel</a>', 'bbpress'), $new_email['newemail'], esc_url(self_admin_url('user.php?dismiss=' . bbp_get_current_user_id() . '_new_email'))); ?> </span> <?php } ?> </div>
protected function get_page_header_title() { global $oxy_theme_options; if (bbp_is_forum_archive()) { return $oxy_theme_options['bbpress_header_forums']; } else { if (bbp_is_topic_archive()) { return $oxy_theme_options['bbpress_header_topics']; } else { if (bbp_is_single_view()) { return bbp_get_view_title(); } else { if (bbp_is_single_forum()) { return bbp_get_forum_title(); } else { if (bbp_is_single_topic()) { return bbp_get_topic_title(); } else { if (bbp_is_topic_tag()) { return __('Tag: ', 'omega-td') . bbp_get_topic_tag_name(); } else { if (bbp_is_single_reply()) { return bbp_get_reply_title(); } else { if (bbp_is_topic_tag_edit()) { return __('Edit', 'omega-td'); } else { if (bbp_is_search()) { return bbp_get_search_title(); } else { if (bbp_is_single_user()) { return bbp_get_displayed_user_field('display_name'); } else { return get_the_title(); } } } } } } } } } } }
/** * 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(); } return apply_filters('bbp_template_include_theme_compat', $template); }
/** * Output a sanitized user field value * * @since bbPress (r2688) * * @param string $field Field to get * @uses bbp_get_displayed_user_field() To get the field */ function bbp_displayed_user_field($field = '') { echo bbp_get_displayed_user_field($field); }
/** * Get the user subscriptions template * * @since bbPress (r4225) * * @uses bbp_get_displayed_user_id() * @uses bbp_get_query_template() * @return string Path to template file */ function bbp_get_subscriptions_template() { $nicename = bbp_get_displayed_user_field('user_nicename'); $user_id = bbp_get_displayed_user_id(); $templates = array('single-user-subscriptions-' . $nicename . '.php', 'single-user-subscriptions-' . $user_id . '.php', 'subscriptions-' . $nicename . '.php', 'subscriptions-' . $user_id . '.php', 'subscriptions.php', 'user.php'); return bbp_get_query_template('subscriptions', $templates); }
/** * Mark a users topics and replies as spam when the user is marked as spam * * @since bbPress (r3405) * * @global WPDB $wpdb * @param int $user_id Optional. User ID to unspam. Defaults to displayed user. * * @uses bbp_is_single_user() * @uses bbp_is_user_home() * @uses bbp_get_displayed_user_field() * @uses is_super_admin() * @uses get_blogs_of_user() * @uses bbp_get_topic_post_type() * @uses bbp_get_reply_post_type() * @uses switch_to_blog() * @uses get_post_type() * @uses bbp_unspam_topic() * @uses bbp_unspam_reply() * @uses restore_current_blog() * * @return If no user ID passed */ function bbp_make_ham_user($user_id = 0) { // Use displayed user if it's not yourself if (empty($user_id) && bbp_is_single_user() && !bbp_is_user_home()) { $user_id = bbp_get_displayed_user_field(); } // Bail if no user ID if (empty($user_id)) { return; } // Bail if user ID is super admin if (is_super_admin($user_id)) { return; } // Arm the torpedos global $wpdb; // Get the blog IDs of the user to mark as spam $blogs = get_blogs_of_user($user_id, true); // If user has no blogs, they are a guest on this site if (empty($blogs)) { $blogs[$wpdb->blogid] = array(); } // We only need the keys $blogs = array_keys($blogs); // Make array of post types to mark as spam $post_types = array(bbp_get_topic_post_type(), bbp_get_reply_post_type()); $post_types = "'" . implode("', '", $post_types) . "'"; $status = bbp_get_spam_status_id(); // Loop through blogs and remove their posts foreach ((array) $blogs as $blog_id) { // Switch to the blog ID switch_to_blog($blog_id); // Get topics and replies $posts = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_author = {$user_id} AND post_status = '{$status}' AND post_type IN ({$post_types})"); // Loop through posts and spam them if (!empty($posts)) { foreach ($posts as $post_id) { // The routines for topics ang replies are different, so use the // correct one based on the post type switch (get_post_type($post_id)) { case bbp_get_topic_post_type(): bbp_unspam_topic($post_id); break; case bbp_get_reply_post_type(): bbp_unspam_reply($post_id); break; } } } // Switch back to current blog restore_current_blog(); } }
/** * Runs through the various bbPress conditional tags to check the current page being viewed. Once * a condition is met, add items to the $items array. * * @since 0.6.0 * @access public * @return void */ public function do_trail_items() { /* Add the network and site home links. */ $this->do_network_home_link(); $this->do_site_home_link(); /* Get the forum post type object. */ $post_type_object = get_post_type_object(bbp_get_forum_post_type()); /* If not viewing the forum root/archive page and a forum archive exists, add it. */ if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) { $this->items[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>'; } /* If viewing the forum root/archive. */ if (bbp_is_forum_archive()) { if (true === $this->args['show_title']) { $this->items[] = bbp_get_forum_archive_title(); } } elseif (bbp_is_topic_archive()) { if (true === $this->args['show_title']) { $this->items[] = bbp_get_topic_archive_title(); } } elseif (bbp_is_topic_tag()) { if (true === $this->args['show_title']) { $this->items[] = bbp_get_topic_tag_name(); } } elseif (bbp_is_topic_tag_edit()) { $this->items[] = '<a href="' . bbp_get_topic_tag_link() . '">' . bbp_get_topic_tag_name() . '</a>'; if (true === $this->args['show_title']) { $this->items[] = __('Edit', 'breadcrumb-trail'); } } elseif (bbp_is_single_view()) { if (true === $this->args['show_title']) { $this->items[] = bbp_get_view_title(); } } elseif (bbp_is_single_topic()) { /* Get the queried topic. */ $topic_id = get_queried_object_id(); /* Get the parent items for the topic, which would be its forum (and possibly forum grandparents). */ $this->do_post_parents(bbp_get_topic_forum_id($topic_id)); /* If viewing a split, merge, or edit topic page, show the link back to the topic. Else, display topic title. */ if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) { $this->items[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>'; } elseif (true === $this->args['show_title']) { $this->items[] = bbp_get_topic_title($topic_id); } /* If viewing a topic split page. */ if (bbp_is_topic_split() && true === $this->args['show_title']) { $this->items[] = __('Split', 'breadcrumb-trail'); } elseif (bbp_is_topic_merge() && true === $this->args['show_title']) { $this->items[] = __('Merge', 'breadcrumb-trail'); } elseif (bbp_is_topic_edit() && true === $this->args['show_title']) { $this->items[] = __('Edit', 'breadcrumb-trail'); } } elseif (bbp_is_single_reply()) { /* Get the queried reply object ID. */ $reply_id = get_queried_object_id(); /* Get the parent items for the reply, which should be its topic. */ $this->do_post_parents(bbp_get_reply_topic_id($reply_id)); /* If viewing a reply edit page, link back to the reply. Else, display the reply title. */ if (bbp_is_reply_edit()) { $this->items[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>'; if (true === $this->args['show_title']) { $this->items[] = __('Edit', 'breadcrumb-trail'); } } elseif (true === $this->args['show_title']) { $this->items[] = bbp_get_reply_title($reply_id); } } elseif (bbp_is_single_forum()) { /* Get the queried forum ID and its parent forum ID. */ $forum_id = get_queried_object_id(); $forum_parent_id = bbp_get_forum_parent_id($forum_id); /* If the forum has a parent forum, get its parent(s). */ if (0 !== $forum_parent_id) { $this->do_post_parents($forum_parent_id); } /* Add the forum title to the end of the trail. */ if (true === $this->args['show_title']) { $this->items[] = bbp_get_forum_title($forum_id); } } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) { if (bbp_is_single_user_edit()) { $this->items[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>'; if (true === $this->args['show_title']) { $this->items[] = __('Edit', 'breadcrumb-trail'); } } elseif (true === $this->args['show_title']) { $this->items[] = bbp_get_displayed_user_field('display_name'); } } /* Return the bbPress breadcrumb trail items. */ $this->items = apply_filters('breadcrumb_trail_get_bbpress_items', $this->items, $this->args); }
/** * 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()) { $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, 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[] = '<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', 'theme_front'); } elseif (bbp_is_topic_merge()) { $item[] = __('Merge', 'theme_front'); } elseif (bbp_is_topic_edit()) { $item[] = __('Edit', 'theme_front'); } } 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[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>'; $item[] = __('Edit', 'theme_front'); } } elseif (bbp_is_single_forum()) { $forum_id = get_queried_object_id(); $forum_parent_id = bbp_get_forum_parent($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[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>'; $item[] = __('Edit'); } else { $item[] = bbp_get_displayed_user_field('display_name'); } } return apply_filters('breadcrumbs_plus_get_bbpress_items', $item, $args); }
_e('Email', 'bbpress'); ?> </label> <input type="text" name="email" id="email" value="<?php bbp_displayed_user_field('user_email', 'edit'); ?> " class="regular-text" tabindex="<?php bbp_tab_index(); ?> " /> <?php // Handle address change requests $new_email = get_option(bbp_get_displayed_user_id() . '_new_email'); if (!empty($new_email) && $new_email !== bbp_get_displayed_user_field('user_email', 'edit')) { ?> <span class="updated inline"> <?php printf(__('There is a pending email address change to <code>%1$s</code>. <a href="%2$s">Cancel</a>', 'bbpress'), $new_email['newemail'], esc_url(self_admin_url('user.php?dismiss=' . bbp_get_current_user_id() . '_new_email'))); ?> </span> <?php } ?> </div>
} ?> <li class="<?php if (bbp_is_single_user_edit()) { ?> current<?php } ?> "> <span class="bbp-user-edit-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'); ?> </a> </span> </li> <?php } ?> </ul> </div><!-- #bbp-user-navigation --> </div><!-- #bbp-single-user-details -->