将过滤器应用于buddressress功能

时间:2014-02-12 21:59:42

标签: php wordpress buddypress

我想使用一些单独的代码来修改此函数的输出,这些代码可以存在于theme文件夹中的functions.php中。谢谢!

function bp_group_status_message( $group = null ) {
global $groups_template;

if ( ! $group )
    $group =& $groups_template->group;

if ( 'private' == $group->status ) {
    if ( ! bp_group_has_requested_membership() ) {
        if ( is_user_logged_in() )
            $message = __( 'This is a private group and you must request group membership in order to join.', 'buddypress' );
        else
            $message = __( 'This is a private group. To join you must be a registered site member and request group membership.', 'buddypress' );

    } else {
        $message = __( 'This is a private group. Your membership request is awaiting approval from the group administrator.', 'buddypress' );
    }

} else {
    $message = __( 'This is a hidden group and only invited members can join.', 'buddypress' );
}

echo apply_filters( 'bp_group_status_message', $message, $group );

}

1 个答案:

答案 0 :(得分:1)

这是基本结构:

function new_group_status_message( $message, $group ) {
  $message = 'new message'; 
  return $message; 
}
add_filter('bp_group_status_message', 'new_group_status_message', 1, 2 );