llms_make_select2_student_array( array $user_ids = array(), string $template = '' )
Create an array that can be passed to metabox select elements configured as an llms-select2-student query-ier.
Parameters Parameters
- $user_ids
-
(array) (Optional) Indexed array of WordPress User IDs. Default is empty array.
Default value: array()
- $template
-
(string) (Optional) A template to customize the way the results look. Default is empty string. %1$s = student name %2$s = student email.
Default value: ''
Return Return
(array)
Source Source
File: includes/llms.functions.core.php
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | */ function llms_make_select2_post_array( $post_ids = array (), $template = '' ) { if ( ! $template ) { $template = '{title} (' . __( 'ID#' , 'lifterlms' ) . ' {id})' ; } if ( ! is_array ( $post_ids ) ) { $post_ids = array ( $post_ids ); } $ret = array (); foreach ( $post_ids as $id ) { $title = str_replace ( array ( '{title}' , '{id}' ), array ( get_the_title( $id ), $id ), $template ); $ret [] = array ( 'key' => $id , 'title' => $title , ); } /** * Filter the select2 post array * * @since Unknown * * @param array Associative array of representing select2 post elements. * @param array $post_ids Optional. Indexed array of WordPress Post IDs. */ |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.10.1 | Introduced. |