bp_xprofile_grant_bp_xprofile_change_field_visibility_for_logged_out_users( bool $user_can, int $user_id, string $capability )

Grant the ‘bp_xprofile_change_field_visibility’ cap to logged-out users.

Description

Parameters

$user_can

(bool) (Required)

$user_id

(int) (Required)

$capability

(string) (Required)

Return

(bool)

Source

File: bp-xprofile/bp-xprofile-caps.php

function bp_xprofile_grant_bp_xprofile_change_field_visibility_for_logged_out_users( $user_can, $user_id, $capability ) {
	if ( 'bp_xprofile_change_field_visibility' === $capability && 0 === $user_id ) {
		$field_id = bp_get_the_profile_field_id();
		if ( $field_id && $field = xprofile_get_field( $field_id ) ) {
			$user_can = 'allowed' === $field->allow_custom_visibility;
		}
	}

	return $user_can;
}

Changelog

Changelog
Version Description
BuddyPress 2.7.1 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.