更简单的解决方案:
function get_relationship($group_id,$user_id) {
global $wpdb;
$relationships = $wpdb->get_col("SELECT relationship FROM wp_bp_groups_members WHERE group_id = $group_id AND user_id = $user_id");
if ( !empty( $relationships ) ) {
foreach ( $relationships as $relationship ) {
return $relationship;
}
}
}
它应该进入插件/bp自定义。php或您的主题/函数。php。不是bp组模板。php,这是一个核心文件,不应该被黑客攻击。