LLMS_Course::get_user_postmeta_data( $post_id )

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


Description Description


Return Return

(array)


Top ↑

Source Source

File: includes/models/model.llms.course.php

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

		$user_id = get_current_user_id();

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

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

		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.





Permalink: