bp_nouveau_ajax_save_cover_position()

Save Cover image position for group and member.

Description

Source

File: bp-templates/bp-nouveau/includes/ajax.php

function bp_nouveau_ajax_save_cover_position() {

	if ( ! bp_is_post_request() ) {
		wp_send_json_error();
	}

	if ( ! isset( $_POST['position'] ) ) {
		wp_send_json_error();
	}

	$position = floatval( $_POST['position'] );
	$updated  = false;

	if ( bp_is_active( 'groups' ) && bp_is_group() ) {
		$updated = groups_update_groupmeta( bp_get_current_group_id(), 'bp_cover_position', $position );
	} else if ( bp_is_user() ) {
		$updated = bp_update_user_meta( bp_displayed_user_id(), 'bp_cover_position', $position );
	}

	if ( empty( $updated ) ) {
		wp_send_json_error();
	}

	$result['content'] = $position;

	wp_send_json_success( $result );
}

Changelog

Changelog
Version Description
BuddyBoss 1.5.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.