LLMS_Instructor::add_parent( $parent_ids )

Add a parent instructor to an assistant instructor


Description Description


Parameters Parameters

$parent_id

(mixed) (Required) WP User ID of the parent instructor or array of User IDs to add multiple


Top ↑

Return Return

(boolean)


Top ↑

Source Source

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

	public function add_parent( $parent_ids ) {

		// get existing parents
		$parents = $this->get( 'parent_instructors' );

		// no existing, use an empty array as the default
		if ( ! $parents ) {
			$parents = array();
		}

		if ( ! is_array( $parent_ids ) ) {
			$parent_ids = array( $parent_ids );
		}

		// make ints
		$parent_ids = array_map( 'absint', $parent_ids );

		// add the new parents
		$parents = array_unique( array_merge( $parents, $parent_ids ) );

		// remove duplicates and save
		return $this->set( 'parent_instructors', array_unique( $parents ) );

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: