Beispiel #1
0
 /**
  * Get data from context
  * 
  * @since  1.0
  * @return array
  */
 public function get_context_data()
 {
     $data = array($this->id);
     if (function_exists('bbp_get_displayed_user_id')) {
         $data[] = bbp_get_displayed_user_id();
     }
     return $data;
 }
 function mycred_bbp_add_balance_in_profile()
 {
     $user_id = bbp_get_displayed_user_id();
     $mycred = mycred();
     if ($mycred->exclude_user($user_id)) {
         return;
     }
     $balance = $mycred->get_users_cred($user_id, $mycred->mycred_type);
     $layout = $mycred->plural() . ': ' . $mycred->format_creds($balance);
     $layout = apply_filters('mycred_bbp_authors_profile_balance', $layout, $balance, $user_id);
     echo apply_filters('mycred_bbp_profile_balance', '<div class="users-mycred-balance">' . $layout . '</div>', $user_id, $balance);
 }
Beispiel #3
0
 function avia_bbpress_breadcrumb($trail)
 {
     global $avia_config;
     if (isset($avia_config['currently_viewing']) && $avia_config['currently_viewing'] == 'forum' || get_post_type() === "forum" || get_post_type() === "topic") {
         $bc = bbp_get_breadcrumb();
         if (isset($avia_config['bbpress_trail'])) {
             $trail_zero = $trail[0];
             $trail = $avia_config['bbpress_trail'];
             $trail[0] = $trail_zero;
         }
         if (bbp_is_single_user_edit() || bbp_is_single_user()) {
             $user_info = get_userdata(bbp_get_displayed_user_id());
             $title = __("Profile for User:"******"avia_framework") . " " . $user_info->display_name;
             array_pop($trail);
             $trail[] = $title;
         }
     }
     return $trail;
 }
function bbps_lock_to_author($bbp_t)
{
    global $wp_query;
    //return if we are at a prem forum or the user is an admin or moderator	and we are not looking at a users profile page!
    if ((bbps_is_premium_forum(bbp_get_forum_id()) == false || current_user_can('administrator') || current_user_can('bbp_moderator')) && !bbp_is_single_user()) {
        return $bbp_t;
    }
    // is someone looking at a user page? if they are then we want to exclude all premium posts
    //and change the post author to be the users who profile it is
    if (bbp_is_single_user()) {
        $premium_topics = bbps_get_all_premium_topic_ids();
        $user_id = bbp_get_displayed_user_id();
        $bbp_t['post_author'] = $user_id;
        $bbp_t['author'] = $user_id;
        $bbp_t['post__not_in'] = $premium_topics;
        $bbp_t['post_type'] = 'topic';
        return $bbp_t;
    } else {
        //there is one problem with this - if the users ID is 0 then it still shows all topics
        //setting userid to -1 seems to do the trick .. better way perhapes?
        //ops no it doesnt do the trick so for lauch I will make it a huge number this will need to be revisited ASAP
        global $current_user;
        $current_user = wp_get_current_user();
        $user_id = $current_user->ID;
        if ($user_id == 0) {
            $user_id = 99999999;
        }
        //create the new query we only want to display topics from that user
        $bbp_t['post_author'] = $user_id;
        $bbp_t['author'] = $user_id;
        $bbp_t['post_type'] = 'topic';
        $bbp_t['show_stickies'] = 0;
        $bbp_t['posts_per_page'] = 30;
        //	exit('<pre>'.print_r($bbp_t,1).'</pre>');
        return $bbp_t;
    }
}
Beispiel #5
0
<?php

global $avia_config;
/*
 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
 */
get_header();
$title = "";
if (!is_singular()) {
    $title = __('Forums', "avia_framework");
}
if (function_exists('bbp_is_single_user_edit') && (bbp_is_single_user_edit() || bbp_is_single_user())) {
    $user_info = get_userdata(bbp_get_displayed_user_id());
    $title = __("Profile for User:"******"avia_framework") . " " . $user_info->display_name;
    if (bbp_is_single_user_edit()) {
        $title = __("Edit profile for User:"******"avia_framework") . " " . $user_info->display_name;
    }
}
$args = array();
if (!empty($title)) {
    $args['title'] = $title;
}
if (get_post_meta(get_the_ID(), 'header', true) != 'no') {
    echo avia_title($args);
}
?>
		
		<div class='container_wrap main_color <?php 
avia_layout_class('main');
?>
'>
/**
 * 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_id()
 * @uses bbp_is_user_keymaster()
 * @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_id();
    }
    // Bail if no user ID
    if (empty($user_id)) {
        return false;
    }
    // Bail if user ID is keymaster
    if (bbp_is_user_keymaster($user_id)) {
        return false;
    }
    // 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();
    }
    // 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) . "'";
    // Loop through blogs and remove their posts
    foreach ((array) array_keys($blogs) as $blog_id) {
        // Switch to the blog ID
        switch_to_blog($blog_id);
        // Get topics and replies
        $posts = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_author = %d AND post_status = '%s' AND post_type IN ( {$post_types} )", $user_id, bbp_get_spam_status_id()));
        // 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();
    }
    // Success
    return true;
}
Beispiel #7
0
 public function insert_into_bbpress_profile()
 {
     $user_id = bbp_get_displayed_user_id();
     mycred_display_users_badges($user_id);
 }
 /**
  * Insert Balance in bbPress Profiles
  * @since 1.1.1
  * @version 1.2
  */
 public function insert_balance_profile()
 {
     $user_id = bbp_get_displayed_user_id();
     if ($this->core->exclude_user($user_id) || $user_id == 0) {
         return;
     }
     $balance = $this->core->get_users_cred($user_id, $this->mycred_type);
     $layout = $this->core->plural() . ': ' . $this->core->format_creds($balance);
     echo apply_filters('mycred_bbp_profile_balance', '<div class="users-mycred-balance">' . $layout . '</div>', $layout, $user_id, $this);
 }
Beispiel #9
0
function ulike_bbp_add_scores_in_profile()
{
    global $wp_ulike_class;
    $user_id = bbp_get_displayed_user_id();
    $score = $wp_ulike_class->get_user_score($user_id);
    echo "<div class=\"ulike-section bbp-user-section\"><p>Благодарностей: <span class=\"\">{$score}</span></p></div>";
}
Beispiel #10
0
/**
 * Output forum role selector (for user edit)
 *
 * @since 2.2.0 bbPress (r4284)
 */
function bbp_edit_user_forums_role()
{
    // Return if no user is being edited
    if (!bbp_is_single_user_edit()) {
        return;
    }
    // Get the user's current forum role
    $user_role = bbp_get_user_role(bbp_get_displayed_user_id());
    // Get the folum roles
    $dynamic_roles = bbp_get_dynamic_roles();
    // Only keymasters can set other keymasters
    if (!bbp_is_user_keymaster()) {
        unset($dynamic_roles[bbp_get_keymaster_role()]);
    }
    ?>

	<select name="bbp-forums-role" id="bbp-forums-role">
		<option value=""><?php 
    esc_html_e('&mdash; No role for these forums &mdash;', 'bbpress');
    ?>
</option>

		<?php 
    foreach ($dynamic_roles as $role => $details) {
        ?>

			<option <?php 
        selected($user_role, $role);
        ?>
 value="<?php 
        echo esc_attr($role);
        ?>
"><?php 
        echo bbp_translate_user_role($details['name']);
        ?>
</option>

		<?php 
    }
    ?>

	</select>

	<?php 
}
Beispiel #11
0
/**
 * The main topic loop. WordPress makes this easy for us
 *
 * @since 2.0.0 bbPress (r2485)
 *
 * @param array $args All the arguments supported by {@link WP_Query}
 * @uses current_user_can() To check if the current user can edit other's topics
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses WP_Query To make query and get the topics
 * @uses is_page() To check if it's a page
 * @uses bbp_is_single_forum() To check if it's a forum
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_paged() To get the current page value
 * @uses bbp_get_super_stickies() To get the super stickies
 * @uses bbp_get_stickies() To get the forum stickies
 * @uses bbp_use_pretty_urls() To check if the site is using pretty URLs
 * @uses get_permalink() To get the permalink
 * @uses add_query_arg() To add custom args to the url
 * @uses apply_filters() Calls 'bbp_topics_pagination' with the pagination args
 * @uses paginate_links() To paginate the links
 * @uses apply_filters() Calls 'bbp_has_topics' with
 *                        bbPres::topic_query::have_posts()
 *                        and bbPres::topic_query
 * @return object Multidimensional array of topic information
 */
function bbp_has_topics($args = array())
{
    /** Defaults **************************************************************/
    // Other defaults
    $default_topic_search = !empty($_REQUEST['ts']) ? $_REQUEST['ts'] : false;
    $default_show_stickies = (bool) (bbp_is_single_forum() || bbp_is_topic_archive()) && false === $default_topic_search;
    $default_post_parent = bbp_is_single_forum() ? bbp_get_forum_id() : 'any';
    // Default argument array
    $default = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => $default_post_parent, 'meta_key' => '_bbp_last_active_time', 'meta_type' => 'DATETIME', 'orderby' => 'meta_value', 'order' => 'DESC', 'posts_per_page' => bbp_get_topics_per_page(), 'paged' => bbp_get_paged(), 'show_stickies' => $default_show_stickies, 'max_num_pages' => false);
    // Only add 's' arg if searching for topics
    // See https://bbpress.trac.wordpress.org/ticket/2607
    if (!empty($default_topic_search)) {
        $default['s'] = $default_topic_search;
    }
    // What are the default allowed statuses (based on user caps)
    if (bbp_get_view_all()) {
        // Default view=all statuses
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id(), bbp_get_pending_status_id());
        // Add support for private status
        if (current_user_can('read_private_topics')) {
            $post_statuses[] = bbp_get_private_status_id();
        }
        // Join post statuses together
        $default['post_status'] = implode(',', $post_statuses);
        // Lean on the 'perm' query var value of 'readable' to provide statuses
    } else {
        $default['perm'] = 'readable';
    }
    // Maybe query for topic tags
    if (bbp_is_topic_tag()) {
        $default['term'] = bbp_get_topic_tag_slug();
        $default['taxonomy'] = bbp_get_topic_tag_tax_id();
    }
    /** Setup *****************************************************************/
    // Parse arguments against default values
    $r = bbp_parse_args($args, $default, 'has_topics');
    // Get bbPress
    $bbp = bbpress();
    // Call the query
    $bbp->topic_query = new WP_Query($r);
    // Set post_parent back to 0 if originally set to 'any'
    if ('any' === $r['post_parent']) {
        $r['post_parent'] = 0;
    }
    // Limited the number of pages shown
    if (!empty($r['max_num_pages'])) {
        $bbp->topic_query->max_num_pages = $r['max_num_pages'];
    }
    /** Stickies **************************************************************/
    // Put sticky posts at the top of the posts array
    if (!empty($r['show_stickies']) && $r['paged'] <= 1) {
        // Get super stickies and stickies in this forum
        $stickies = bbp_get_super_stickies();
        // Get stickies for current forum
        if (!empty($r['post_parent'])) {
            $stickies = array_merge($stickies, bbp_get_stickies($r['post_parent']));
        }
        // Remove any duplicate stickies
        $stickies = array_unique($stickies);
        // We have stickies
        if (is_array($stickies) && !empty($stickies)) {
            // Start the offset at -1 so first sticky is at correct 0 offset
            $sticky_offset = -1;
            // Loop over topics and relocate stickies to the front.
            foreach ($stickies as $sticky_index => $sticky_ID) {
                // Get the post offset from the posts array
                $post_offsets = wp_filter_object_list($bbp->topic_query->posts, array('ID' => $sticky_ID), 'OR', 'ID');
                // Continue if no post offsets
                if (empty($post_offsets)) {
                    continue;
                }
                // Loop over posts in current query and splice them into position
                foreach (array_keys($post_offsets) as $post_offset) {
                    $sticky_offset++;
                    $sticky = $bbp->topic_query->posts[$post_offset];
                    // Remove sticky from current position
                    array_splice($bbp->topic_query->posts, $post_offset, 1);
                    // Move to front, after other stickies
                    array_splice($bbp->topic_query->posts, $sticky_offset, 0, array($sticky));
                    // Cleanup
                    unset($stickies[$sticky_index]);
                    unset($sticky);
                }
                // Cleanup
                unset($post_offsets);
            }
            // Cleanup
            unset($sticky_offset);
            // If any posts have been excluded specifically, Ignore those that are sticky.
            if (!empty($stickies) && !empty($r['post__not_in'])) {
                $stickies = array_diff($stickies, $r['post__not_in']);
            }
            // Fetch sticky posts that weren't in the query results
            if (!empty($stickies)) {
                // Query to use in get_posts to get sticky posts
                $sticky_query = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => 'any', 'meta_key' => '_bbp_last_active_time', 'meta_type' => 'DATETIME', 'orderby' => 'meta_value', 'order' => 'DESC', 'include' => $stickies);
                // Cleanup
                unset($stickies);
                // Conditionally exclude private/hidden forum ID's
                $exclude_forum_ids = bbp_exclude_forum_ids('array');
                if (!empty($exclude_forum_ids)) {
                    $sticky_query['post_parent__not_in'] = $exclude_forum_ids;
                }
                // What are the default allowed statuses (based on user caps)
                if (bbp_get_view_all()) {
                    $sticky_query['post_status'] = $r['post_status'];
                    // Lean on the 'perm' query var value of 'readable' to provide statuses
                } else {
                    $sticky_query['post_status'] = $r['perm'];
                }
                // Get all stickies
                $sticky_posts = get_posts($sticky_query);
                if (!empty($sticky_posts)) {
                    // Get a count of the visible stickies
                    $sticky_count = count($sticky_posts);
                    // Merge the stickies topics with the query topics .
                    $bbp->topic_query->posts = array_merge($sticky_posts, $bbp->topic_query->posts);
                    // Adjust loop and counts for new sticky positions
                    $bbp->topic_query->found_posts = (int) $bbp->topic_query->found_posts + (int) $sticky_count;
                    $bbp->topic_query->post_count = (int) $bbp->topic_query->post_count + (int) $sticky_count;
                    // Cleanup
                    unset($sticky_posts);
                }
            }
        }
    }
    // If no limit to posts per page, set it to the current post_count
    if (-1 === $r['posts_per_page']) {
        $r['posts_per_page'] = $bbp->topic_query->post_count;
    }
    // Add pagination values to query object
    $bbp->topic_query->posts_per_page = $r['posts_per_page'];
    $bbp->topic_query->paged = $r['paged'];
    // Only add pagination if query returned results
    if (((int) $bbp->topic_query->post_count || (int) $bbp->topic_query->found_posts) && (int) $bbp->topic_query->posts_per_page) {
        // Limit the number of topics shown based on maximum allowed pages
        if (!empty($r['max_num_pages']) && $bbp->topic_query->found_posts > $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count) {
            $bbp->topic_query->found_posts = $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count;
        }
        // If pretty permalinks are enabled, make our pagination pretty
        if (bbp_use_pretty_urls()) {
            // User's topics
            if (bbp_is_single_user_topics()) {
                $base = bbp_get_user_topics_created_url(bbp_get_displayed_user_id());
                // User's favorites
            } elseif (bbp_is_favorites()) {
                $base = bbp_get_favorites_permalink(bbp_get_displayed_user_id());
                // User's subscriptions
            } elseif (bbp_is_subscriptions()) {
                $base = bbp_get_subscriptions_permalink(bbp_get_displayed_user_id());
                // Root profile page
            } elseif (bbp_is_single_user()) {
                $base = bbp_get_user_profile_url(bbp_get_displayed_user_id());
                // View
            } elseif (bbp_is_single_view()) {
                $base = bbp_get_view_url();
                // Topic tag
            } elseif (bbp_is_topic_tag()) {
                $base = bbp_get_topic_tag_link();
                // Page or single post
            } elseif (is_page() || is_single()) {
                $base = get_permalink();
                // Forum archive
            } elseif (bbp_is_forum_archive()) {
                $base = bbp_get_forums_url();
                // Topic archive
            } elseif (bbp_is_topic_archive()) {
                $base = bbp_get_topics_url();
                // Default
            } else {
                $base = get_permalink((int) $r['post_parent']);
            }
            // Use pagination base
            $base = trailingslashit($base) . user_trailingslashit(bbp_get_paged_slug() . '/%#%/');
            // Unpretty pagination
        } else {
            $base = add_query_arg('paged', '%#%');
        }
        // Pagination settings with filter
        $bbp_topic_pagination = apply_filters('bbp_topic_pagination', array('base' => $base, 'format' => '', 'total' => $r['posts_per_page'] === $bbp->topic_query->found_posts ? 1 : ceil((int) $bbp->topic_query->found_posts / (int) $r['posts_per_page']), 'current' => (int) $bbp->topic_query->paged, 'prev_text' => is_rtl() ? '&rarr;' : '&larr;', 'next_text' => is_rtl() ? '&larr;' : '&rarr;', 'mid_size' => 1));
        // Add pagination to query object
        $bbp->topic_query->pagination_links = paginate_links($bbp_topic_pagination);
        // Remove first page from pagination
        $bbp->topic_query->pagination_links = str_replace(bbp_get_paged_slug() . "/1/'", "'", $bbp->topic_query->pagination_links);
    }
    // Return object
    return apply_filters('bbp_has_topics', $bbp->topic_query->have_posts(), $bbp->topic_query);
}
Beispiel #12
0
/**
 * Output the required hidden fields when editing a user
 *
 * @since bbPress (r2690)
 *
 * @uses bbp_displayed_user_id() To output the displayed user id
 * @uses wp_nonce_field() To generate a hidden nonce field
 * @uses wp_referer_field() To generate a hidden referer field
 */
function bbp_edit_user_form_fields()
{
    ?>

	<input type="hidden" name="action"  id="bbp_post_action" value="bbp-update-user" />
	<input type="hidden" name="user_id" id="user_id"         value="<?php 
    bbp_displayed_user_id();
    ?>
" />

	<?php 
    wp_nonce_field('update-user_' . bbp_get_displayed_user_id());
}
 /**
  * Insert Badges into bbPress profile
  * @version 1.1
  */
 public function insert_into_bbpress_profile()
 {
     $user_id = bbp_get_displayed_user_id();
     if (isset($this->badges['show_all_bb']) && $this->badges['show_all_bb'] == 1) {
         mycred_render_my_badges(array('show' => 'all', 'width' => MYCRED_BADGE_WIDTH, 'height' => MYCRED_BADGE_HEIGHT, 'user_id' => $user_id));
     } else {
         mycred_display_users_badges($user_id);
     }
 }
Beispiel #14
0
/**
 * Super admin privileges notice
 *
 * @since bbPress (r2688)
 *
 * @uses is_multisite() To check if the blog is multisite
 * @uses bbp_is_single_user() To check if it's the profile page
 * @uses bbp_is_single_user_edit() To check if it's the profile edit page
 * @uses current_user_can() To check if the current user can manage network
 *                           options
 * @uses bbp_get_displayed_user_id() To get the displayed user id
 * @uses is_super_admin() To check if the user is super admin
 * @uses bbp_is_user_home() To check if it's the user home
 * @uses bbp_is_user_home_edit() To check if it's the user home edit
 */
function bbp_notice_edit_user_is_super_admin()
{
    if (is_multisite() && (bbp_is_single_user() || bbp_is_single_user_edit()) && current_user_can('manage_network_options') && is_super_admin(bbp_get_displayed_user_id())) {
        ?>

	<div class="bbp-template-notice important">
		<p><?php 
        bbp_is_user_home() || bbp_is_user_home_edit() ? _e('You have super admin privileges.', 'bbpress') : _e('This user has super admin privileges.', 'bbpress');
        ?>
</p>
	</div>

<?php 
    }
}
Beispiel #15
0
/**
 * The main topic loop. WordPress makes this easy for us
 *
 * @since bbPress (r2485)
 *
 * @param mixed $args All the arguments supported by {@link WP_Query}
 * @uses current_user_can() To check if the current user can edit other's topics
 * @uses bbp_is_user_bozo() To add the bozo post status
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses WP_Query To make query and get the topics
 * @uses is_page() To check if it's a page
 * @uses bbp_is_single_forum() To check if it's a forum
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_paged() To get the current page value
 * @uses bbp_get_super_stickies() To get the super stickies
 * @uses bbp_get_stickies() To get the forum stickies
 * @uses wpdb::get_results() To execute our query and get the results
 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks
 * @uses get_permalink() To get the permalink
 * @uses add_query_arg() To add custom args to the url
 * @uses apply_filters() Calls 'bbp_topics_pagination' with the pagination args
 * @uses paginate_links() To paginate the links
 * @uses apply_filters() Calls 'bbp_has_topics' with
 *                        bbPres::topic_query::have_posts()
 *                        and bbPres::topic_query
 * @return object Multidimensional array of topic information
 */
function bbp_has_topics($args = '')
{
    global $wp_rewrite;
    // What are the default allowed statuses (based on user caps)
    if (bbp_get_view_all()) {
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id());
    } else {
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id());
    }
    // Add the bozo status if user is a bozo
    if (bbp_is_user_bozo()) {
        $post_statuses[] = bbp_get_bozo_status_id();
    }
    $default_topic_search = !empty($_REQUEST['ts']) ? $_REQUEST['ts'] : false;
    $default_show_stickies = (bool) (bbp_is_single_forum() || bbp_is_topic_archive()) && false === $default_topic_search;
    $default_post_parent = bbp_is_single_forum() ? bbp_get_forum_id() : 'any';
    $default_post_status = join(',', $post_statuses);
    // Default argument array
    $default = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => $default_post_parent, 'post_status' => $default_post_status, 'meta_key' => '_bbp_last_active_time', 'orderby' => 'meta_value', 'order' => 'DESC', 'posts_per_page' => bbp_get_topics_per_page(), 'paged' => bbp_get_paged(), 's' => $default_topic_search, 'show_stickies' => $default_show_stickies, 'max_num_pages' => false);
    // Maybe query for topic tags
    if (bbp_is_topic_tag()) {
        $default['term'] = bbp_get_topic_tag_slug();
        $default['taxonomy'] = bbp_get_topic_tag_tax_id();
    }
    $bbp_t = bbp_parse_args($args, $default, 'has_topics');
    // Extract the query variables
    extract($bbp_t);
    // Get bbPress
    $bbp = bbpress();
    // Call the query
    $bbp->topic_query = new WP_Query($bbp_t);
    // Set post_parent back to 0 if originally set to 'any'
    if ('any' == $bbp_t['post_parent']) {
        $bbp_t['post_parent'] = $post_parent = 0;
    }
    // Limited the number of pages shown
    if (!empty($max_num_pages)) {
        $bbp->topic_query->max_num_pages = $max_num_pages;
    }
    // Put sticky posts at the top of the posts array
    if (!empty($show_stickies) && $paged <= 1) {
        // Get super stickies and stickies in this forum
        $stickies = bbp_get_super_stickies();
        $stickies = !empty($post_parent) ? array_merge($stickies, bbp_get_stickies($post_parent)) : $stickies;
        $stickies = array_unique($stickies);
        // We have stickies
        if (is_array($stickies) && !empty($stickies)) {
            // Setup the number of stickies and reset offset to 0
            $num_topics = count($bbp->topic_query->posts);
            $sticky_offset = 0;
            // Loop over topics and relocate stickies to the front.
            for ($i = 0; $i < $num_topics; $i++) {
                if (in_array($bbp->topic_query->posts[$i]->ID, $stickies)) {
                    $sticky = $bbp->topic_query->posts[$i];
                    // Remove sticky from current position
                    array_splice($bbp->topic_query->posts, $i, 1);
                    // Move to front, after other stickies
                    array_splice($bbp->topic_query->posts, $sticky_offset, 0, array($sticky));
                    // Increment the sticky offset.  The next sticky will be placed at this offset.
                    $sticky_offset++;
                    // Remove post from sticky posts array
                    $offset = array_search($sticky->ID, $stickies);
                    // Cleanup
                    unset($stickies[$offset]);
                    unset($sticky);
                }
            }
            // If any posts have been excluded specifically, Ignore those that are sticky.
            if (!empty($stickies) && !empty($post__not_in)) {
                $stickies = array_diff($stickies, $post__not_in);
            }
            // Fetch sticky posts that weren't in the query results
            if (!empty($stickies)) {
                // Query to use in get_posts to get sticky posts
                $sticky_query = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => 'any', 'post_status' => $default_post_status, 'meta_key' => '_bbp_last_active_time', 'orderby' => 'meta_value', 'order' => 'DESC', 'include' => $stickies);
                // Get all stickies
                $sticky_posts = get_posts($sticky_query);
                if (!empty($sticky_posts)) {
                    // Get a count of the visible stickies
                    $sticky_count = count($sticky_posts);
                    // Loop through stickies and add them to beginning of array
                    foreach ($sticky_posts as $sticky) {
                        $topics[] = $sticky;
                    }
                    // Loop through topics and add them to end of array
                    foreach ($bbp->topic_query->posts as $topic) {
                        $topics[] = $topic;
                    }
                    // Adjust loop and counts for new sticky positions
                    $bbp->topic_query->posts = $topics;
                    $bbp->topic_query->found_posts = (int) $bbp->topic_query->found_posts + (int) $sticky_count;
                    $bbp->topic_query->post_count = (int) $bbp->topic_query->post_count + (int) $sticky_count;
                    // Cleanup
                    unset($topics);
                    unset($stickies);
                    unset($sticky_posts);
                }
            }
        }
    }
    // If no limit to posts per page, set it to the current post_count
    if (-1 == $posts_per_page) {
        $posts_per_page = $bbp->topic_query->post_count;
    }
    // Add pagination values to query object
    $bbp->topic_query->posts_per_page = $posts_per_page;
    $bbp->topic_query->paged = $paged;
    // Only add pagination if query returned results
    if (((int) $bbp->topic_query->post_count || (int) $bbp->topic_query->found_posts) && (int) $bbp->topic_query->posts_per_page) {
        // Limit the number of topics shown based on maximum allowed pages
        if (!empty($max_num_pages) && $bbp->topic_query->found_posts > $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count) {
            $bbp->topic_query->found_posts = $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count;
        }
        // If pretty permalinks are enabled, make our pagination pretty
        if ($wp_rewrite->using_permalinks()) {
            // Profile page
            if (bbp_is_single_user()) {
                $base = bbp_get_user_profile_url(bbp_get_displayed_user_id());
            } elseif (bbp_is_single_view()) {
                $base = bbp_get_view_url();
            } elseif (bbp_is_topic_tag()) {
                $base = bbp_get_topic_tag_link();
            } elseif (is_page() || is_single()) {
                $base = get_permalink();
            } elseif (bbp_is_topic_archive()) {
                $base = bbp_get_topics_url();
            } else {
                $base = get_permalink($post_parent);
            }
            // Use pagination base
            $base = trailingslashit($base) . user_trailingslashit($wp_rewrite->pagination_base . '/%#%/');
            // Unpretty pagination
        } else {
            $base = add_query_arg('paged', '%#%');
        }
        // Pagination settings with filter
        $bbp_topic_pagination = apply_filters('bbp_topic_pagination', array('base' => $base, 'format' => '', 'total' => $posts_per_page == $bbp->topic_query->found_posts ? 1 : ceil((int) $bbp->topic_query->found_posts / (int) $posts_per_page), 'current' => (int) $bbp->topic_query->paged, 'prev_text' => '&larr;', 'next_text' => '&rarr;', 'mid_size' => 1));
        // Add pagination to query object
        $bbp->topic_query->pagination_links = paginate_links($bbp_topic_pagination);
        // Remove first page from pagination
        $bbp->topic_query->pagination_links = str_replace($wp_rewrite->pagination_base . "/1/'", "'", $bbp->topic_query->pagination_links);
    }
    // Return object
    return apply_filters('bbp_has_topics', $bbp->topic_query->have_posts(), $bbp->topic_query);
}
Beispiel #16
0
/**
 * The main reply loop. WordPress makes this easy for us
 *
 * @since bbPress (r2553)
 *
 * @param mixed $args All the arguments supported by {@link WP_Query}
 * @uses bbp_show_lead_topic() Are we showing the topic as a lead?
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_get_reply_post_type() To get the reply post type
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses bbp_is_query_name() To check if we are getting replies for a widget
 * @uses get_option() To get the replies per page option
 * @uses bbp_get_paged() To get the current page value
 * @uses current_user_can() To check if the current user is capable of editing
 *                           others' replies
 * @uses WP_Query To make query and get the replies
 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks
 * @uses get_permalink() To get the permalink
 * @uses add_query_arg() To add custom args to the url
 * @uses apply_filters() Calls 'bbp_replies_pagination' with the pagination args
 * @uses paginate_links() To paginate the links
 * @uses apply_filters() Calls 'bbp_has_replies' with
 *                        bbPres::reply_query::have_posts()
 *                        and bbPres::reply_query
 * @return object Multidimensional array of reply information
 */
function bbp_has_replies($args = '')
{
    global $wp_rewrite;
    // What are the default allowed statuses (based on user caps)
    if (bbp_get_view_all('edit_others_replies')) {
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id());
    } else {
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id());
    }
    $default_reply_search = !empty($_REQUEST['rs']) ? $_REQUEST['rs'] : false;
    $default_post_parent = bbp_is_single_topic() ? bbp_get_topic_id() : 'any';
    $default_post_type = bbp_is_single_topic() && bbp_show_lead_topic() ? bbp_get_reply_post_type() : array(bbp_get_topic_post_type(), bbp_get_reply_post_type());
    $default_post_status = join(',', $post_statuses);
    // Default query args
    $default = array('post_type' => $default_post_type, 'post_parent' => $default_post_parent, 'post_status' => $default_post_status, 'posts_per_page' => bbp_get_replies_per_page(), 'paged' => bbp_get_paged(), 'orderby' => 'date', 'order' => 'ASC', 's' => $default_reply_search);
    // Set up topic variables
    $bbp_r = bbp_parse_args($args, $default, 'has_replies');
    // Extract the query variables
    extract($bbp_r);
    // Get bbPress
    $bbp = bbpress();
    // Call the query
    $bbp->reply_query = new WP_Query($bbp_r);
    // Add pagination values to query object
    $bbp->reply_query->posts_per_page = $posts_per_page;
    $bbp->reply_query->paged = $paged;
    // Never home, regardless of what parse_query says
    $bbp->reply_query->is_home = false;
    // Reset is_single if single topic
    if (bbp_is_single_topic()) {
        $bbp->reply_query->is_single = true;
    }
    // Only add pagination if query returned results
    if ((int) $bbp->reply_query->found_posts && (int) $bbp->reply_query->posts_per_page) {
        // If pretty permalinks are enabled, make our pagination pretty
        if ($wp_rewrite->using_permalinks()) {
            // Page or single
            if (is_page() || is_single()) {
                $base = get_permalink();
                // User's replies
            } elseif (bbp_is_single_user_replies()) {
                $base = bbp_get_user_replies_created_url(bbp_get_displayed_user_id());
                // Single topic
            } else {
                $base = get_permalink(bbp_get_topic_id());
            }
            $base = trailingslashit($base) . user_trailingslashit($wp_rewrite->pagination_base . '/%#%/');
            // Unpretty permalinks
        } else {
            $base = add_query_arg('paged', '%#%');
        }
        // Add pagination to query object
        $bbp->reply_query->pagination_links = paginate_links(apply_filters('bbp_replies_pagination', array('base' => $base, 'format' => '', 'total' => ceil((int) $bbp->reply_query->found_posts / (int) $posts_per_page), 'current' => (int) $bbp->reply_query->paged, 'prev_text' => '&larr;', 'next_text' => '&rarr;', 'mid_size' => 1, 'add_args' => bbp_get_view_all() ? array('view' => 'all') : false)));
        // Remove first page from pagination
        if ($wp_rewrite->using_permalinks()) {
            $bbp->reply_query->pagination_links = str_replace($wp_rewrite->pagination_base . '/1/', '', $bbp->reply_query->pagination_links);
        } else {
            $bbp->reply_query->pagination_links = str_replace('&#038;paged=1', '', $bbp->reply_query->pagination_links);
        }
    }
    // Return object
    return apply_filters('bbp_has_replies', $bbp->reply_query->have_posts(), $bbp->reply_query);
}
Beispiel #17
0
/**
 * Redirect if unathorized user is attempting to edit another user
 *
 * This is hooked to 'bbp_template_redirect' and controls the conditions under
 * which a user can edit another user (or themselves.) If these conditions are
 * met, we assume a user cannot perform this task, and look for ways they can
 * earn the ability to access this template.
 *
 * @since 2.1.0 bbPress (r3605)
 *
 * @uses bbp_is_single_user_edit()
 * @uses current_user_can()
 * @uses bbp_get_displayed_user_id()
 * @uses bbp_redirect()
 * @uses bbp_get_user_profile_url()
 */
function bbp_check_user_edit()
{
    // Bail if not editing a user
    if (!bbp_is_single_user_edit()) {
        return;
    }
    // Default to false
    $redirect = true;
    $user_id = bbp_get_displayed_user_id();
    // Allow user to edit their own profile
    if (bbp_is_user_home_edit()) {
        $redirect = false;
        // Allow if current user can edit the displayed user
    } elseif (current_user_can('edit_user', $user_id)) {
        $redirect = false;
        // Allow if user can manage network users, or edit-any is enabled
    } elseif (current_user_can('manage_network_users') || apply_filters('enable_edit_any_user_configuration', false)) {
        $redirect = false;
    }
    // Allow conclusion to be overridden
    $redirect = (bool) apply_filters('bbp_check_user_edit', $redirect, $user_id);
    // Bail if not redirecting
    if (false === $redirect) {
        return;
    }
    // Filter redirect URL
    $profile_url = bbp_get_user_profile_url($user_id);
    $redirect_to = apply_filters('bbp_check_user_edit_redirect_to', $profile_url, $user_id);
    // Redirect
    bbp_redirect($redirect_to);
}
Beispiel #18
0
/**
 * Redirect if unathorized user is attempting to edit another user
 *
 * This is hooked to 'bbp_template_redirect' and controls the conditions under
 * which a user can edit another user (or themselves.) If these conditions are
 * met. We assume a user cannot perform this task, and look for ways they can
 * earn the ability to access this template.
 * 
 * @since bbPress (r3605)
 *
 * @uses bbp_is_topic_edit()
 * @uses current_user_can()
 * @uses bbp_get_topic_id()
 * @uses wp_safe_redirect()
 * @uses bbp_get_topic_permalink()
 */
function bbp_check_user_edit()
{
    // Bail if not editing a topic
    if (!bbp_is_single_user_edit()) {
        return;
    }
    // Default to false
    $redirect = true;
    // Allow user to edit their own profile
    if (bbp_is_user_home_edit()) {
        $redirect = false;
        // Allow if current user can edit the displayed user
    } elseif (current_user_can('edit_user', bbp_get_displayed_user_id())) {
        $redirect = false;
        // Allow if user can manage network users, or edit-any is enabled
    } elseif (current_user_can('manage_network_users') || apply_filters('enable_edit_any_user_configuration', false)) {
        $redirect = false;
    }
    // Maybe redirect back to profile page
    if (true === $redirect) {
        wp_safe_redirect(bbp_get_user_profile_url(bbp_get_displayed_user_id()));
        exit;
    }
}
Beispiel #19
0
        foreach (bbp_get_capabilities_for_group($group) as $capability) {
            ?>

							<dd>
								<label for="_bbp_<?php 
            echo $capability;
            ?>
">
									<input class="checkbox" type="checkbox" id="_bbp_<?php 
            echo $capability;
            ?>
" name="_bbp_<?php 
            echo $capability;
            ?>
" value="1" <?php 
            checked(user_can(bbp_get_displayed_user_id(), $capability));
            ?>
 tabindex="<?php 
            bbp_tab_index();
            ?>
" />
									<?php 
            bbp_capability_title($capability);
            ?>
								</label>
							</dd>

						<?php 
        }
        ?>
Beispiel #20
0
/**
 * The main reply loop. WordPress makes this easy for us
 *
 * @since bbPress (r2553)
 *
 * @param mixed $args All the arguments supported by {@link WP_Query}
 * @uses bbp_show_lead_topic() Are we showing the topic as a lead?
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_get_reply_post_type() To get the reply post type
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses get_option() To get the replies per page option
 * @uses bbp_get_paged() To get the current page value
 * @uses current_user_can() To check if the current user is capable of editing
 *                           others' replies
 * @uses WP_Query To make query and get the replies
 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks
 * @uses get_permalink() To get the permalink
 * @uses add_query_arg() To add custom args to the url
 * @uses apply_filters() Calls 'bbp_replies_pagination' with the pagination args
 * @uses paginate_links() To paginate the links
 * @uses apply_filters() Calls 'bbp_has_replies' with
 *                        bbPres::reply_query::have_posts()
 *                        and bbPres::reply_query
 * @return object Multidimensional array of reply information
 */
function bbp_has_replies($args = '')
{
    global $wp_rewrite;
    /** Defaults **************************************************************/
    // Other defaults
    $default_reply_search = !empty($_REQUEST['rs']) ? $_REQUEST['rs'] : false;
    $default_post_parent = bbp_is_single_topic() ? bbp_get_topic_id() : 'any';
    $default_post_type = bbp_is_single_topic() && bbp_show_lead_topic() ? bbp_get_reply_post_type() : array(bbp_get_topic_post_type(), bbp_get_reply_post_type());
    $default_thread_replies = (bool) (bbp_is_single_topic() && bbp_thread_replies());
    // Default query args
    $default = array('post_type' => $default_post_type, 'post_parent' => $default_post_parent, 'posts_per_page' => bbp_get_replies_per_page(), 'paged' => bbp_get_paged(), 'orderby' => 'date', 'order' => 'ASC', 'hierarchical' => $default_thread_replies, 'ignore_sticky_posts' => true, 's' => $default_reply_search);
    // What are the default allowed statuses (based on user caps)
    if (bbp_get_view_all()) {
        // Default view=all statuses
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id());
        // Add support for private status
        if (current_user_can('read_private_replies')) {
            $post_statuses[] = bbp_get_private_status_id();
        }
        // Join post statuses together
        $default['post_status'] = implode(',', $post_statuses);
        // Lean on the 'perm' query var value of 'readable' to provide statuses
    } else {
        $default['perm'] = 'readable';
    }
    /** Setup *****************************************************************/
    // Parse arguments against default values
    $r = bbp_parse_args($args, $default, 'has_replies');
    // Set posts_per_page value if replies are threaded
    $replies_per_page = $r['posts_per_page'];
    if (true === $r['hierarchical']) {
        $r['posts_per_page'] = -1;
    }
    // Get bbPress
    $bbp = bbpress();
    // Call the query
    $bbp->reply_query = new WP_Query($r);
    // Add pagination values to query object
    $bbp->reply_query->posts_per_page = $replies_per_page;
    $bbp->reply_query->paged = $r['paged'];
    // Never home, regardless of what parse_query says
    $bbp->reply_query->is_home = false;
    // Reset is_single if single topic
    if (bbp_is_single_topic()) {
        $bbp->reply_query->is_single = true;
    }
    // Only add reply to if query returned results
    if ((int) $bbp->reply_query->found_posts) {
        // Get reply to for each reply
        foreach ($bbp->reply_query->posts as &$post) {
            // Check for reply post type
            if (bbp_get_reply_post_type() === $post->post_type) {
                $reply_to = bbp_get_reply_to($post->ID);
                // Make sure it's a reply to a reply
                if (empty($reply_to) || bbp_get_reply_topic_id($post->ID) === $reply_to) {
                    $reply_to = 0;
                }
                // Add reply_to to the post object so we can walk it later
                $post->reply_to = $reply_to;
            }
        }
    }
    // Only add pagination if query returned results
    if ((int) $bbp->reply_query->found_posts && (int) $bbp->reply_query->posts_per_page) {
        // If pretty permalinks are enabled, make our pagination pretty
        if ($wp_rewrite->using_permalinks()) {
            // User's replies
            if (bbp_is_single_user_replies()) {
                $base = bbp_get_user_replies_created_url(bbp_get_displayed_user_id());
                // Root profile page
            } elseif (bbp_is_single_user()) {
                $base = bbp_get_user_profile_url(bbp_get_displayed_user_id());
                // Page or single post
            } elseif (is_page() || is_single()) {
                $base = get_permalink();
                // Single topic
            } else {
                $base = get_permalink(bbp_get_topic_id());
            }
            $base = trailingslashit($base) . user_trailingslashit($wp_rewrite->pagination_base . '/%#%/');
            // Unpretty permalinks
        } else {
            $base = add_query_arg('paged', '%#%');
        }
        // Figure out total pages
        if (true === $r['hierarchical']) {
            $walker = new BBP_Walker_Reply();
            $total_pages = ceil((int) $walker->get_number_of_root_elements($bbp->reply_query->posts) / (int) $replies_per_page);
        } else {
            $total_pages = ceil((int) $bbp->reply_query->found_posts / (int) $replies_per_page);
            // Add pagination to query object
            $bbp->reply_query->pagination_links = paginate_links(apply_filters('bbp_replies_pagination', array('base' => $base, 'format' => '', 'total' => $total_pages, 'current' => (int) $bbp->reply_query->paged, 'prev_text' => is_rtl() ? '&rarr;' : '&larr;', 'next_text' => is_rtl() ? '&larr;' : '&rarr;', 'mid_size' => 1, 'add_args' => bbp_get_view_all() ? array('view' => 'all') : false)));
            // Remove first page from pagination
            if ($wp_rewrite->using_permalinks()) {
                $bbp->reply_query->pagination_links = str_replace($wp_rewrite->pagination_base . '/1/', '', $bbp->reply_query->pagination_links);
            } else {
                $bbp->reply_query->pagination_links = str_replace('&#038;paged=1', '', $bbp->reply_query->pagination_links);
            }
        }
    }
    // Return object
    return apply_filters('bbp_has_replies', $bbp->reply_query->have_posts(), $bbp->reply_query);
}
/**
 * Prints title/subtitle ( Page )
 */
function grve_print_header_title($mode = '')
{
    if (grve_check_title_visibility()) {
        $page_title_extra_class = '';
        $header_data = grve_header_title();
        if ('blog' == $mode) {
            $page_title_height = grve_option('blog_title_height', '350');
            $page_title_alignment = grve_option('blog_title_alignment', 'center');
            $page_title_color = grve_option('blog_title_color', 'light');
            $page_description_color = grve_option('blog_description_color', 'light');
            $page_title_extra_class = 'grve-blog-title';
            $bg_image = 'blog_title_background';
        } elseif ('event-tax' == $mode) {
            $page_title_height = grve_option('event_tax_title_height', '350');
            $page_title_alignment = grve_option('event_tax_title_alignment', 'center');
            $page_title_color = grve_option('event_tax_title_color', 'light');
            $page_description_color = grve_option('event_tax_description_color', 'light');
            $page_title_extra_class = 'grve-event-tax-title';
            $bg_image = 'event_tax_title_background';
        } elseif ('event' == $mode) {
            $page_title_height = grve_option('event_title_height', '350');
            $page_title_alignment = grve_option('event_title_alignment', 'center');
            $page_title_color = grve_option('event_title_color', 'light');
            $page_description_color = grve_option('event_description_color', 'light');
            $page_title_extra_class = 'grve-event-title';
            $bg_image = 'event_title_background';
        } elseif ('forum' == $mode) {
            $page_title_height = grve_option('forum_title_height', '350');
            $page_title_alignment = grve_option('forum_title_alignment', 'center');
            $page_title_color = grve_option('forum_title_color', 'light');
            $page_description_color = grve_option('forum_description_color', 'light');
            $page_title_extra_class = 'grve-forum-title';
            $bg_image = 'forum_title_background';
            $header_data['description'] = '';
            if (!is_singular()) {
                $header_data['title'] = __('Forums', GRVE_THEME_TRANSLATE);
            }
            if (function_exists('bbp_is_single_user_edit') && (bbp_is_single_user_edit() || bbp_is_single_user())) {
                $user_info = get_userdata(bbp_get_displayed_user_id());
                $header_data['title'] = __("Profile for User:"******" " . $user_info->display_name;
                if (bbp_is_single_user_edit()) {
                    $header_data['title'] = __("Edit profile for User:"******" " . $user_info->display_name;
                }
            }
        } else {
            $page_title_height = grve_option('page_title_height', '350');
            $page_title_alignment = grve_option('page_title_alignment', 'center');
            $page_title_color = grve_option('page_title_color', 'light');
            $page_description_color = grve_option('page_description_color', 'light');
            $bg_image = 'page_title_background';
        }
        $header_title = isset($header_data['title']) ? $header_data['title'] : '';
        $header_description = isset($header_data['description']) ? $header_data['description'] : '';
        $header_reversed = isset($header_data['reversed']) ? $header_data['reversed'] : '';
        ?>
	<!-- Page Title -->
	<div id="grve-page-title" class="grve-align-<?php 
        echo esc_attr($page_title_alignment);
        ?>
 <?php 
        echo esc_attr($page_title_extra_class);
        ?>
" style="height:<?php 
        echo esc_attr($page_title_height);
        ?>
px;">
		<div id="grve-page-title-content" data-height="<?php 
        echo esc_attr($page_title_height);
        ?>
">
			<?php 
        do_action('grve_page_title_top');
        ?>
			<div class="grve-container">
				<?php 
        if (empty($header_reversed)) {
            ?>
					<h1 class="grve-title grve-<?php 
            echo esc_attr($page_title_color);
            ?>
"><span><?php 
            echo $header_title;
            ?>
</span></h1>
					<?php 
            if (!empty($header_description)) {
                ?>
					<div class="grve-description grve-<?php 
                echo esc_attr($page_description_color);
                ?>
"><?php 
                echo $header_description;
                ?>
</div>
					<?php 
            }
            ?>
				<?php 
        } else {
            ?>
					<?php 
            if (!empty($header_description)) {
                ?>
					<div class="grve-description grve-<?php 
                echo esc_attr($page_description_color);
                ?>
"><?php 
                echo $header_description;
                ?>
</div>
					<?php 
            }
            ?>
					<h1 class="grve-title grve-<?php 
            echo esc_attr($page_title_color);
            ?>
"><span><?php 
            echo $header_title;
            ?>
</span></h1>
				<?php 
        }
        ?>
			</div>
			<?php 
        do_action('grve_page_title_bottom');
        ?>
		</div>
		<?php 
        grve_print_title_bg_image_container($bg_image);
        ?>
	</div>
	<!-- End Page Title -->
<?php 
    }
}
/**
 * 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);
}
Beispiel #23
0
/**
 * 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);
}
Beispiel #24
0
			<?php 
    do_action('bbp_user_edit_before_role');
    ?>

			<?php 
    if (is_multisite() && is_super_admin() && current_user_can('manage_network_options')) {
        ?>

				<div>
					<label for="super_admin"><?php 
        _e('Network Role', 'bbpress');
        ?>
</label>
					<label>
						<input class="checkbox" type="checkbox" id="super_admin" name="super_admin"<?php 
        checked(is_super_admin(bbp_get_displayed_user_id()));
        ?>
 tabindex="<?php 
        bbp_tab_index();
        ?>
" />
						<?php 
        _e('Grant this user super admin privileges for the Network.', 'bbpress');
        ?>
					</label>
				</div>

			<?php 
    }
    ?>
Beispiel #25
0
 /**
  * Insert Rank In bbPress Profile
  * @since 1.6
  * @version 1.0
  */
 public function insert_rank_bb_profile()
 {
     $output = '';
     $user_id = bbp_get_displayed_user_id();
     foreach ($this->point_types as $type_id => $label) {
         // Load type
         $mycred = mycred($type_id);
         // User is excluded from this type
         if ($mycred->exclude_user($user_id)) {
             continue;
         }
         // No settings
         if (!isset($mycred->rank['bp_location'])) {
             continue;
         }
         // Not shown
         if (!in_array($mycred->rank['bp_location'], array('profile', 'both'))) {
             continue;
         }
         // Get rank (if user has one
         $users_rank = mycred_get_users_rank_id($user_id, $type_id);
         if ($users_rank === NULL) {
             continue;
         }
         // Parse template
         $template = $mycred->rank['bp_template'];
         $template = str_replace('%rank_title%', get_the_title($users_rank), $template);
         $template = str_replace('%rank_logo%', mycred_get_rank_logo($users_rank), $template);
         // Let others play
         $output .= apply_filters('mycred_bb_profile_ranks_row', $template, $user_id, $users_rank, $mycred, $this);
     }
     if ($output == '') {
         return;
     }
     echo '<div id="mycred-my-rank">' . apply_filters('mycred_bb_rank_in_profile', $output, $user_id, $this) . '</div>';
 }