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

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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.