Created
May 28, 2019 07:25
-
-
Save KaineLabs/9824d76fb9d44f6549af0ac0b39521b9 to your computer and use it in GitHub Desktop.
Add "In Group x" for Groups Sub Forums Posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add "In Group x" for Groups Sub Forums Posts | |
**/ | |
function yzc_add_in_group_for_groups_sub_forums_posts( $activity_text, $user_id, $topic_id, $forum_id ) { | |
// Get Parent Forum | |
$parent_forum_id = bbp_get_forum_parent_id( $forum_id ); | |
if ( empty( $parent_forum_id ) ) { | |
return $activity_text; | |
} | |
// Get Parent Forum Data. | |
$forum_permalink = bbp_get_forum_permalink( $parent_forum_id ); | |
$forum_title = get_post_field( 'post_title', $parent_forum_id, 'raw' ); | |
$forum_link = '<a href="' . $forum_permalink . '">' . $forum_title . '</a>'; | |
// Edit Action Text. | |
$activity_text .= ' in the group ' . $forum_link; | |
return $activity_text; | |
} | |
add_filter( 'bbp_activity_topic_create', 'yzc_add_in_group_for_groups_sub_forums_posts', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment