bp_avatar_use_webcam()

Checks whether the Webcam Avatar UI part should be loaded.

Description

Return

(bool) True to load the Webcam Avatar UI part. False otherwise.

Source

File: bp-core/bp-core-avatars.php

function bp_avatar_use_webcam() {
	global $is_safari, $is_IE, $is_chrome;

	/**
	 * Do not use the webcam feature for mobile devices
	 * to avoid possible confusions.
	 */
	if ( wp_is_mobile() ) {
		return false;
	}

	/**
	 * Bail when the browser does not support getUserMedia.
	 *
	 * @see http://caniuse.com/#feat=stream
	 */
	if ( $is_safari || $is_IE || ( $is_chrome && ! is_ssl() ) ) {
		return false;
	}

	/**
	 * Use this filter if you need to disable the webcam capture feature
	 * by returning false.
	 *
	 * @since BuddyPress 2.3.0
	 *
	 * @param bool $value Whether or not to load Webcam Avatar UI part.
	 */
	return apply_filters( 'bp_avatar_use_webcam', true );
}

Changelog

Changelog
Version Description
BuddyPress 2.3.0 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.