WPUM_UPDATEDESCRIPTION::wpum_description_update( $obj,  $values,  $updated_id )


Parameters Parameters

$obj

(Required)

$values

(Required)

$updated_id

(Required)


Source Source

File: src/integrations/wp-user-manager/triggers/wpum-updatedescription.php

	public function wpum_description_update( $obj, $values, $updated_id ) {


		if ( 0 === absint( $updated_id ) ) {
			// Its a logged in recipe and
			// user ID is 0. Skip process
			return;
		}

		$user_data = get_userdata( $updated_id );

		if ( isset( $values['account']['user_description'] ) && $values['account']['user_description'] == $user_data->description ) {
			return;
		}

		$pass_args = [
			'code'           => $this->trigger_code,
			'meta'           => $this->trigger_meta,
			'user_id'        => $updated_id,
			'ignore_post_id' => true,
		];

		$args = Automator()->maybe_add_trigger_entry( $pass_args, false );

		if ( $args ) {
			foreach ( $args as $result ) {
				if ( true === $result['result'] ) {
					$trigger_meta = [
						'user_id'        => $updated_id,
						'trigger_id'     => $result['args']['trigger_id'],
						'trigger_log_id' => $result['args']['get_trigger_id'],
						'run_number'     => $result['args']['run_number'],
					];

					foreach ( $values['account'] as $key => $value ) {
						$trigger_meta['meta_key']   = $key;
						$trigger_meta['meta_value'] = maybe_serialize( $value );
						Automator()->insert_trigger_meta( $trigger_meta );
					}

					Automator()->maybe_trigger_complete( $result['args'] );
				}
			}
		}
	}