bp_ps_update_meta( $form,  $post )

Update BuddyBoss Profile Search post meta

Description

Source

File: bp-core/profile-search/bps-admin.php

function bp_ps_update_meta ($form, $post) {
	if ($post->post_type != 'bp_ps_form' || $post->post_status != 'publish')  return false;
	if (empty ($_POST['options']) && empty ($_POST['bp_ps_options']))  return false;

	$old_meta = bp_ps_meta ($form);

	$meta = array ();
	$meta['field_code'] = array ();
	$meta['field_label'] = array ();
	$meta['field_desc'] = array ();
	$meta['field_mode'] = array ();

	list ($x, $fields) = bp_ps_get_fields();

	$codes = array ();
	$posted = isset ($_POST['bp_ps_options'])? $_POST['bp_ps_options']: array ();
	if (isset ($posted['field_name']))  foreach ($posted['field_name'] as $k => $code)
	{
		if (empty ($fields[$code]))  continue;
		if (in_array ($code, $codes))  continue;

		$codes[] = $code;
		$meta['field_code'][] = $code;
		$meta['field_label'][] = isset ($posted['field_label'][$k])? stripslashes ($posted['field_label'][$k]): '';
		$meta['field_desc'][] = isset ($posted['field_desc'][$k])? stripslashes ($posted['field_desc'][$k]): '';
		$meta['field_mode'][] = bp_ps_Fields::valid_filter ($fields[$code], isset ($posted['field_mode'][$k])? $posted['field_mode'][$k]: 'none');

	}

	update_post_meta ($form, 'bp_ps_options', $meta);

	return true;
}

Changelog

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