create_user(); $old_current_user = bp_loggedin_user_id(); $this->set_current_user( 0 ); $this->assertEquals( array( 'friends', 'loggedin', 'adminsonly' ), bp_xprofile_get_hidden_field_types_for_user( $duser, bp_loggedin_user_id() ) ); $this->set_current_user( $old_current_user ); } public function test_get_hidden_field_types_for_user_loggedin() { $duser = $this->create_user(); $cuser = $this->create_user(); $old_current_user = bp_loggedin_user_id(); $this->set_current_user( $cuser ); $this->assertEquals( array( 'friends', 'adminsonly' ), bp_xprofile_get_hidden_field_types_for_user( $duser, bp_loggedin_user_id() ) ); $this->set_current_user( $old_current_user ); } public function test_get_hidden_field_types_for_user_friends() { $duser = $this->create_user(); $cuser = $this->create_user(); friends_add_friend( $duser, $cuser, true ); $old_current_user = bp_loggedin_user_id(); $this->set_current_user( $cuser ); $this->assertEquals( array( 'adminsonly' ), bp_xprofile_get_hidden_field_types_for_user( $duser, bp_loggedin_user_id() ) ); $this->set_current_user( $old_current_user ); } public function test_get_hidden_field_types_for_user_admin() { $duser = $this->create_user(); $cuser = $this->create_user(); $this->grant_bp_moderate( $cuser ); $old_current_user = bp_loggedin_user_id(); $this->set_current_user( $cuser ); $this->assertEquals( array(), bp_xprofile_get_hidden_field_types_for_user( $duser, bp_loggedin_user_id() ) ); $this->revoke_bp_moderate( $cuser ); $this->set_current_user( $old_current_user ); } /** * @group bp_xprofile_update_meta * @ticket BP5180 */ public function test_bp_xprofile_update_meta_with_line_breaks() { $g = $this->factory->xprofile_group->create(); $f = $this->factory->xprofile_field->create( array( 'field_group_id' => $g->id, 'type' => 'textbox', ) ); $meta_value = 'Foo! Bar!'; bp_xprofile_update_meta( $f->id, 'field', 'linebreak_field', $meta_value ); $this->assertEquals( $meta_value, bp_xprofile_get_meta( $f->id, 'field', 'linebreak_field' ) ); } }