Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h06/mnt/47169/domains/themehybrid.com/html/community/bb-settings.php on line 186

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h06/mnt/47169/domains/themehybrid.com/html/community/bb-includes/backpress/functions.wp-object-cache.php on line 108

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h06/mnt/47169/domains/themehybrid.com/html/community/bb-includes/backpress/pomo/mo.php on line 171

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h06/mnt/47169/domains/themehybrid.com/html/community/bb-includes/functions.bb-l10n.php on line 484

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h06/mnt/47169/domains/themehybrid.com/html/community/bb-includes/backpress/class.wp-taxonomy.php on line 581
Hybrid and BuddyPress « Community

Welcome, guest!

Feel free to read the blog, browse for themes, or join the club.

The community forums are currently being phased out. At the end of February or early March 2012, you will no longer be able to post here. This is because the entire site is being restructured. Please use the main forums for discussions.

Hybrid and BuddyPress

  1. I wanted to open up an official topic that deals specifically with the Hybrid theme and BuddyPress because this can be a huge topic in and of itself.

    What we'll be discussing here is ideas about the best way to integrate BuddyPress features and theme templates into the Hybrid theme.

    Some rules for Hybrid

    • Integration cannot affect WP users that don't use BuddyPress.
    • BuddyPress needs to be as separate from the core framework as possible to avoid as much extra PHP running for non-BuddyPress users.

    That's basically it at this point. Hybrid is a WordPress theme first and foremost. It's purpose isn't to be a BuddyPress theme, but one of its goals can be for complete integration with BuddyPress.

    Some ideas

    I'm thinking of making a separate /buddypress folder inside of /hybrid. Hybrid would then check to see if BuddyPress is installed before loading any of those files.

    Everything about BuddyPress would live inside of the /buddypress directory, including templates. I don't really want to clutter the root /hybrid folder with a lot of extra templates and folders.

    Where I stand

    There's a reason Hybrid is good at what it's used for — I've been using and developing with WordPress for years. I've spent a few days, at most, playing around with BuddyPress. Diving straight into this thing without a lot of feedback, usage, and tinkering around with the code won't work well.

    I need to understand the system and how the system is used before making Hybrid compatible with BuddyPress.

    ETA?

    I don't want to set any kind of timeframe on this. There's just too much involved to even begin to start thinking about when it'll be ready.

    Your turn

    Offer any feedback, ideas, links to other BP themes, documentation, and whatever else you feel would help.

  2. I'd suggest you ask Ron for his theme based on Hybrid/Buddypress and see the tradeoffs he made. He said he'd try to post it on freebpthemes.com, but you could probably get it from him directly.

    I'd definitely suggest separation. BP is changing too much to mix it in with WP-only templates. I'll be building a rather complex child theme with BP functionality over the next few months, so I'll share as I learn.

    My thought is to clone some Hybrid template files and add BP functionality to fit my needs. I don't think I'll use the same pages for the same functionality as default BP and I imagine others will want to be able to make similar tradeoffs. I'll probably create my own BP Codex in the process (at least for functions and tags) because it's a good way to keep track of what I'm doing/learning.

    Creating a Hybrid Framework for BP is gonna be challenging with the way it's coded.

    Good luck.

  3. Maybe a Hybrid BuddyPress plugin instead? That way its certain to stay separate and you won't need to check if BP is installed.

    The downside to this option is that its a separate project and might get neglected if its not in core.

  4. If you want to have a look at how we did it, I'd be more than happy to send you the files. Just send me your email via twitter, wptavern dm, or... uh, I guess you have my email since I'm signed up here. :D

    The way Buddypressifying themes works, is most of the BP parts are in their own folders anyway. We've tried to ensure that any themes we've done over still work when BP is deactivated.

    We've looked at the plugin method, and the BP devs have too. It's not quite as pluginifiable as it looks. :)

  5. @andrea, Ron has a new email from me on this issue - I'd love the files.

    UPDATED: Got the files, thanks!

    I've taken a decent look under the hood at the BP1.2 default theme and whoa there's alot there. It does look as if I could take the folders and move them over to my hybrid child theme folder. I could modify my child's style.css and a few bits from the BP default functions.php. The templates I shouldn't need.

    However, within those folders and files, there's tons of HTML that needs to be modified. That appears to be where the real work is - along with getting the js/ajax right.

    Does that sound about right? I'm not trying to make a new framework because I'd destroy everything on upgrading Hybrid.

  6. After looking at HybridBuddy, I think it should be possible to have Hybrid duplicate all the folders in the BP themes. Hybrid could detect BP's presence and only reference those folders as necessary. The trick would be recoding all the BP loops and other functionality that is buried in their themes. Otherwise, we could go the grandparent theme route, which nobody wants :-).

    For my current use, I'm going to try to put the BP folders in my child folder and test-test-test as I make modifications. I'll update what happens outside this thread.

  7. I'm checking out buddypress too & got it working easily enough inside of Hybrid today.
    Still needs a bit of work, but you can see what I did here
    http://xfactor-blogs.com/

  8. @davek,
    Both for Justin and for me, please let us know how you did the integration.

  9. @designOdyssey
    Good to catch up on buddypress & Justins forms.
    The integration is simple enough, just used some functions & includes from the buddypress 1.2 beta in a hybrid child theme.
    All buddypress functions seem to work as expected but we still need a few css tweaks, would love to have you or anyone else onboard to test it out.
    The theme is down to Patrick of http://developdaly.com/ and Justins Hybrid framework

  10. After playing with the BuddyPress 1.2 beta for another few hours, I see extremely few reasons that it would be incompatible with Hybrid.

    My integration does bulk out the child Hybrid theme with the addition of the BuddyPress theme folders, but I'm sure these could be put in a buddypress folder with a .htaccess rewrite.

    Including the BuddyPress required functions in the Hybrid child theme functions.php is simple enough.

    At the moment, I am only seeing 2 includes & some CSS additions needing to be added & I'm sure this could be done after a check on if you are using BuddyPress so would cause little to no extra load time.

  11. I tried this again today on a single WordPress install with BuddyPress 1.2beta.
    Works perfectly with very few child theme edits.
    All it needs is some CSS styling, if anyone wants to try it out let me know & I'll email or upload the child theme.
    I have working versions of Hybrid News & Structure but It could easily be added to any Hybrid child theme.

  12. I like the htaccess idea, but you'll need to disable or completely override the CSS. Also, for greater customization this might not work as almost everything may need to be moved around.

  13. If anyone wants to send me their files, you can post a link here or email me at:

    justin [at] justintadlock.com

    I'll be happy to look over what you all have been doing.

  14. My plan for right now

    What I'd really love to do is create a basic child theme that uses all the default Hybrid CSS. Then, I'd add the BuddyPress code, files, and folders to it.

    We could then have a good test run on what needs to be done.

    Once all the playing around with that is worked out, I'll start integrating it into the main theme.

  15. Justin, structure as a Hybrid child theme with BuddyPress:
    http://test.xfactor-blogs.com/
    MediaTemplate are having problems at the moment so the site might be a bit slow.
    Will zip up the files now & email to you.
    I'm not the best at CSS so would love for you to have a look.

  16. Sorry for the delay, nightmare with MT connection, email now sent with Structure BuddyPress.

  17. I've worked out the kinks for me and it's pretty simple. I used Hybrid News and these instructions are used after Hybrid News is up and running.

    1. Add all BP1.2 beta default theme folders to the Hybrid News theme folder

    2. Add a tag for "buddypress" in style.css for News

    3. Add the following from BP's style.css to News' style.css

    /***
     * The BuddyPress default theme styles.
     */
    @import url( _inc/css/default.css );
    
    /***
     * The admin bar styles.
     */
    @import url( _inc/css/adminbar.css );

    4. before all actions and filters in News' functions.php, make sure the following is in place:

    /* Stop the theme from killing WordPress if BuddyPress is not enabled. */
    if ( !class_exists( 'BP_Core_User' ) )
    	return false;
    
    /**
    * This is your child theme's functions.php file.
    * You should make edits and add additional code above this point.
    * Only change the functions below if you know what you're doing.
    */
    
    /********************************************************/
    
    /* Constant paths. */
    	define( 'HYBRID_NEWS', get_stylesheet_directory() );
    	define( 'HYBRID_NEWS_URL', get_stylesheet_directory_uri() );
    
    /* BP-RELATED Load the AJAX functions for the theme */
    require_once( HYBRID_NEWS . '/_inc/ajax.php' );
    
    /* BP RELATED Load the javascript for the theme */
    wp_enqueue_script( 'dtheme-ajax-js', HYBRID_NEWS_URL . '/_inc/global.js', array( 'jquery' ) );
    
    /* For localization. */
    	load_theme_textdomain( 'news', HYBRID_NEWS );
    
    /* Hybrid News theme settings. */
    	$news_settings = get_option( 'hybrid_news_theme_settings' );
    
    /* Include admin files. */
    	if ( is_admin() )
    		require_once( HYBRID_NEWS . '/library/admin/theme-settings.php' );

    5. After all the other code in functions.php add this from BP's functions.php

    /* Make sure the blog index page shows under /[HOME_BLOG_SLUG] if enabled */
    function bp_dtheme_show_home_blog() {
    	global $bp, $query_string, $paged;
    
    	if ( $bp->current_component == BP_HOME_BLOG_SLUG && ( !$bp->current_action || 'page' == $bp->current_action ) ) {
    		unset( $query_string );
    
    		if ( ( 'page' == $bp->current_action && $bp->action_variables[0] ) && false === strpos( $query_string, 'paged' ) ) {
    			$query_string .= '&paged=' . $bp->action_variables[0];
    			$paged = $bp->action_variables[0];
    		}
    
    		query_posts($query_string);
    
    		bp_core_load_template( 'index', true );
    	}
    }
    add_action( 'wp', 'bp_dtheme_show_home_blog', 2 );
    
    function bp_dtheme_firstname( $name = false, $echo = false ) {
    	global $bp;
    
    	if ( !$name )
    		$name = $bp->loggedin_user->fullname;
    
    	$fullname = (array)explode( ' ', $name );
    
    	if ( $echo )
    		echo $fullname[0];
    	else
    		return $fullname[0];
    }
    
    function bp_dtheme_show_on_frontpage() {
    	$settings = get_option( 'hybrid_news_theme_settings' );
    
    	if ( empty( $settings['show_on_frontpage'] ) || 'blog' == $settings['show_on_frontpage'] )
    		return 'blog';
    
    	return 'activity';
    }
    
    /* Add words that we need to use in JS to the end of the page so they can be translated and still used. */
    function bp_dtheme_js_terms() { ?>
    <script type="text/javascript">
    	var bp_terms_my_favs = '<?php _e( "My Favorites", "buddypress" ) ?>';
    	var bp_terms_accepted = '<?php _e( "Accepted", "buddypress" ) ?>';
    	var bp_terms_rejected = '<?php _e( "Rejected", "buddypress" ) ?>';
    	var bp_terms_show_all_comments = '<?php _e( "Show all comments for this thread", "buddypress" ) ?>';
    	var bp_terms_show_all = '<?php _e( "Show all", "buddypress" ) ?>';
    	var bp_terms_comments = '<?php _e( "comments", "buddypress" ) ?>';
    	</script>
    <?php
    }
    add_action( 'wp_footer', 'bp_dtheme_js_terms' );

    That's it. But, the css files imported in step 3 need to be modified. I started by commenting out the body and header styles, but much more needs to be done.

    Hope this helps. Thanks to davek and andrea_r for sending me files to play with so I could figure it out.

  18. Hi Justin, Just wondering if you had a chance to look at the files I sent you?
    I made another few small changes & am thinking of putting it live on a low traffic site to see if all is well, main thing holding me back now not having the page titles.
    Any idea how to fix that?

  19. Yep, I've been playing around with it some.

    For the page title, you'd probably have to filer wp_title and use bp_get_page_title(). Take a look at /bp-core/bp-core-templatetags.php. You could probably write your own filter function to handle just the BP pages.

  20. Excellent, thank you Justin.
    Adding add_action( 'wp_title', 'bp_get_page_title'); to my buddypress-functions.php does the trick but overwrites Hybrids title settings for all WP pages/posts, any idea how I would use bp_get_page_title only if I am viewing a BuddyPress page?

  21. Tried

    if ( wp_title() == '') {
    add_action( 'wp_title', 'bp_get_page_title');
    }

    and a few other variants, but it doesn't work. Is there a proper way to check if Hybrid post/page titles aren't defined & if so use bp_get_page_title?

  22. What I'd do is create a custom function:

    add_filter( 'wp_title', 'my_buddypress_title' );
    
    function my_buddypress_title( $title ) {
    	/* Custom code. */
    }

    Then, pull everything out of the bp_get_page_title() that I needed for just the BuddyPress pages. For everything else, I'd just return $title.

    I haven't really looked into it just yet though. It's on the to-do list for putting this thing together though.

  23. Thanks Justin, got it sorted.

    Just wondering what your thoughts are now on BuddyPress, do you plan on releasing templates anytime soon after 1.2 comes out of beta or will you be waiting till after WordPress 3 to see how it goes?

  24. Now using the BuddyPress RC, lots of speed improvements & seems to be working well inside Hybrid.

    Justin would you have any tips on how to load the required ajax, js & css only if viewing a BuddyPress page using a Hybrid child themes functions.php?

  25. I used this to load scripts only on pages I wanted certain js to load.

    // Add actions
    add_action('hybrid_head', 'conditional_scripts');
    
    function conditional_scripts() {
    	if(conditional using bp constant/tag available before hybrid_head) {
    wp_enqueue_script(whatever script)
    wp_print_styles(whatever style)
    endif;
    }

    Worked for loading scripts only on certain pages. I also think there are plugins for this and http://buddypress.org/forums/topic/convert-a-wordpress-theme-to-a-buddypress-theme#post-35653.

  26. I've put the BuddyPress 1.2 RC on http://american-idol-updates.com/ to see how it goes on a live site.
    Sorted out most of the issues, some CSS still to be corrected.

    Justin, any tips on how to add the BuddyPress page titles to the Hybrid breadcrumbs?

  27. @davek or @designOdyssey:

    I've added all of the folders from within bp-sn-parent into my custom-theme directory. The theme is working perfectly for standard WP stuff, but when I try to go to example.com/members or some BP-related page I'm just redirected back to the home page.

    What am I missing?

  28. Hi Patrick,
    If you want, I'll download your version of Malleable & add the BuddyPress RC2 & send to you so you can have a look at how I'm doing it.
    Just let me know your email if you want me to,
    Dave.

  29. also Patrick, if you are using bp-sn-parent you are using BuddyPress 1.1.3 or the backwards compatibility plugin.
    I'd really suggest working with the 1.2 RC, it's a lot faster & easier to work with.

  30. I'm using 1.2 RC2. From what I understand bp-sn-parent is still a required theme and essentially any child theme you create is actually a grand-child, like so:

    • bp-sn-parent
      • bp-default
        • custom-theme

    Maybe I'm completely off base and that's why I'm having issues.

    Anyway, my email address is patrick [at] developdaly dot com. Thanks for the help!

Reply »

You must log in to post.

Topic Info