Feature Your Forums And Get Them Noticed!

featured_forums

The forums on our Buddypress sites are the heart and soul of our communities, but how do we get them noticed more by our visitors and how do we keep those visitors up to date with the latest that’s going on?

I’m going to give you 2 VERY SIMPLE tricks that will enhance the visibility of your forums as well as make them quicker and easier to access.

Trick 1 – Make your forums the default ‘Groups’ tab

This trick can be done in 2 minutes and merely requires you to paste the following code into your bp-custom.php file:

function redirect_to_forum() {
global $bp;
$path = clean_url( $_SERVER['REQUEST_URI'] );
$path = apply_filters( 'bp_uri', $path );
if ( bp_is_group_home() && strpos( $path, $bp->bp_options_nav['groups']['home']['slug'] ) === false )
bp_core_redirect( $path . $bp->bp_options_nav['groups']['forum']['slug'] . '/' );
}
add_action( 'wp', 'redirect_to_forum' );

Now when a member of your site clicks on a group, rather than being forwarded to the group’s activity tab, they will hit your forums instead! this stops new members getting confused by the activity stream and thinking that the activity stream is actually a forum! (You may laugh, but it happens!) icon smile Feature Your Forums And Get Them Noticed!

Trick 2 – Install Rich’s ‘latest Forum Posts’ Widget

Now this widget is a must have in my opinion. It is actually part of Rich’s ‘Forum Extras’ plugin which comes with heaps of extras for your forums. Be sure to check it out if you really want to add a lot of new functionality to your group forums. The code snippet below adds a new widget that displays the latest forum topics.

Copy this code into your bp-custom.php or functions.php file:

class MY_Latest_Topics_Widget extends WP_Widget {
function my_latest_topics_widget() {
parent::WP_Widget( false, $name = __( 'Latest Topics', 'buddypress' ) );
//if ( is_active_widget( false, false, $this->id_base ) )
}
function widget($args, $instance) {
global $bp;
//don't care to load on these pages
if ( bp_is_register_page() || bp_is_activation_page() || bp_is_user_blogs() )
return;
if ( $bp->forums->slug == $bp->current_component )
return;
if ( $bp->forums->slug == $bp->current_component && bp_is_directory() )
return;
//add in more here if you do not want to display this on certain pages (see bp-core-templatetags for list of built-in checks)
extract( $args );
if ( !is_numeric( $instance['forum_latest_limit'] ) )
$instance['forum_latest_limit'] = 10;
echo $before_widget;
echo $before_title
. $widget_name
. $after_title;
if ( bp_has_forum_topics( 'no_stickies=no&page=false&max='. $instance['forum_latest_limit'] ) ) : ?>
10 ) ); $forum_latest_limit = strip_tags( $instance['forum_latest_limit'] ); ?>
Now go into your ‘widgets’ area in the WP backend and drag the ‘Latest Topics’ widget into your sidebar. You can set how many topics you want to display here too!

So there you have it! Hopefully your members will find your forums quicker and can now see what the latest chat is about when they are on any page of your site!

Get the conversation going!

BuddyPress Hosting Guide Looking for quality BuddyPress hosting? We will guide you through all the available hosting options and help you find the best webhost for your next BuddyPress project!

22 Responses to Feature Your Forums And Get Them Noticed!

  1. Avi M November 20, 2010 at 3:24 am #

    Can trick 1 be done via functions.php as well ? I have searched high and low for a bp-custom.php file in my folders but I can’t seem to find it. I know you write that Trick 2 can be done via either the folder, so I was hoping you maybe accidentally forgot to include functions.php in the first trick as an option.

    Thanks in advance.

    Reply
  2. Avi M November 21, 2010 at 8:46 pm #

    Regarding trick 2 when is paste the code into my site is the following error.

    Parse error: syntax error, unexpected ‘&’ in /home3/jxxxxxxx/public_html/wp-content/themes/genesis-buddy-1.2.1/child-theme/functions.php on line 50

    line 50 is

    if ( $bp->forums->slug == $bp->current_component )

    Looks to me like its something in the code I copied from this post.

    Any Ideas?

    Reply
  3. Twig November 26, 2010 at 8:38 am #

    Already had the widget, but thanks for Trick 1. Loving this site…

    Reply
  4. Twig November 26, 2010 at 9:13 am #

    Hmm…. Trick 1 didn’t seem to work for me. Where should this bp-custom file be located? In the BP-Default folder(If I’m using that theme of course)?

    Reply
  5. Boone December 8, 2010 at 2:29 am #

    Cool tricks!

    I should note that Trick 1 should probably check to see whether that group has forums enabled before redirecting (as noted in http://buddypress.org/community/groups/bp-group-reviews/forum/topic/the-page-isn%E2%80%99t-redirecting-properly/#post-81663)

    Off the top of my head:
    if ( empty( $bp->groups->current_group->enable_forum ) )
    return;

    right at the beginning of the function. :)

    Reply
  6. bowe December 10, 2010 at 12:37 am #

    Nice one Boone! I’ll update the trick to make sure it keeps on working on BP sites that have forums disabled :)

    Reply
  7. Aaron C. Yeagle January 17, 2011 at 9:42 pm #

    Trick 1 did nothing for me so I obviously missed something.
    I created a bp-custom.php file, added the above code and wrapped it in and uploaded to …/buddypress/
    Advice?

    Reply
  8. Patrick January 18, 2011 at 1:34 am #

    Hi Aaron,

    bp-custom.php needs to go in …/plugins directory, not …/buddypress.

    Reply
  9. Patrick January 18, 2011 at 1:46 am #

    BTW, can anyone clue me in on a way to adapt this redirect for member profiles?

    I’ve tried myself but either wind up with extra trailing slashes in the URL, or a blank screen.

    Reply
  10. King February 14, 2011 at 2:11 am #

    Trick 2 created no widget for me. I pasted the code — after fixing the character encoding — into functions.php and then a bp-custom.php file and neither worked.

    Reply
  11. Ellis Manfredonia March 1, 2011 at 2:17 pm #

    I just want to mention I am just beginner to blogging and honestly loved you’re web-site. Almost certainly I’m going to bookmark your website . You surely have beneficial articles. Kudos for sharing with us your blog site.

    Reply
  12. Dan V March 2, 2011 at 6:32 am #

    Hi – code #1 above breaks my site.
    Trying to go from the Group directory to a group gets a blank page.
    Any ideas why?
    WPMU 3.0.1 and BP 1.26.
    Thanks – DV

    Reply
  13. Dan V March 2, 2011 at 7:39 am #

    However this code which I found in the BP forums works !

    function redirect_to_forum() {
    global $bp;
    $path = clean_url( $_SERVER['REQUEST_URI'] );
    $path = apply_filters( ‘bp_uri’, $path );
    if ( bp_is_group_home() && $bp->current_action == $bp->bp_options_nav['groups']['home']['slug'] )
    bp_core_redirect( apply_filters( ‘bp_uri’, $bp->bp_options_nav['groups']['forum']['link']) );
    }
    add_action( ‘wp’, ‘redirect_to_forum’ );

    Reply
  14. Scotty June 8, 2011 at 12:39 am #

    I tried trick 1 – and it did not work. I have a function.php in my child theme – tried adding the code there nothing changed – I tried all a file bp-custom.php and placing the code in there – and nothing happened either?

    Reply
  15. AgregatorB July 3, 2011 at 2:05 pm #

    People who listen to music while they’re sleeping, especially at times when they

    Reply
  16. Nick January 5, 2012 at 2:20 am #

    Neither tricks really work anymore. Dan V’s solution to trick 1 works. The code for trick 2 has had the character encoding all changed by this site, so you need to sort that out first (> should be a greater than symbol, for example). The widget is created, but doesn’t appear correctly. All I can see is “– posted in ” inside the widget… I don’t think it’s supposed to look like that.

    Reply
    • February 5, 2012 at 8:01 am #

      Hi, this is a cnmoemt.To delete a cnmoemt, just log in and view the post's cnmoemts. There you will have the option to edit or delete them.

      Reply
      • June 1, 2012 at 5:47 am #

        Code needs to be updated for newer veorsin of buddypress and wordpress. Try a veorsin of this:bp_options_nav[$bp->groups->current_group->slug]['home']['slug'] ) === false ) { if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == public’) { bp_core_redirect( $path . forum/’ ); } }}function move_group_activity_tab() { global $bp; if (isset($bp->groups->current_group->slug) && $bp->groups->current_group->slug == $bp->current_item) { $bp->bp_options_nav[$bp->groups->current_group->slug]['home']['position'] = ’98 ; $bp->bp_options_nav[$bp->groups->current_group->slug]['home']['name'] = Something’; }}add_action( bp_init’, redirect_group_home’ );add_action( bp_init’, move_group_activity_tab’);?>

        Reply
  17. Nick January 5, 2012 at 2:21 am #

    where I wrote > I meant “& gt ;” (all together). This site’s character filtering shizzle again.

    Reply
  18. Leland February 27, 2012 at 4:59 pm #

    Trick 1 does not work if utilizing the BP Groups Hierarchy plugin. Any ideas on how to just look at the group slug to see if it is “home” since subgroups have “home” slugs as well.

    Reply

Leave a Reply