2014-02-12 128 views
0

我想修改這個函數的輸出,使用一個單獨的代碼位於主題文件夾的functions.php中。謝謝!將過濾器應用於buddypress函數

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

這是基本的結構:

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

非常感謝,shanebp。 – user3303708