Skip to:
Content

BuddyPress.org

Changeset 854 for trunk/bp-groups.php


Ignore:
Timestamp:
01/16/2009 09:00:46 PM (16 years ago)
Author:
apeatling
Message:

Added filters to all activity and notification formatting functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups.php

    r849 r854  
    866866            if ( !$group )
    867867                return false;
     868               
     869            $user_link = bp_core_get_userlink($user_id);
     870            $group_link = bp_group_permalink( $group, false );
    868871           
    869872            return array(
    870873                'primary_link' => bp_group_permalink( $group, false ),
    871                 'content' => sprintf( __('%s joined the group %s', 'buddypress'), bp_core_get_userlink($user_id),  '<a href="' . bp_group_permalink( $group, false ) . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>'
     874                'content' => apply_filters( 'bp_groups_joined_group_activity', sprintf( __('%s joined the group %s', 'buddypress'), $user_link,  '<a href="' . $group_link . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>', $user_link, $group_link, $group->name )
    872875            );             
    873876        break;
     
    878881                return false;
    879882           
     883            $user_link = bp_core_get_userlink($user_id);
     884            $group_link = bp_group_permalink( $group, false );
     885           
    880886            return array(
    881887                'primary_link' => bp_group_permalink( $group, false ),
    882                 'content' => sprintf( __('%s created the group %s', 'buddypress'), bp_core_get_userlink($user_id), '<a href="' . bp_group_permalink( $group, false ) . '">' . $group->name . '</a>') . ' <span class="time-since">%s</span>'
     888                'content' => apply_filters( 'bp_groups_created_group_activity', sprintf( __('%s created the group %s', 'buddypress'), $user_link, '<a href="' . $group_link . '">' . $group->name . '</a>') . ' <span class="time-since">%s</span>', $user_link, $group_link, $group->name )
    883889            );
    884890        break;
     
    889895            if ( !$group || !$wire_post || !$wire_post->content )
    890896                return false;       
     897
     898            $user_link = bp_core_get_userlink($user_id);
     899            $group_link = bp_group_permalink( $group, false );
     900            $post_excerpt = bp_create_excerpt($wire_post->content);
    891901                   
    892             $content = sprintf ( __('%s wrote on the wire of the group %s', 'buddypress'), bp_core_get_userlink($user_id), '<a href="' . bp_group_permalink( $group, false ) . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>';         
    893             $content .= '<blockquote>' . bp_create_excerpt($wire_post->content) . '</blockquote>';
     902            $content = sprintf ( __('%s wrote on the wire of the group %s', 'buddypress'), $user_link, '<a href="' . $group_link . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>';         
     903            $content .= '<blockquote>' . $post_excerpt . '</blockquote>';
     904           
     905            $content = apply_filters( 'bp_groups_new_wire_post_activity', $content, $user_link, $group_link, $group->name, $post_excerpt );
    894906           
    895907            return array(
     
    907919                    return false;       
    908920
    909                 $content = sprintf ( __('%s posted on the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink($user_id), '<a href="' . bp_group_permalink( $group, false ) . '/forum/topic/' . $forum_topic['topic_id'] . '">' . $forum_topic['topic_title'] . '</a>', '<a href="' . bp_group_permalink( $group, false ) . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>';           
    910                 $content .= '<blockquote>' . apply_filters( 'bp_the_topic_post_content', stripslashes( $forum_post['post_text'] ) ) . '</blockquote>';
     921                $user_link = bp_core_get_userlink($user_id);
     922                $group_link = bp_group_permalink( $group, false );
     923               
     924                $post_content = apply_filters( 'bp_the_topic_post_content', stripslashes( $forum_post['post_text'] ) );
     925           
     926                $content = sprintf ( __('%s posted on the forum topic %s in the group %s:', 'buddypress'), $user_link, '<a href="' . $group_link . '/forum/topic/' . $forum_topic['topic_id'] . '">' . $forum_topic['topic_title'] . '</a>', '<a href="' . $group_link . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>';           
     927                $content .= '<blockquote>' . $post_content . '</blockquote>';
     928               
     929                $content = apply_filters( 'bp_groups_new_forum_post_activity', $content, $user_link, $group_link, $forum_topic['topic_id'], $forum_topic['topic_title'], $group_link, $group->name, $post_content );
    911930
    912931                return array(
     
    923942
    924943                if ( !$group || !$forum_post || !$forum_topic )
    925                     return false;       
    926 
    927                 $content = sprintf ( __('%s created the forum topic %s in the group %s:', 'buddypress'), bp_core_get_userlink($user_id), '<a href="' . bp_group_permalink( $group, false ) . '/forum/topic/' . $forum_topic['topic_id'] . '">' . $forum_topic['topic_title'] . '</a>', '<a href="' . bp_group_permalink( $group, false ) . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>';         
    928                 $content .= '<blockquote>' . apply_filters( 'bp_the_topic_post_content', stripslashes( $forum_post['post_text'] ) ) . '</blockquote>';
     944                    return false;
     945                   
     946                $user_link = bp_core_get_userlink($user_id);
     947                $group_link = bp_group_permalink( $group, false );
     948               
     949                $post_content = apply_filters( 'bp_the_topic_post_content', stripslashes( $forum_post['post_text'] ) );
     950               
     951                $content = sprintf ( __('%s created the forum topic %s in the group %s:', 'buddypress'), $uesr_link, '<a href="' . $group_link . '/forum/topic/' . $forum_topic['topic_id'] . '">' . $forum_topic['topic_title'] . '</a>', '<a href="' . $group_link . '">' . $group->name . '</a>' ) . ' <span class="time-since">%s</span>';         
     952                $content .= '<blockquote>' . $post_content . '</blockquote>';
     953               
     954                $content = apply_filters( 'bp_groups_new_forum_topic_activity', $content, $user_link, $group_link, $forum_topic['topic_id'], $forum_topic['topic_title'], $group_link, $group->name, $post_content );
    929955
    930956                return array(
     
    949975            $group = new BP_Groups_Group( $group_id, false, false );
    950976           
     977            $group_link = bp_group_permalink( $group, false );
     978           
    951979            if ( (int)$total_items > 1 ) {
    952                 return '<a href="' . bp_group_permalink( $group, false ) . '/admin/membership-requests/" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . sprintf( __('%d new membership requests for the group "%s"'), (int)$total_items, $group->name ) . '</a>';     
     980                return apply_filters( 'bp_groups_multiple_new_membership_requests_notification', '<a href="' . $group_link . '/admin/membership-requests/" title="' . __( 'Group Membership Requests', 'buddypress' ) . '">' . sprintf( __('%d new membership requests for the group "%s"'), (int)$total_items, $group->name ) . '</a>', $group_link, $total_items, $group->name );     
    953981            } else {
    954982                $user_fullname = bp_core_global_user_fullname( $requesting_user_id );
    955                 return '<a href="' . bp_group_permalink( $group, false ) . '/admin/membership-requests/" title="' . $user_fullname .' requests group membership">' . sprintf( __('%s requests membership for the group "%s"'), $user_fullname, $group->name ) . '</a>';
     983                return apply_filters( 'bp_groups_single_new_membership_request_notification', '<a href="' . $group_link . '/admin/membership-requests/" title="' . $user_fullname .' requests group membership">' . sprintf( __('%s requests membership for the group "%s"'), $user_fullname, $group->name ) . '</a>', $group_link, $user_fullname, $group->name );
    956984            }   
    957985        break;
     
    961989           
    962990            $group = new BP_Groups_Group( $group_id, false, false );
     991            $group_link = bp_group_permalink( $group, false )  . '/?new';
    963992           
    964993            if ( (int)$total_items > 1 ) {
    965                 return '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d accepted group membership requests'), (int)$total_items, $group->name ) . '</a>';     
     994                return apply_filters( 'bp_groups_multiple_membership_request_accepted_notification', '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d accepted group membership requests'), (int)$total_items, $group->name ) . '</a>', $total_items, $group_name );     
    966995            } else {
    967                 return '<a href="' . bp_group_permalink( $group, false ) . '/?new">' . sprintf( __('Membership for group "%s" accepted'), $group->name ) . '</a>';
     996                return apply_filters( 'bp_groups_single_membership_request_accepted_notification', '<a href="' . $group_link . '">' . sprintf( __('Membership for group "%s" accepted'), $group->name ) . '</a>', $group_link, $group->name );
    968997            }   
    969998        break;
     
    9731002           
    9741003            $group = new BP_Groups_Group( $group_id, false, false );
     1004            $group_link = bp_group_permalink( $group, false )  . '/?new';
    9751005           
    9761006            if ( (int)$total_items > 1 ) {
    977                 return '<a href="' . site_url() . '/' . MEMBERS_SLUG . '/' . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d rejected group membership requests'), (int)$total_items, $group->name ) . '</a>';     
     1007                return apply_filters( 'bp_groups_multiple_membership_request_rejected_notification', '<a href="' . site_url() . '/' . MEMBERS_SLUG . '/' . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('%d rejected group membership requests'), (int)$total_items, $group->name ) . '</a>', $total_items, $group->name );     
    9781008            } else {
    979                 return '<a href="' . bp_group_permalink( $group, false ) . '/?new">' . sprintf( __('Membership for group "%s" rejected'), $group->name ) . '</a>';
     1009                return apply_filters( 'bp_groups_single_membership_request_rejected_notification', '<a href="' . $group_link . '">' . sprintf( __('Membership for group "%s" rejected'), $group->name ) . '</a>', $group_link, $group->name );
    9801010            }   
    9811011       
     
    9861016       
    9871017            $group = new BP_Groups_Group( $group_id, false, false );
    988 
     1018            $group_link = bp_group_permalink( $group, false )  . '/?new';
     1019           
    9891020            if ( (int)$total_items > 1 ) {
    990                 return '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to an admin in %d groups'), (int)$total_items ) . '</a>';     
     1021                return apply_filters( 'bp_groups_multiple_member_promoted_to_admin_notification', '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to an admin in %d groups'), (int)$total_items ) . '</a>', $total_items );       
    9911022            } else {
    992                 return '<a href="' . bp_group_permalink( $group, false ) . '/?new">' . sprintf( __('You were promoted to an admin in the group %s'), $group->name ) . '</a>';
     1023                return apply_filters( 'bp_groups_single_member_promoted_to_admin_notification', '<a href="' . $group_link . '">' . sprintf( __('You were promoted to an admin in the group %s'), $group->name ) . '</a>', $group_link, $group->name );
    9931024            }   
    9941025        break;
     
    9981029   
    9991030            $group = new BP_Groups_Group( $group_id, false, false );
    1000 
     1031            $group_link = bp_group_permalink( $group, false )  . '/?new';
     1032           
    10011033            if ( (int)$total_items > 1 ) {
    1002                 return '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to a mod in %d groups'), (int)$total_items ) . '</a>';     
     1034                return apply_filters( 'bp_groups_multiple_member_promoted_to_mod_notification', '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '" title="' . __( 'Groups', 'buddypress' ) . '">' . sprintf( __('You were promoted to a mod in %d groups'), (int)$total_items ) . '</a>', $total_items );       
    10031035            } else {
    1004                 return '<a href="' . bp_group_permalink( $group, false ) . '/?new">' . sprintf( __('You were promoted to a mod in the group %s'), $group->name ) . '</a>';
     1036                return apply_filters( 'bp_groups_single_member_promoted_to_mod_notification', '<a href="' . $group_link . '">' . sprintf( __('You were promoted to a mod in the group %s'), $group->name ) . '</a>', $group_link, $group->name );
    10051037            }   
    10061038        break;
     
    10131045           
    10141046            if ( (int)$total_items > 1 ) {
    1015                 return '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have %d new group invitations'), (int)$total_items ) . '</a>';       
     1047                return apply_filters( 'bp_groups_multiple_group_invite_notification', '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have %d new group invitations'), (int)$total_items ) . '</a>', $total_items );     
    10161048            } else {
    1017                 return '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have an invitation to the group: %s'), $group->name ) . '</a>';
     1049                return apply_filters( 'bp_groups_single_group_invite_notification', '<a href="' . $bp['loggedin_domain'] . $bp['groups']['slug'] . '/invites" title="' . __( 'Group Invites', 'buddypress' ) . '">' . sprintf( __('You have an invitation to the group: %s'), $group->name ) . '</a>', $group->name );
    10181050            }   
    10191051        break;
Note: See TracChangeset for help on using the changeset viewer.