<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[447] sites/trunk/buddypress.org/public_html/wp-content/plugins: Add main plugins for bbPress.org and BuddyPress.org.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://meta.trac.wordpress.org/changeset/447">447</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2014-02-28 20:27:16 +0000 (Fri, 28 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add main plugins for bbPress.org and BuddyPress.org. fixes <a href="http://meta.trac.wordpress.org/ticket/374">#374</a>.</pre>
<h3>Added Paths</h3>
<ul>
<li>sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/</li>
<li><a href="#sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbbpressorgbbpressdotorgphp">sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/bbpress-dot-org.php</a></li>
<li><a href="#sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbbpressorgtoolbarphp">sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/toolbar.php</a></li>
<li><a href="#sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbbpressorgtoolsphp">sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/tools.php</a></li>
<li>sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/</li>
<li><a href="#sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbuddypressorgbuddypressdotorgphp">sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/buddypress-dot-org.php</a></li>
<li><a href="#sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbuddypressorgextensionsphp">sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/extensions.php</a></li>
<li><a href="#sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbuddypressorgtoolbarphp">sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/toolbar.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbbpressorgbbpressdotorgphp"></a>
<div class="addfile"><h4>Added: sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/bbpress-dot-org.php (0 => 447)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/bbpress-dot-org.php (rev 0)
+++ sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/bbpress-dot-org.php 2014-02-28 20:27:16 UTC (rev 447)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+<?php
+
+/**
+ * Plugin Name: bbPress.org Tweaks
+ * Description: Code specific to bbPress.org
+ * Version: 1.0.5
+ * Author: jjj
+ * Author URI: http://jaco.by
+ */
+
+// Include files
+include_once( plugin_dir_path( __FILE__ ) . 'toolbar.php' );
+include_once( plugin_dir_path( __FILE__ ) . 'tools.php' );
+
+/**
+ * Remove the bbPress dashboard widget, since it uses get_users() and causes
+ * major slow-down.
+ *
+ * @author johnjamesjacoby
+ * @since 1.0
+ * @param type $admin
+ */
+function bbporg_remove_dashboard_widget( $admin ) {
+ remove_action( 'wp_dashboard_setup', array( $admin, 'dashboard_widget_right_now' ) );
+}
+add_action( 'bbp_admin_loaded', 'bbporg_remove_dashboard_widget' );
+
+/**
+ * A cheap and effective way to keep non-admins out of wp-admin.
+ *
+ * @author johnjamesjacoby
+ * @since 1.0
+ * @todo flesh this out a bit more
+ * @return if user is an admin
+ */
+function bbporg_admin_redirect() {
+ if ( ! current_user_can( 'contributor' )
+ || ! current_user_can( 'author' )
+ || ! current_user_can( 'editor' )
+ || ! current_user_can( 'administrator' )
+ )
+ return;
+
+ wp_safe_redirect( 'http://bbpress.org' );
+ die;
+}
+add_action( 'bbp_admin_init', 'bbporg_admin_redirect' );
+
+/**
+ * Filter the users edit profile URL and use bbPress's theme-side edit instead
+ *
+ * @author johnjamesjacoby
+ * @since 1.0
+ * @param string $user_edit
+ * @return string
+ */
+function bbporg_filter_profile_edit_url( $user_edit = '' ) {
+
+ // Bail if bbPress is not active
+ if ( ! function_exists( 'bbp_get_user_profile_edit_url' ) ) {
+ return $user_edit;
+ }
+
+ $user_edit = bbp_get_user_profile_edit_url( bbp_get_current_user_id() );
+ return $user_edit;
+}
+add_filter( 'edit_profile_url', 'bbporg_filter_profile_edit_url' );
</ins><span class="cx">Property changes on: sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/bbpress-dot-org.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbbpressorgtoolbarphp"></a>
<div class="addfile"><h4>Added: sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/toolbar.php (0 => 447)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/toolbar.php (rev 0)
+++ sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/toolbar.php 2014-02-28 20:27:16 UTC (rev 447)
</span><span class="lines">@@ -0,0 +1,471 @@
</span><ins>+<?php
+
+/**
+ * Remove a few toolbar items we do not need
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.1
+ */
+function bborg_toolbar_tweaks() {
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 0 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 4 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 7 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 70 );
+}
+add_action( 'add_admin_bar_menus', 'bborg_toolbar_tweaks', 11 );
+
+/**
+ * Remove the BuddyPress and bbPress about menus
+ *
+ * @author johnjamesjacoby
+ * @global object $wp_admin_bar
+ */
+function bbporg_remove_about_pages( $wp_admin_bar ) {
+ $wp_admin_bar->remove_menu( 'bp-about' );
+ $wp_admin_bar->remove_menu( 'bbp-about' );
+}
+add_action( 'admin_bar_menu', 'bbporg_remove_about_pages', 99 );
+
+/**
+ * Add a new main top-left menu with links for each project.
+ *
+ * @todo GlotPress/BackPress
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.1
+ */
+function bbporg_new_admin_bar_wp_menu( $wp_admin_bar ) {
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'wp-logo',
+ 'title' => '<span class="ab-icon"></span>',
+ 'href' => 'http://bbpress.org',
+ 'meta' => array(
+ 'title' => __( 'bbPress.org' ),
+ ),
+ ) );
+
+ /** WordPress *************************************************************/
+
+ // Add "About WordPress" link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo',
+ 'id' => 'wordpress',
+ 'title' => __( 'WordPress.org' ),
+ 'href' => 'http://wordpress.org',
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wordpress',
+ 'id' => 'wp-about',
+ 'title' => __( 'About WordPress' ),
+ 'href' => 'http://wordpress.org/about/',
+ ) );
+
+ // Add codex link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wordpress',
+ 'id' => 'wp-documentation',
+ 'title' => __('Documentation'),
+ 'href' => 'http://codex.wordpress.org/',
+ ) );
+
+ // Add forums link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wordpress',
+ 'id' => 'wp-support-forums',
+ 'title' => __('Support Forums'),
+ 'href' => 'http://wordpress.org/support/',
+ ) );
+
+ // Add feedback link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wordpress',
+ 'id' => 'wp-feedback',
+ 'title' => __('Feedback'),
+ 'href' => 'http://wordpress.org/support/forum/requests-and-feedback',
+ ) );
+
+ /** BuddyPress Developer **/
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'wordpress',
+ 'id' => 'wp-developer',
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary',
+ ),
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-developer',
+ 'id' => 'wp-trac',
+ 'title' => __( 'Developer Trac' ),
+ 'href' => 'http://core.trac.wordpress.org'
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-developer',
+ 'id' => 'wp-dev-blog',
+ 'title' => __( 'Developer Blog' ),
+ 'href' => 'http://make.wordpress.org'
+ ) );
+
+ /** bbPress ***************************************************************/
+
+ // Add "About WordPress" link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo',
+ 'id' => 'bbpress',
+ 'title' => __( 'bbPress.org' ),
+ 'href' => 'http://bbpress.org',
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbpress',
+ 'id' => 'bbp-about',
+ 'title' => __( 'About bbPress' ),
+ 'href' => 'http://bbpress.org/about/',
+ ) );
+
+ // Add codex link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbpress',
+ 'id' => 'bbp-documentation',
+ 'title' => __( 'Documentation' ),
+ 'href' => 'http://codex.bbpress.org/',
+ ) );
+
+ // Add forums link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbpress',
+ 'id' => 'bbp-support-forums',
+ 'title' => __( 'Support Forums' ),
+ 'href' => 'http://bbpress.org/forums/',
+ ) );
+
+ // Add feedback link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbpress',
+ 'id' => 'bbp-feedback',
+ 'title' => __( 'Feedback' ),
+ 'href' => 'http://bbpress.org/forums/forum/requests-and-feedback',
+ ) );
+
+ /** BuddyPress Developer **/
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'bbpress',
+ 'id' => 'bbp-developer',
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary',
+ ),
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbp-developer',
+ 'id' => 'bbp-trac',
+ 'title' => __( 'Developer Trac' ),
+ 'href' => 'http://bbpress.trac.wordpress.org'
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbp-developer',
+ 'id' => 'bbp-dev-blog',
+ 'title' => __( 'Developer Blog' ),
+ 'href' => 'http://bbpdevel.wordpress.com'
+ ) );
+
+ /** BuddyPress ************************************************************/
+
+ // Add "About WordPress" link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo',
+ 'id' => 'buddypress',
+ 'title' => __( 'BuddyPress.org' ),
+ 'href' => 'http://buddypress.org',
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'buddypress',
+ 'id' => 'bp-about',
+ 'title' => __( 'About BuddyPress' ),
+ 'href' => 'http://buddypress.org/about/',
+ ) );
+
+ // Add codex link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'buddypress',
+ 'id' => 'bp-documentation',
+ 'title' => __( 'Documentation' ),
+ 'href' => 'http://codex.buddypress.org/',
+ ) );
+
+ // Add forums link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'buddypress',
+ 'id' => 'bp-support-forums',
+ 'title' => __( 'Support Forums' ),
+ 'href' => 'http://buddypress.org/forums/',
+ ) );
+
+ // Add feedback link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'buddypress',
+ 'id' => 'bp-feedback',
+ 'title' => __( 'Feedback' ),
+ 'href' => 'http://buddypress.org/support/forum/feedback/',
+ ) );
+
+ /** BuddyPress Developer **/
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'buddypress',
+ 'id' => 'bp-developer',
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary',
+ ),
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bp-developer',
+ 'id' => 'bp-trac',
+ 'title' => __( 'Developer Trac' ),
+ 'href' => 'http://buddypress.trac.wordpress.org'
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bp-developer',
+ 'id' => 'bp-dev-blog',
+ 'title' => __( 'Developer Blog' ),
+ 'href' => 'http://bpdevel.wordpress.com'
+ ) );
+}
+add_action( 'admin_bar_menu', 'bbporg_new_admin_bar_wp_menu', 10 );
+
+/**
+ * Add a new "Site Name" menu with less things for average users to do
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.2
+ */
+function bbporg_new_admin_bar_site_menu( $wp_admin_bar ) {
+
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'bbp-site-name',
+ 'title' => __( 'bbPress.org' ),
+ 'href' => home_url( '/' )
+ ) );
+
+ // Create submenu items.
+
+ if ( is_user_logged_in() ) {
+
+ // Add an option to visit the site.
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbp-site-name',
+ 'id' => 'bbp-new-topic',
+ 'title' => __( 'Create New Topic' ),
+ 'href' => 'http://bbpress.org/forums/new-topic/'
+ ) );
+
+ // Add an option to visit the admin dashboard
+ if ( is_super_admin() ) {
+
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'bbp-site-name',
+ 'id' => 'bbp-site-name-super-admin',
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary',
+ ),
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbp-site-name-super-admin',
+ 'id' => 'bbp-admin-link',
+ 'title' => __( 'Admin Dashbooard' ),
+ 'href' => get_admin_url()
+ ) );
+ }
+
+ // Not logged in
+ } else {
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbp-site-name',
+ 'id' => 'bbp-login',
+ 'title' => __( 'Log in' ),
+ 'href' => 'http://bbpress.org/login/'
+ ) );
+ }
+}
+add_action( 'admin_bar_menu', 'bbporg_new_admin_bar_site_menu', 20 );
+
+/**
+ * Add the "My Account" item.
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.2
+ */
+function bbporg_admin_bar_my_account_item( $wp_admin_bar ) {
+
+ if ( is_user_logged_in() ) {
+ $user_id = get_current_user_id();
+ $current_user = wp_get_current_user();
+ $profile_url = get_edit_profile_url( $user_id );
+ $avatar = get_avatar( $user_id, 16 );
+ $howdy = $current_user->display_name;
+ $class = empty( $avatar ) ? '' : 'with-avatar';
+
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'my-account',
+ 'parent' => 'top-secondary',
+ 'title' => $howdy . $avatar,
+ 'href' => $profile_url,
+ 'meta' => array(
+ 'class' => $class,
+ 'title' => __('My Account'),
+ ),
+ ) );
+ } else {
+ $avatar = get_avatar( 0, 16, 'mystery' );
+ $howdy = __( 'Anonymous' );
+ $class = empty( $avatar ) ? '' : 'with-avatar';
+
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'my-account',
+ 'parent' => 'top-secondary',
+ 'title' => $howdy . $avatar,
+ 'href' => 'http://bbpress.org/login/',
+ 'meta' => array(
+ 'class' => $class,
+ 'title' => __('My Account'),
+ ),
+ ) );
+ }
+}
+add_action( 'admin_bar_menu', 'bbporg_admin_bar_my_account_item', 0 );
+
+/**
+ * Add the "My Account" submenu items.
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.2
+ */
+function bbporg_admin_bar_my_account_menu( $wp_admin_bar ) {
+
+ // Logged in
+ if ( is_user_logged_in() ) {
+ $user_id = get_current_user_id();
+ $current_user = wp_get_current_user();
+ $profile_url = get_edit_profile_url( $user_id );
+
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'my-account',
+ 'id' => 'user-actions',
+ ) );
+
+ $user_info = get_avatar( $user_id, 64 );
+ $user_info .= "<span class='display-name'>{$current_user->display_name}</span>";
+
+ if ( $current_user->display_name !== $current_user->user_nicename )
+ $user_info .= "<span class='username'>{$current_user->user_nicename}</span>";
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'user-info',
+ 'title' => $user_info,
+ 'href' => $profile_url,
+ 'meta' => array(
+ 'tabindex' => -1,
+ ),
+ ) );
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'edit-profile',
+ 'title' => __( 'Edit My Profile' ),
+ 'href' => $profile_url,
+ ) );
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'logout',
+ 'title' => __( 'Log Out' ),
+ 'href' => wp_logout_url(),
+ ) );
+
+ // User topics
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'my-account',
+ 'id' => 'user-topics',
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary',
+ ),
+ ) );
+
+ // Add bbPress menus if bbPress is enabled
+ if ( function_exists( 'bbpress' ) ) {
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-topics',
+ 'id' => 'topics-started',
+ 'title' => __( 'Topics Started' ),
+ 'href' => bbp_get_user_topics_created_url( bbp_get_current_user_id() ),
+ ) );
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-topics',
+ 'id' => 'replies-created',
+ 'title' => __( 'Replies Created' ),
+ 'href' => bbp_get_user_replies_created_url( bbp_get_current_user_id() ),
+ ) );
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-topics',
+ 'id' => 'subscriptions',
+ 'title' => __( 'Subscribed Topics' ),
+ 'href' => bbp_get_subscriptions_permalink( bbp_get_current_user_id() ),
+ ) );
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-topics',
+ 'id' => 'favorites',
+ 'title' => __( 'Favorite Topics' ),
+ 'href' => bbp_get_favorites_permalink( bbp_get_current_user_id() ),
+ ) );
+ }
+
+ // Anonymous
+ } else {
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'my-account',
+ 'id' => 'user-actions',
+ ) );
+
+ $user_info = get_avatar( 0, 64, 'mystery' );
+ $user_info .= '<span class="display-name">Anonymous</span>';
+ $user_info .= '<span class="username">Not Logged In</span>';
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'user-info',
+ 'title' => $user_info,
+ 'href' => 'http://bbpress.org/login/',
+ 'meta' => array(
+ 'tabindex' => -1,
+ ),
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'register',
+ 'title' => __( 'Register' ),
+ 'href' => 'http://bbpress.org/register/'
+ ) );
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'lost-pass',
+ 'title' => __( 'Lost Password' ),
+ 'href' => 'http://bbpress.org/lost-password/'
+ ) );
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'login',
+ 'title' => __( 'Log In' ),
+ 'href' => 'http://bbpress.org/login/'
+ ) );
+ }
+}
+add_action( 'admin_bar_menu', 'bbporg_admin_bar_my_account_menu', 7 );
</ins><span class="cx">Property changes on: sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/toolbar.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbbpressorgtoolsphp"></a>
<div class="addfile"><h4>Added: sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/tools.php (0 => 447)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/tools.php (rev 0)
+++ sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/tools.php 2014-02-28 20:27:16 UTC (rev 447)
</span><span class="lines">@@ -0,0 +1,110 @@
</span><ins>+<?php
+
+/**
+ * Hack to refresh topic and forum data when bug prevents last active times from
+ * updating (splits/merges/trash/spam/etc...)
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.1
+ * @return If not refreshing
+ */
+function bbporg_recount_current_thing() {
+
+ // Bail if not capable
+ if ( ! current_user_can( 'moderate' ) )
+ return;
+
+ // Bail if no refresh
+ if ( empty( $_GET['refresh'] ) || ( 'true' != $_GET['refresh'] ) )
+ return;
+
+ // Refresh topic data
+ if ( bbp_is_single_topic() ) {
+ bbp_update_topic_voice_count();
+ bbp_update_topic_last_reply_id();
+ bbp_update_topic_last_active_id();
+ bbp_update_topic_last_active_time();
+
+ // Redirect without _GET
+ wp_safe_redirect( bbp_get_topic_permalink() );
+ die;
+
+ // Refresh forum data
+ } elseif ( bbp_is_single_forum() ) {
+ bbp_update_forum_last_reply_id();
+ bbp_update_forum_last_topic_id();
+ bbp_update_forum_last_active_id();
+ bbp_update_forum_last_active_time();
+
+ // Redirect without _GET
+ wp_safe_redirect( bbp_get_forum_permalink() );
+ die;
+ }
+}
+add_action( 'bbp_template_redirect', 'bbporg_recount_current_thing' );
+
+/**
+ * Allow moderators to mark users as spammers
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.4
+ * @return If not spamming a user
+ */
+function bbporg_make_user_spammer() {
+
+ // Bail if not capable
+ if ( ! current_user_can( 'moderate' ) )
+ return;
+
+ // Bail if not viewing a user
+ if ( ! bbp_is_single_user() )
+ return;
+
+ // Bail if no refresh
+ if ( empty( $_GET['spammer'] ) || ( 'true' != $_GET['spammer'] ) )
+ return;
+
+ // Get the user ID
+ $user_id = bbp_get_displayed_user_id();
+
+ // Bail if empty and protect super admins
+ if ( empty( $user_id ) || is_super_admin( $user_id ) )
+ return;
+
+ global $wpdb;
+
+ // 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_public_status_id();
+
+ // Loop through blogs and remove their posts
+ // 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_spam_topic( $post_id );
+ break;
+
+ case bbp_get_reply_post_type() :
+ bbp_spam_reply( $post_id );
+ break;
+ }
+ }
+ }
+
+ // Block the user
+ bbp_set_user_role( $user_id, bbp_get_blocked_role() );
+
+ // Redirect without _GET
+ wp_safe_redirect( bbp_get_user_profile_url( $user_id ) );
+ die;
+}
+add_action( 'bbp_template_redirect', 'bbporg_make_user_spammer' );
</ins><span class="cx">Property changes on: sites/trunk/buddypress.org/public_html/wp-content/plugins/bbpress-org/tools.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbuddypressorgbuddypressdotorgphp"></a>
<div class="addfile"><h4>Added: sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/buddypress-dot-org.php (0 => 447)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/buddypress-dot-org.php (rev 0)
+++ sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/buddypress-dot-org.php 2014-02-28 20:27:16 UTC (rev 447)
</span><span class="lines">@@ -0,0 +1,97 @@
</span><ins>+<?php
+
+/**
+ * Plugin Name: BuddyPress.org Tweaks
+ * Description: Code specific to BuddyPress.org
+ * Version: 1.0.5
+ * Author: jjj
+ * Author URI: http://jaco.by
+ */
+
+// Include files
+include_once( plugin_dir_path( __FILE__ ) . 'toolbar.php' );
+
+if ( !function_exists( 'bporg_unhook_single_user_filter' ) )
+ include_once( plugin_dir_path( __FILE__ ) . 'extensions.php' );
+
+// Always show the toolbar
+if ( 'profiles.wordpress.org' != $_SERVER['HTTP_HOST'] )
+ add_filter( 'show_admin_bar', '__return_true' );
+
+/**
+ * This function forces the encoding to utf8
+ */
+function bporg_force_encoding() {
+ global $wpdb;
+
+ // Set dbhs to an empty array - unsetting it causes headaches
+ $wpdb->dbhs = array();
+ $wpdb->charset = 'utf8';
+}
+bporg_force_encoding();
+
+function bporg_maintenance() {
+ if ( is_super_admin() )
+ return;
+
+ if ( 'buddypress.org' == $_SERVER['HTTP_HOST'] ) {
+ header( 'Retry-After: 7200' );
+ wp_die( 'BuddyPress.org is down for maintenance. See you tomorrow!', 'Be back soon!', array( 'response' => 503 ) );
+ }
+}
+//add_action( 'init', 'bporg_maintenance', 99 );
+
+/**
+ * Remove the bbPress dashboard widget, since it uses get_users() and causes
+ * major slow-down.
+ *
+ * @author johnjamesjacoby
+ * @since 1.0
+ * @param type $admin
+ */
+function bporg_remove_dashboard_widget( $admin ) {
+ remove_action( 'wp_dashboard_setup', array( $admin, 'dashboard_widget_right_now' ) );
+}
+add_action( 'bbp_admin_loaded', 'bporg_remove_dashboard_widget' );
+
+/**
+ * A cheap and effective way to keep non-admins out of wp-admin.
+ *
+ * @author johnjamesjacoby
+ * @since 1.0
+ * @todo flesh this out a bit more
+ * @return if user is an admin
+ */
+function bporg_admin_redirect() {
+ if ( is_super_admin()
+ || current_user_can( 'contributor' )
+ || current_user_can( 'author' )
+ || current_user_can( 'editor' )
+ || current_user_can( 'administrator' )
+ )
+ return;
+
+ // Allow registered unprivileged admin-ajax.php requests for
+ // profiles.wordpress.org to pass through.
+ if ( 'profiles.wordpress.org' == $_SERVER['HTTP_HOST']
+ && isset( $_REQUEST['action'] )
+ && has_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] )
+ )
+ return;
+
+ wp_safe_redirect( home_url( '/' ) );
+ die;
+}
+add_action( 'admin_init', 'bporg_admin_redirect' );
+
+/**
+ * Prevent bbPress profiles from colliding with BuddyPress ones
+ *
+ * This is a temporary measure until we unify user profiles
+ */
+function bporg_no_bbpress_profiles() {
+ if ( bp_is_user() ) {
+ remove_filter( 'template_include', 'bbp_template_include', 10 );
+ }
+}
+add_filter( 'bp_template_redirect', 'bporg_no_bbpress_profiles' );
</ins><span class="cx">Property changes on: sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/buddypress-dot-org.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbuddypressorgextensionsphp"></a>
<div class="addfile"><h4>Added: sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/extensions.php (0 => 447)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/extensions.php (rev 0)
+++ sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/extensions.php 2014-02-28 20:27:16 UTC (rev 447)
</span><span class="lines">@@ -0,0 +1,273 @@
</span><ins>+<?php
+
+/**
+ * Unhook the single user filter, causing issues with theme compat.
+ *
+ * @todo research this later
+ */
+function bporg_unhook_single_user_filter() {
+ remove_filter( 'bbp_is_single_user', 'bbp_filter_is_single_user', 10, 1 );
+}
+add_action( 'bp_init', 'bporg_unhook_single_user_filter', 11 );
+
+/**
+ * Activity requires diplay name be different than user name to prevent spam
+ */
+function bporg_activity_requires_display_name( &$activity_item ) {
+
+ // Bail if no user ID
+ if ( empty( $activity_item->user_id ) )
+ return false;
+
+ // Load user
+ $user = get_user_by( 'id', $activity_item->user_id );
+ $username = $user->user_login;
+ $displayname = bp_core_get_user_displayname( $activity_item->user_id );
+
+ // Unset the component if usernames are empty or the same
+ if ( empty( $displayname ) || ( $username == $displayname ) ) {
+ $activity_item->component = false;
+ }
+}
+add_filter( 'bp_activity_before_save', 'bporg_activity_requires_display_name' );
+
+/** User Search ***************************************************************/
+
+function bporg_users_count_sql( $query, $search_terms ) {
+ global $bp;
+
+ return "SELECT DISTINCT count(user_id) {$bp->profile->table_name_data} WHERE value LIKE '%%$search_terms%%' ORDER BY value ASC";
+}
+add_filter( 'bp_core_search_users_count_sql', 'bporg_users_count_sql', 10, 2 );
+
+function bporg_users_sql( $query, $search_terms, $pag_sql ) {
+ global $bp;
+
+ return "SELECT DISTINCT user_id FROM {$bp->profile->table_name_data} WHERE value LIKE '%%$search_terms%%' ORDER BY value ASC{$pag_sql}";
+}
+add_filter( 'bp_core_search_users_sql', 'bporg_users_sql', 10, 3 );
+
+/** User Joins ****************************************************************/
+
+function bporg_activity_comments_user_filter( $sql ) {
+ return str_replace( 'minibb_users u,', '', str_replace( 'u.ID = a.user_id AND', '', str_replace( ', u.user_email, u.user_nicename, u.user_login, u.display_name', '', $sql ) ) );
+}
+add_filter( 'bp_activity_comments_user_join_filter', 'bporg_activity_comments_user_filter' );
+
+function bporg_activity_user_filter( $sql ) {
+ return str_replace( 'LEFT JOIN minibb_users u ON a.user_id = u.ID', '', str_replace( ', u.user_email, u.user_nicename, u.user_login, u.display_name', '', $sql ) );
+}
+add_filter( 'bp_activity_get_user_join_filter', 'bporg_activity_user_filter' );
+
+function bporg_group_admin_filter( $sql ) {
+ return str_replace( 'u.ID = m.user_id AND ', '', str_replace( 'minibb_users u, ', '', str_replace( 'u.ID as user_id, u.user_login, u.user_email, u.user_nicename, ', 'm.user_id, ', $sql ) ) );
+}
+add_filter( 'bp_group_admin_mods_user_join_filter', 'bporg_group_admin_filter' );
+
+function bporg_group_members_filter( $sql ) {
+ return str_replace( ', u.user_login, u.user_nicename, u.user_email', '', str_replace( 'minibb_users u, ', '', str_replace( 'u.ID = m.user_id AND u.ID = pd.user_id', 'm.user_id = pd.user_id', $sql ) ) );
+}
+add_filter( 'bp_group_members_user_join_filter', 'bporg_group_members_filter' );
+
+function bporg_group_members_count_filter( $sql ) {
+ return str_replace( 'u.ID = m.user_id AND ', '', str_replace( 'minibb_users u, ', '', str_replace( 'u.ID as user_id, u.user_login, u.user_email, u.user_nicename, ', 'm.user_id, ', $sql ) ) );
+}
+add_filter( 'bp_group_members_count_user_join_filter', 'bporg_group_members_count_filter' );
+
+/** Other Functions ***********************************************************/
+
+function bporg_redirect() {
+ $uri_chunks = explode( '/', $_SERVER['REQUEST_URI'] );
+
+ // Redirect /forums/ to /support/
+ if ( $uri_chunks[1] == 'forums' && empty( $uri_chunks[2] ) )
+ bp_core_redirect( 'http://buddypress.org/support/' );
+
+ // Redirect members directory to root to block heavy paginated user queries
+ if ( ( $uri_chunks[1] == 'members' ) || ( $uri_chunks[1] == 'community' && $uri_chunks[2] == 'members' && empty( $uri_chunks[3] ) ) )
+ bp_core_redirect( 'http://buddypress.org' );
+
+ // Redirect members directory to root to block heavy paginated user queries
+ if ( $uri_chunks[1] == 'community' && $uri_chunks[2] == 'groups' ) {
+
+ if ( !empty( $uri_chunks[5] ) && ( $uri_chunks[5] == 'topic' ) ) {
+ bp_core_redirect( 'http://buddypress.org/support/topic/' . $uri_chunks[6] . '/' );
+
+ } elseif ( empty( $uri_chunks[4] ) || ( $uri_chunks[4] == 'forum' ) ) {
+
+ // Use legacy group slug
+ if ( ! in_array( $uri_chunks[3], array( 'gallery', 'how-to-and-troubleshooting' ) ) ) {
+ bp_core_redirect( 'http://buddypress.org/support/forum/plugin-forums/' . $uri_chunks[3] . '/' );
+
+ // Root forums, maybe with new slug
+ } else {
+
+ // New forums locations
+ switch ( $uri_chunks[3] ) {
+ case 'gallery' :
+ $url = 'http://buddypress.org/support/forum/your-buddypress/';
+ break;
+ case 'how-to-and-troubleshooting' :
+ $url = 'http://buddypress.org/support/forum/how-to/';
+ break;
+ case 'creating-and-extending' :
+ $url = 'http://buddypress.org/support/forum/extending/';
+ break;
+ case 'requests-and-feedback' :
+ $url = 'http://buddypress.org/support/forum/feedback/';
+ break;
+ case 'buddypress' :
+ $url = 'http://buddypress.org/support/forum/installing/';
+ break;
+ case 'third-party-plugins' :
+ $url = 'http://buddypress.org/support/forum/plugins/';
+ break;
+ default:
+ $url = trailingslashit( 'http://buddypress.org/support/forum/' . $uri_chunks[3] );
+ break;
+ }
+ bp_core_redirect( $url );
+ }
+ }
+ }
+
+ // Redirect /support/topics/ to /support/
+ if ( $uri_chunks[1] == 'support' && ( !empty( $uri_chunks[2] ) && ( 'topics' == $uri_chunks[2] ) ) )
+ bp_core_redirect( 'http://buddypress.org/support/' );
+
+ // Redirect /members/ to /community/members/
+ if ( $uri_chunks[1] == 'members' && !empty( $uri_chunks[2] ) )
+ bp_core_redirect( 'http://buddypress.org/community/members/' . strtolower( $uri_chunks[2] ) . '/' );
+}
+add_action( 'init', 'bporg_redirect' );
+
+function wporg_profiles_redirect() {
+ $uri_chunks = explode( '/', trim( $_SERVER['REQUEST_URI'], '/' ) );
+ if ( 'users' == $uri_chunks[0] ) {
+ if ( ! empty( $uri_chunks[1] ) )
+ wp_redirect( 'http://profiles.wordpress.org/' . $uri_chunks[1] . '/', 301 );
+ else
+ wp_redirect( 'http://wordpress.org/' );
+ exit;
+ }
+
+ if ( get_user_by( 'slug', $uri_chunks[0] ) )
+ return;
+ if ( $user = get_user_by( 'login', urldecode( $uri_chunks[0] ) ) ) {
+ wp_redirect( 'http://profiles.wordpress.org/' . $user->user_nicename . '/', 301 );
+ exit;
+ } elseif ( $user = get_user_by( 'login', str_replace( ' ', '', urldecode( $uri_chunks[0] ) ) ) ) {
+ wp_redirect( 'http://profiles.wordpress.org/' . $user->user_nicename . '/', 301 );
+ exit;
+ }
+
+ // For strange reasons, BP uses 'wp' rather than template_redirect.
+ add_action( 'wp', 'wporg_profiles_maybe_template_redirect', 0 );
+}
+
+function wporg_profiles_maybe_template_redirect() {
+ if ( is_robots() || is_feed() || is_trackback() )
+ return;
+
+ ob_start();
+ wp_redirect( 'http://wordpress.org/' );
+ exit;
+}
+
+if ( 'profiles.wordpress.org' == $_SERVER['HTTP_HOST'] && ! is_admin() && defined( 'WP_USE_THEMES' ) && WP_USE_THEMES ) {
+ add_action( 'init', 'wporg_profiles_redirect', 9 ); // before bp_init
+ add_filter( 'bp_do_redirect_canonical', '__return_false' ); // Overrides #BP1741
+}
+
+function bporg_insert_at_mention( $content, $activity_obj ) {
+ global $bp;
+
+ if ( bp_is_my_profile() || !$bp->displayed_user->id )
+ return $content;
+
+ if ( 'activity_update' != $activity_obj->type )
+ return $content;
+
+ return '<a href="' . $bp->displayed_user->domain . '">@' . bp_core_get_username( $bp->displayed_user->id ) . '</a> ' . $content;
+}
+add_filter( 'bp_activity_content_before_save', 'bporg_insert_at_mention', 10, 2 );
+
+function bporg_activity_with_others_filter( $qs ) {
+ global $bp;
+
+ $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
+
+ /* Only filter on directory pages (no action) and the following scope on activity object. */
+ if ( ( 'dashboard' == $bp->current_action && strpos( $qs, 'personal' ) !== false ) || 'just-me' == $bp->current_action ) {
+ if ( strpos( $qs, 'filter' ) === false )
+ $qs .= '&search_terms=@' . bp_core_get_username( $user_id ) . '<';
+
+ return $qs;
+ } else {
+ return $qs;
+ }
+}
+//add_filter( 'bp_ajax_querystring', 'bporg_activity_with_others_filter', 11 );
+
+function bporg_fix_activity_redirect( $redirect, $activity ) {
+ global $bp;
+
+ $redirect = false;
+ /* Redirect based on the type of activity */
+ if ( $activity->component == $bp->groups->id ) {
+ if ( $activity->user_id ) {
+ $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->name . '/' . $activity->id . '/';
+ }
+ } else
+ $redirect = bp_core_get_user_domain( $activity->user_id, $activity->user_nicename, $activity->user_login ) . $bp->activity->name . '/' . $activity->id;
+
+ return $redirect;
+}
+add_filter( 'bp_activity_permalink_redirect_url', 'bporg_fix_activity_redirect', 10, 2 );
+
+// Borrowed from bbPress
+function bporg_encodeit( $matches ) {
+ $text = trim($matches[2]);
+ $text = htmlspecialchars($text, ENT_QUOTES);
+ $text = str_replace(array("\r\n", "\r"), "\n", $text);
+ $text = preg_replace("|\n\n\n+|", "\n\n", $text);
+ $text = str_replace('&amp;', '&', $text);
+ $text = str_replace('&lt;', '<', $text);
+ $text = str_replace('&gt;', '>', $text);
+ $text = "<code>$text</code>";
+ if ( "`" != $matches[1] )
+ $text = "<pre>$text</pre>";
+ return $text;
+}
+
+// Borrowed from bbPress
+function bporg_decodeit( $matches ) {
+ $text = $matches[2];
+ $trans_table = array_flip(get_html_translation_table(HTML_ENTITIES));
+ $text = strtr($text, $trans_table);
+ $text = str_replace('<br />', '<coded_br />', $text);
+ $text = str_replace('<p>', '<coded_p>', $text);
+ $text = str_replace('</p>', '</coded_p>', $text);
+ $text = str_replace(array('&','&'), '&', $text);
+ $text = str_replace(''', "'", $text);
+ if ( '<pre><code>' == $matches[1] )
+ $text = "\n$text\n";
+ return "`$text`";
+}
+
+// Borrowed from bbPress. Makes code in backticks work, both in forum posts and in activity updates.
+function bporg_code_trick( $text ) {
+ $text = str_replace(array("\r\n", "\r"), "\n", $text);
+ $text = preg_replace_callback("|(`)(.*?)`|", 'bporg_encodeit', $text);
+ $text = preg_replace_callback("!(^|\n)`(.*?)`!s", 'bporg_encodeit', $text);
+ return $text;
+}
+add_filter( 'bp_get_activity_content_body', 'bporg_code_trick', 1 );
+
+function bporg_redirect_to_search() {
+ if ( bp_is_current_component( 'search' ) ) {
+ $terms = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
+ bp_core_redirect( add_query_arg( array( 's' => $terms ), bp_get_root_domain() ) );
+ }
+}
+add_action( 'bp_init', 'bporg_redirect_to_search', 3 );
</ins><span class="cx">Property changes on: sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/extensions.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="sitestrunkbuddypressorgpublic_htmlwpcontentpluginsbuddypressorgtoolbarphp"></a>
<div class="addfile"><h4>Added: sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/toolbar.php (0 => 447)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/toolbar.php (rev 0)
+++ sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/toolbar.php 2014-02-28 20:27:16 UTC (rev 447)
</span><span class="lines">@@ -0,0 +1,433 @@
</span><ins>+<?php
+
+/**
+ * Remove a few toolbar items we do not need
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.1
+ */
+function bporg_toolbar_tweaks() {
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 4 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
+
+ // BuddyPress Menus
+ remove_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_my_account_menu', 4 );
+
+ if ( is_super_admin() )
+ return;
+
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 70 );
+ remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 );
+}
+add_action( 'add_admin_bar_menus', 'bporg_toolbar_tweaks', 11 );
+
+/**
+ * Remove the BuddyPress and bbPress about menus
+ *
+ * @author johnjamesjacoby
+ * @global object $wp_admin_bar
+ */
+function bporg_remove_about_pages( $wp_admin_bar ) {
+ $wp_admin_bar->remove_menu( 'bp-about' );
+ $wp_admin_bar->remove_menu( 'bbp-about' );
+}
+add_action( 'admin_bar_menu', 'bporg_remove_about_pages', 99 );
+
+/**
+ * Add a new main top-left menu with links for each project.
+ *
+ * @todo GlotPress/BackPress
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.1
+ */
+function bporg_new_admin_bar_wp_menu( $wp_admin_bar ) {
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'wp-logo',
+ 'title' => '<span class="ab-icon"></span>',
+ 'href' => 'http://wordpress.org',
+ 'meta' => array(
+ 'title' => __( 'WordPress.org' ),
+ ),
+ ) );
+
+ /** WordPress *************************************************************/
+
+ // Add "About WordPress" link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo',
+ 'id' => 'wordpress',
+ 'title' => __( 'WordPress.org' ),
+ 'href' => 'http://wordpress.org',
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wordpress',
+ 'id' => 'wp-about',
+ 'title' => __( 'About WordPress' ),
+ 'href' => 'http://wordpress.org/about/',
+ ) );
+
+ // Add codex link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wordpress',
+ 'id' => 'wp-documentation',
+ 'title' => __('Documentation'),
+ 'href' => 'http://codex.wordpress.org/',
+ ) );
+
+ // Add forums link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wordpress',
+ 'id' => 'wp-support-forums',
+ 'title' => __('Support Forums'),
+ 'href' => 'http://wordpress.org/support/',
+ ) );
+
+ // Add feedback link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wordpress',
+ 'id' => 'wp-feedback',
+ 'title' => __('Feedback'),
+ 'href' => 'http://wordpress.org/support/forum/requests-and-feedback',
+ ) );
+
+ /** BuddyPress Developer **/
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'wordpress',
+ 'id' => 'wp-developer',
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary',
+ ),
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-developer',
+ 'id' => 'wp-trac',
+ 'title' => __( 'Developer Trac' ),
+ 'href' => 'http://core.trac.wordpress.org'
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-developer',
+ 'id' => 'wp-dev-blog',
+ 'title' => __( 'Developer Blog' ),
+ 'href' => 'http://make.wordpress.org'
+ ) );
+
+ /** bbPress ***************************************************************/
+
+ // Add "About WordPress" link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo',
+ 'id' => 'bbpress',
+ 'title' => __( 'bbPress.org' ),
+ 'href' => 'http://bbpress.org',
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbpress',
+ 'id' => 'bbp-about',
+ 'title' => __( 'About bbPress' ),
+ 'href' => 'http://bbpress.org/about/',
+ ) );
+
+ // Add codex link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbpress',
+ 'id' => 'bbp-documentation',
+ 'title' => __( 'Documentation' ),
+ 'href' => 'http://codex.bbpress.org/',
+ ) );
+
+ // Add forums link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbpress',
+ 'id' => 'bbp-support-forums',
+ 'title' => __( 'Support Forums' ),
+ 'href' => __( 'http://bbpress.org/forums/' ),
+ ) );
+
+ // Add feedback link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbpress',
+ 'id' => 'bbp-feedback',
+ 'title' => __( 'Feedback' ),
+ 'href' => 'http://bbpress.org/forums/forum/requests-and-feedback',
+ ) );
+
+ /** BuddyPress Developer **/
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'bbpress',
+ 'id' => 'bbp-developer',
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary',
+ ),
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbp-developer',
+ 'id' => 'bbp-trac',
+ 'title' => __( 'Developer Trac' ),
+ 'href' => 'http://bbpress.trac.wordpress.org'
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bbp-developer',
+ 'id' => 'bbp-dev-blog',
+ 'title' => __( 'Developer Blog' ),
+ 'href' => 'http://bbpdevel.wordpress.com'
+ ) );
+
+ /** BuddyPress ************************************************************/
+
+ // Add "About WordPress" link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'wp-logo',
+ 'id' => 'buddypress',
+ 'title' => __( 'BuddyPress.org' ),
+ 'href' => 'http://buddypress.org',
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'buddypress',
+ 'id' => 'bp-about',
+ 'title' => __( 'About BuddyPress' ),
+ 'href' => 'http://buddypress.org/about/',
+ ) );
+
+ // Add codex link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'buddypress',
+ 'id' => 'bp-documentation',
+ 'title' => __( 'Documentation' ),
+ 'href' => 'http://codex.buddypress.org/',
+ ) );
+
+ // Add forums link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'buddypress',
+ 'id' => 'bp-support-forums',
+ 'title' => __( 'Support Forums' ),
+ 'href' => 'http://buddypress.org/forums/',
+ ) );
+
+ // Add feedback link
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'buddypress',
+ 'id' => 'bp-feedback',
+ 'title' => __( 'Feedback' ),
+ 'href' => 'http://buddypress.org/support/forum/feedback/',
+ ) );
+
+ /** BuddyPress Developer **/
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'buddypress',
+ 'id' => 'bp-developer',
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary',
+ ),
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bp-developer',
+ 'id' => 'bp-trac',
+ 'title' => __( 'Developer Trac' ),
+ 'href' => 'http://buddypress.trac.wordpress.org'
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bp-developer',
+ 'id' => 'bp-dev-blog',
+ 'title' => __( 'Developer Blog' ),
+ 'href' => 'http://bpdevel.wordpress.com'
+ ) );
+}
+add_action( 'admin_bar_menu', 'bporg_new_admin_bar_wp_menu', 10 );
+
+/**
+ * Add a new "Site Name" menu with less things for average users to do
+ *
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.2
+ */
+function bporg_new_admin_bar_site_menu( $wp_admin_bar ) {
+
+ // Profiles
+ if ( 'profiles.wordpress.org' == $_SERVER['HTTP_HOST'] ) {
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'bp-site-name',
+ 'title' => __( 'WordPress.org' ),
+ 'href' => 'http://wordpress.org'
+ ) );
+
+ return;
+
+ // bbPress Codex
+ } elseif ( 'codex.bbpress.org' == $_SERVER['HTTP_HOST'] ) {
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'bp-site-name',
+ 'title' => __( 'bbPress.org' ),
+ 'href' => 'http://bbpress.org'
+ ) );
+
+ return;
+
+ // BuddyPress Network
+ } else {
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'bp-site-name',
+ 'title' => __( 'BuddyPress.org' ),
+ 'href' => 'http://buddypress.org'
+ ) );
+ }
+
+ // Create submenu items.
+
+ if ( is_user_logged_in() ) {
+
+ // Add an option to visit the site.
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bp-site-name',
+ 'id' => 'bp-new-topic',
+ 'title' => __( 'Create New Topic' ),
+ 'href' => 'http://buddypress.org/forums/new-topic/'
+ ) );
+
+ // Add an option to visit the admin dashboard
+ if ( is_super_admin() ) {
+
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'bp-site-name',
+ 'id' => 'bp-site-name-super-admin',
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary',
+ ),
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bp-site-name-super-admin',
+ 'id' => 'bp-admin-link',
+ 'title' => __( 'Admin Dashbooard' ),
+ 'href' => get_admin_url()
+ ) );
+ }
+
+ // Not logged in
+ } else {
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'bp-site-name',
+ 'id' => 'bp-login',
+ 'title' => __( 'Log in' ),
+ 'href' => 'http://buddypress.org/login/'
+ ) );
+ }
+}
+add_action( 'admin_bar_menu', 'bporg_new_admin_bar_site_menu', 20 );
+
+/**
+ * Add the "My Account" menu and all submenus.
+ *
+ * @since BuddyPress (1.6)
+ * @todo Deprecate WP 3.2 Toolbar compatibility when we drop 3.2 support
+ */
+function bporg_admin_bar_my_account_menu( $wp_admin_bar ) {
+ global $bp;
+
+ // Logged in user
+ if ( is_user_logged_in() ) {
+
+ // Manually include this, incase of BP maintenance mode
+ if ( ! function_exists( 'bp_loggedin_user_domain' ) ) {
+ require_once( WP_CONTENT_DIR . '/plugins/buddypress/bp-members/bp-members-template.php' );
+ }
+
+ // Stored in the global so we can add menus easily later on
+ $bp->my_account_menu_id = 'my-account-buddypress';
+
+ // Create the main 'My Account' menu
+ $wp_admin_bar->add_menu( array(
+ 'id' => $bp->my_account_menu_id,
+ 'group' => true,
+ 'title' => __( 'Edit My Profile', 'buddypress' ),
+ 'href' => bp_loggedin_user_domain(),
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary'
+ ) ) );
+
+ // Show login and sign-up links
+ } elseif ( !empty( $wp_admin_bar ) ) {
+ add_filter ( 'show_admin_bar', '__return_true' );
+
+ $wp_admin_bar->add_group( array(
+ 'parent' => 'my-account',
+ 'id' => 'user-actions',
+ ) );
+
+ $user_info = get_avatar( 0, 64, 'mystery' );
+ $user_info .= '<span class="display-name">Anonymous</span>';
+ $user_info .= '<span class="username">Not Logged In</span>';
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'user-info',
+ 'title' => $user_info,
+ 'href' => 'http://buddypress.org/login/',
+ 'meta' => array(
+ 'tabindex' => -1,
+ ),
+ ) );
+
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'register',
+ 'title' => __( 'Register' ),
+ 'href' => 'http://buddypress.org/register/'
+ ) );
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'lost-pass',
+ 'title' => __( 'Lost Password' ),
+ 'href' => 'http://buddypress.org/lost-password/'
+ ) );
+ $wp_admin_bar->add_menu( array(
+ 'parent' => 'user-actions',
+ 'id' => 'login',
+ 'title' => __( 'Log In' ),
+ 'href' => 'http://buddypress.org/login/'
+ ) );
+ }
+}
+add_action( 'admin_bar_menu', 'bporg_admin_bar_my_account_menu', 4 );
+
+/**
+ * Add the "My Account" item.
+ *
+ * @author johnjamesjacoby
+ * @since 1.0.2
+ */
+function bporg_admin_bar_my_account_item( $wp_admin_bar ) {
+
+ if ( is_user_logged_in() )
+ return;
+
+ $avatar = get_avatar( 0, 16, 'mystery' );
+ $howdy = __( 'Anonymous' );
+ $class = empty( $avatar ) ? '' : 'with-avatar';
+
+ $wp_admin_bar->add_menu( array(
+ 'id' => 'my-account',
+ 'parent' => 'top-secondary',
+ 'title' => $howdy . $avatar,
+ 'href' => 'http://buddypress.org/login/',
+ 'meta' => array(
+ 'class' => $class,
+ 'title' => __('My Account'),
+ ),
+ ) );
+}
+add_action( 'admin_bar_menu', 'bporg_admin_bar_my_account_item', 0 );
</ins><span class="cx">Property changes on: sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/toolbar.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span></div>
</body>
</html>