Project

General

Profile

Feature #14817

Embed a Commons Group forum to a Site page

Added by scott voth 26 days ago. Updated 11 days ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
Group Forums
Target version:
Start date:
2021-09-27
Due date:
% Done:

0%

Estimated time:

Description

Ann Del Principe from Kingsborough would like to display her group forum on a page of her group site. Is it possible to create a custom iframe shortcode for this? Or another solution?

group-forum shortcode.jpg (177 KB) group-forum shortcode.jpg Raymond Hoh, 2021-10-01 07:39 PM

History

#1 Updated by Raymond Hoh 26 days ago

Provided that the group is public, it's possible to use the RSS feed for a group. For example, https://commons.gc.cuny.edu/groups/cuny-pie/feed/. However, this includes all group activity.

Then if you're using the Block Editor, you can use the RSS block to add the RSS URL to display the feed that way.

If we wanted to limit the group RSS feed to be more granular for forum posts, we will need to write some custom code so the feed URL could be customized. Shouldn't take too much code. If we're interested in this direction, let me know.

#2 Updated by Raymond Hoh 26 days ago

  • Assignee set to Raymond Hoh

Scott,

After the maintenance release tomorrow (September 28th), you'll be able to use the following RSS feeds to grab the group forum activity:

  1. Group activity RSS URL, powered by BuddyPress and filtered by forum activity: https://commons.gc.cuny.edu/groups/cuny-pie/feed/?type=bbp_topic_create,bbp_reply_create
  2. Group forum RSS URL, powered by bbPress: https://commons.gc.cuny.edu/forums/forum/cuny-pie/feed/

Change cuny-pie to the group's slug. The group must be public as well. Combine this with the Block Editor's RSS block as mentioned above and Ann should be good to go.

If Ann isn't using the Block Editor, it looks like we have two RSS embedding plugins -- RSSImport and RSS Multi Importer -- that could work, however they're both a little old and will need some testing.

If that isn't enough, let us know.

(Code reference: https://github.com/cuny-academic-commons/cac/commit/2507b0faaf79c05f10658444e9aa596ae2772507, https://github.com/cuny-academic-commons/cac/commit/cc034672c199a87d9231e9e16796eeae66e0c0cf)

#3 Updated by scott voth 25 days ago

Thanks Ray! Just to clarify, using this solution would only display the forum. It would not allow posting replies, right?

#4 Updated by scott voth 25 days ago

I heard back from Ann - Since she is using the forum for a class, she needs it to be private. Is that possible?

#5 Updated by Raymond Hoh 24 days ago

Hi Scott,

Unfortunately, the RSS solution I posted above would only work if the group is public due to privacy issues.


Boone, I just remembered that I have some prior art in our BP Event Organiser plugin to embed a group calendar using a minimal version of the page. For example, https://commons.gc.cuny.edu/groups/cuny-pie/events/?embedded=true.

We can accomplish something similar for our group forums. Then Ann can embed the forum using a shortcode like [group-forum slug="cuny-pie"], which would call on the iframe.

I've actually put something together locally and it works quite well. Code isn't large; it's about 60 lines of code plus a custom template file (still need to write the shortcode).

Just so there isn't two entry points, if you're viewing the embedded forum, I've made it so it's basically read-only. The new topic post form is removed and clicking on a topic link will load the full version of the page and not in the iframe. If the group is private, we'll have to do some membership checks before rendering the iframe in the shortcode.

If you want me to move forward with this idea, I can put something up on cdev for testing.

#6 Updated by Boone Gorges 23 days ago

  • Target version set to 1.19.0

Cool, Ray. If you can do this pretty easily, and make it read-only, then I'd say let's go for it. I'll put into the 1.19.0 milestone for now.

#7 Updated by Raymond Hoh 22 days ago

I've got a first pass of this ready on cdev.

To test, use the following shortcode in a post or page:

[group-forum slug="xxx" height="800"]

xxx is the group slug. For example in the group URL, https://commons.gc.cuny.edu/groups/digital-humanities-initiative/. "digital-humanities-initiative" is the group slug. height is optional and defaults to 600.

If the group is public, the forum is embedded.

If the group is not public:

  • When logged out, you will see the following message: "To view this group forum, please login and ensure you are a member of the group."
  • When logged in, but not a member of the group, you will see the following message if the group is private: "You do not have access to view this group forum. You can request membership to the group here." If the group is hidden, you will see the following message: "You do not have access to view this group forum. Please contact the site administrator to request access to the group."

An example can be found on cdev here: https://raytest.commons.gc.cuny.edu/sample-page/

For those that cannot access cdev, I've attached a logged-out screenshot embedding two group forums on a page: One from a public group and one from a private group: https://redmine.gc.cuny.edu/attachments/19812/group-forum%20shortcode.jpg.

#8 Updated by Boone Gorges 19 days ago

Wow, this is really slick, Ray.

#9 Updated by Raymond Hoh 16 days ago

  • Status changed from New to Staged for Production Release
  • Target version changed from 1.19.0 to 1.18.20

I've committed the code here: https://github.com/cuny-academic-commons/cac/commit/d8ebd28bf5163f5f4b151823a61380258af6f38f.


Scott,

After the next maintenance release on the 12th, Ann should be able to use the [group-forum] shortcode and the group forum should display under the circumstances I explained here.

We should also document this on the Help site somewhere, but can wait until later to do this.

#10 Updated by scott voth 12 days ago

Thanks Ray. I have added documentation here - https://help.commons.gc.cuny.edu/embed-a-group-forum-on-a-site-page/

#11 Updated by Raymond Hoh 12 days ago

Thanks Scott for creating the documentation page for the shortcode!

#12 Updated by Boone Gorges 11 days ago

  • Status changed from Staged for Production Release to Resolved

Also available in: Atom PDF