Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of hnla

Support: Creating & Extending

Existing and new plugins/components and themes.

Show: By Latest Post | By Group (17 posts)

Started 1 year, 5 months ago by: LPH2005

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    OK. What’s the trick? ;)

    This site now shows:
    Show: By Latest Post | By Group

    I’d love my site’s tutoring page (http://www.thechembook.com/tutoring/) to show the latest posts organized by group. How was this done?

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    Sorry – this should have gone into the “How-To” Group … might want to move it …

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    A search doesn’t bring up an answer – anyone know how to find this code?

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    It’s great to see this site active – but (smile) – is the theme developer online these days to answer this question? I’d love for the forum topic list to be sorted into groups ….

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    Is this code anywhere? I can’t believe I’m the only one interested in this code – it makes so much sense – to be able to sort the latest topics into groups …

    Sigh.

  • Profile picture of @mercime @mercime said 1 year, 5 months ago:

    @LPH2005 – I haven’t seen code released to public, but seen it done by:
    @apeatling for http://buddypress.org/support/topics/grouped/
    @deanjrobinson for http://help.deanjrobinson.com/ notice that his groups are categorized as well.
    Per Dean – “a custom forum loop inside a custom groups loop.”

  • Profile picture of modemlooper modemlooper said 1 year, 5 months ago:

    Couldn’t you create your own loop that calls the groups forums that you want. Then repeat it a few times for each group forum you want to list?

    if ( bp_has_groups( ‘slug=GroupName’) ) :
    locate_template( array( ‘forums/forums-loop.php’ ), true )
    endif;

    Or what about the forum extra’s plugin? http://wordpress.org/extend/plugins/buddypress-group-forum-extras/

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    Now we are talking! Thank you both for information.

    Yes, I’ve seen the /grouped and that is why I asked about it. It’s the way the forum topics need to be shown on my site.

    Oooo … @deanjrobinson has done a SWEET job on http://help.deanjrobinson.com/

    Now – if only someone would share what they’ve done! It looks like Dean planned on a theme – but plans can always get off to a slow start :)

    @Modemlooper – well – I have the forum extra’s plugin and that gives an index. But the preference is to have the group shown with the latest topics below them (pagination necessary).

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    @Modemlooper

    I’ve been looking at your code and can’t seem to get the GroupName slug to match up with anything. Is the GroupName the URL? Or is it something else?

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    Tried to modify /forum/index.php and insert slug=GroupName if statement and all of the topics are returned … so either the slug name is incorrect or the code … or the placement of the code … or … just too many options here.

    Guess this means BP devs should consider a better way to do this when bbpress becomes its own plugin acting in concert with BP (4th quarter of this year or so). This should just simply be an option.

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    UGH. I’m getting so irritated that it’s time to leave the computer. There must be a way to get my site to work like http://buddypress.org/support/topics/grouped/. It seems such a simple request. I can’t believe it isn’t an option or obvious. Nothing I’ve tried seems to work.

    Time for a break. Maybe someone with knowledge will take pity here and help.

  • Profile picture of Boone Gorges Boone Gorges said 1 year, 5 months ago:

    Here’s the short version.

    In [theme]/forums/index.php, do a conditional check for $bp->current_action == ‘grouped’. (Depending on the URL structure of your site, you might have to use $bp->action_variables[0].) In other words, the ‘grouped’ code should only be displayed if ( $bp->current_action == ‘grouped’ ).

    Then do a bp_has_groups loop for all the groups you want to appear. If that’s all your groups, you can just do bp_has_groups(). If you only want to do a certain number of groups, like on this site, do bp_has_groups( ‘include=4,5,6′ ) where 4, 5, 6 are groups that you want to include in the ‘grouped’ view.

    Then, inside the while ( bp_groups() ) : bp_the_group() loop, do a normal forums loop. Something like
    if ( bp_has_forum_topics( 'forum_id=' . groups_get_groupmeta( bp_get_group_id(), 'forum_id' ) ) )
    plus whatever arguments for max number, etc you want.

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    I’m back: fed and rested.

    Thank you Boone for helping. I’m only looking for topics shown as sorted by group … So, let me repeat some of this back and see if my understanding was your intent.

    First, [theme]/forums/index.php is the file to edit.

    Second, if I only want topics sorted within groups then I can create a bp_has_groups() that includes the while statements you suggest.

    Third, thank you (again!) for the short version. I’ll see what I can do to try to figure this out.

    In the meantime, if someone already has code to share then please feel free to post.

  • Profile picture of LPH2005 LPH2005 said 1 year, 5 months ago:

    Yippeee ! LOL

    OK. All emotion aside – I’m almost there! http://www.thechembook.com/tutoring/

    There needs to be some ways to limit the number of topics shown.

    Boone, I almost did what you suggested but decided to copy the table code from the /forum-loop.php directly into the index.php file rather than calling the forum-loop.

    Also, the code for limiting to only certain groups isn’t working for me. I must be doing something wrong there.

    Here is what is online right now (and almost works!)

    http://pastebin.com/BMfzexrz

  • Profile picture of Boone Gorges Boone Gorges said 1 year, 5 months ago:

    I told you to use include= but I realized that you can’t pass multiple groups into bp_has_groups() in the 1.2 branch. My bad.

    So you might want to try @modemlooper‘s advice. The group slug is whatever shows up in the URL as the group name. For example, a group with URL http://example.com/groups/i-am-awesome has the slug i-am-awesome. You should be able to get that group only by using the following:
    if ( bp_has_groups( 'slug=i-am-awesome' ) )
    Then, as Modemlooper says, you’d have to do it a couple times for each group. Or better yet, make an array and loop over it:

    $groups_to_show = array( 'i-am-awesome', 'i-am-cool', 'bodacious' );
    foreach ( $groups_to_show as $g ) {
        if ( bp_has_groups( 'slug=' . $g ) ) {
            // do all your group-specific stuff here
        }
    }