LLMS_Instructor::add_parent( mixed $parent_ids )

Add a parent instructor to an assistant instructor


Parameters Parameters

$parent_ids

(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.