LLMS_Abstract_Generator_Posts::get_author_id_from_raw( array $raw, int $fallback_author_id = null )

Receives a raw array of course, plan, section, lesson, etc data and gets an author id

Description Description

Falls back to optionally supplied fallback id. Falls back to current user id.

Top ↑

Parameters Parameters


(array) (Required) Raw data.


(int) (Optional) WP User ID. Default is null. If not supplied, if no author is set, the current user ID will be used.

Default value: null

Top ↑

Return Return


Top ↑

Source Source

File: includes/abstracts/llms-abstract-generator-posts.php

	public function get_author_id_from_raw( $raw, $fallback_author_id = null ) {

		// If author is set, get the author id.
		if ( isset( $raw['author'] ) ) {
			$author_id = $this->get_author_id( $raw['author'] );

		// Fallback to current user.
		if ( empty( $author_id ) ) {
			$author_id = ! empty( $fallback_author_id ) ? $fallback_author_id : get_current_user_id();

		return $author_id;


Top ↑

Changelog Changelog

Version Description
4.7.0 Moved from LLMS_Generators.
3.30.2 Made publicly accessible.
3.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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