LLMS_Person::get_user_postmeta_data( $user_id,  $post_id )

Return array of objects containing user meta data for a single post.


Description Description


Return Return

(array)


Top ↑

Source Source

File: includes/class.llms.person.php

	public function get_user_postmeta_data( $user_id, $post_id ) {
		global $wpdb;

		if ( empty( $user_id ) || empty( $post_id ) ) {
			return;
		}

		$table_name = $wpdb->prefix . 'lifterlms_user_postmeta';

		$results = $wpdb->get_results( $wpdb->prepare(
		'SELECT * FROM ' . $table_name . ' WHERE user_id = %s and post_id = %d', $user_id, $post_id) );

		if ( empty( $results ) ) {
			return;
		}

		for ( $i = 0; $i < count( $results ); $i++ ) {
			$results[ $results[ $i ]->meta_key ] = $results[ $i ];
			unset( $results[ $i ] );
		}

		return $results;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.