Skip to:

Redirecting notifications to respective groups/chats not on activity page

  • pratibhasvaksha


    I want to redirect the notifications to respective groups/messages but not on activity page.

    This is the html generating on notification page. As you can see the URL is redirecting to activity page.

    <td class="notification-description"> <a href="siteurl/activity/p/349/" title="Courtney joined the group Indonesia, Bali">Courtney joined the group Indonesia, Bali</a> </td>

    And this is the function which is executing:

Viewing 1 replies (of 1 total)

  • Venutius


    I think what you are asking for is that group activity should not be posted to the activity page.

    group activities for public groups are automatically shown site-wide by default and I can’t see anyway to change this. The only option I could come up with, which is far from ideal is to delete the activity that is set sitewide and add it again with the setting change to hide sitewide:

    add_action( 'bp_activity_add', 'bpex_hide_group_activity' );
    function bpex_hide_group_activity( $r, $activity_id ) {
    	if ( $r['component'] == buddypress()->groups->id ) {
    		$group = groups_get_group( $r['item_id'] );
           		if ( isset( $group->status ) && 'public' == $group->status ) {
                         bp_activity_delete( 'id' => $activity_id );
    		     $r['hide_sitewide' => true;
    		     $new_id = bp_activity_add( $r );

    It’s not really ideal as any notifications that get sent based on the first activity will result in a not found error when clicked so you will probably want to improve the logic used to filter our specific activities and not all group activities as I’ve done here.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar