Hi Brajesh, I’m trying to improve the usefulness of the group home page, what I would like to do is create a composite page, which shows summaries of the content of other pages, as well as the group activity feed.
As an example, and as a first step, what I would like to do is change the display of the group home page so that (if a forum exists) first the latest ten group forum topics are displayed, followed by the standard activity stream.
I have tried playing with activity.php, by including the content of forum.php but this does not work. Have you got any suggestions as to how I might accomplish this?
My ultimate aim is to have a group home page that provides summary information for all the groups activity items. So for example, I would like the group landing page to show an extended description of the group with images and embeded videos, the 10 latest forum topics, the last five group blog post links, possibly a slider of any images loaded to the group gallery.
I’m used to social networking software created by Ning and this is exactly what they do, the aim is to bring the whole of the group to the user with one click of the group avatar, instead of expecting users to browse through the various group pages.
Some of these items I think should be implemented as sidebar widgets, for example that slider of the latest images uploaded to the group gallery would be a good candidate for that. Others I think should be doable as code snippets in the activity.php file though ideally these would be plugins that would allow the group administrator to choose which aspects of the group to summarise in the group home page. So fir example, the group admin would have a configurationpage as follows:
Group Homepage composition
Enable Display of the extended Group Information
Enable Summary Display of the last (X) Forum topics
Enable Summary display of the last (X) Group Posts
Enable Summary Display of the last (x) Group Docs
Enable Summmary display of the lasy (X) File uploads
Enable Group Image Slider for (x) GalleryWhat do you think? Is what I seek doable or will it take a whole lot of coding which I do not have the skills for? I know its a big project but I’m thinking if I bite it one aspect at a time, in this case trying to get the last ten forum topic listed, then I might get there.
Hi George,
Have you upgraded to BuddyPress 2.4, if yer, there are some good news.In BuddyPress 2.4 you can have custom home page for all groups by using a custom template file front.php
More details here
https://bpdevel.wordpress.com/2015/10/03/get-ready-2-4-0-will-introduce-important-changes-in-groups-homes/Once you have got front.php, It is all about including the loops.
Use
<?php bp_get_template_part( 'forums/forums-loop' ) ?> <?php bp_get_template_part( 'activity/activity-loop' ) ?>
and so on to include the latest content from these. The only concern is these loops will generate 20 items and not 10.
There is a filter on bp_ajax_querystring that we can use to limit the result to 10. But first, can you please give the above a try and see if it works for you or not?
PS: A widget for MediaPress recent photos/galleries as slider will come. I am a little bit busy with our upcoming theme next week and blog categories plugin, that’s why things seem a little slower around.
That sounds great!
However, I tried you code and it seems the forum aspect causes an error:
Fatal error: Call to undefined function bp_has_forum_topics() in /homepages/CanvaKalaTest/wp-content/themes/graphene-child/buddypress/forums/forums-loop.php on line 22
When I remove the forum part of the code from front.php, the home displays the acivity stream for the group, but without the ability to add an activity update, which I would like to include for the home page.
Hi George,
If you got the fatal error, most probably you have forums component disabled.If you haven’t installed bbPress yet, please install the bbPress plugin. After that visit BuddyPress settings and enable forums component.
After that code should work fine.To include the post form, we can just add another snippet like this
<?php if ( is_user_logged_in() && bp_group_is_member() ) : ?> <?php bp_get_template_part( 'activity/post-form' ); ?> <?php endif; ?>
And that will include the the post form. Hope that helps.
Please do let me know how it goes with you.
No that’s not it, bbPress is enabled and I can view the Forums page for that group. I had this same error when I was trying to manually combine the forum and activity PHP files, it’s because prior to running the forums script BuddyPress is running another file that sets up these variable I think.
Hi Brajesh, I’ve tried a number of ways to get the forums working and none of my efforts have succeeded. I’ve installed, activates forums and set up topics in the group forums but that code still gives me the error. I’m running this on my test server so I only have BuddyPress and bbPress active. I even tried switching to a 2015 child but I get the same error. Do you think it’s a bug?
Hi George,
I just installed bbPress on my 2.4.0 test install. Please let me check it again and get back to you.Hi George,
I had a look in details.The old forum is deprecated and that’s why you get the fatal error.
The need bbPress plugin does not provide much scope here. The only suitable way seems to be Use WP_Query or bbp_has_topics and create custom loop.
It is much more complicated but you can see it in bbpress/templates/default/loop-topics.php and see how they have mimplemented it.
Once you have that loop in place, we can pass the forum id to bbp_has_topics using bbp_get_group_forum_ids( bp_get_current_group_id() );
That will take some work to get it all working together though.
Hi George,
Thank you. I am glad we are progressing towards the result.Try looking for this line in your custom loop
bbp_has_topics ()
and we need to modify it to
$forum_ids = bbp_get_group_forum_ids( bp_get_current_group_id() ); if ( !empty( $forum_ids ) ) { $forum_id = (int) is_array( $forum_ids ) ? $forum_ids[0] : $forum_ids; } bbp_has_topics ( array( 'post_parent' => $forum_id ) );
That will fetch the topics for relevant groups.
You will also need to check if the forum_id is empty then to avoid showing the loop.
Hope that helps.
You must be logged in to reply to this topic.