llms_add_user_table_rows( string $val, string $column_name, int $user_id )

Add data user data for custom column added by llms_add_user_table_columns


Parameters Parameters

$val

(string) (Required) value of the field

$column_name

(string) (Required) "id" or name of the column

$user_id

(int) (Required) user_id for the row in the loop


Top ↑

Return Return

(string) data to display on screen


Top ↑

Source Source

File: includes/functions/llms.functions.person.php

 *
 * @param string  $user_login Username.
 * @param WP_User $user       WP_User object of the logged-in user.
 * @return void
 */
function llms_set_user_login_time( $user_login, $user ) {
	update_user_meta( $user->ID, 'llms_last_login', llms_current_time( 'mysql' ) );
}
add_action( 'wp_login', 'llms_set_user_login_time', 10, 2 );

/**
 * Remove a LifterLMS Student from a course or membership
 *
 * @since 3.0.0
 *
 * @see LLMS_Student->unenroll() the class method wrapped by this function
 *
 * @param int    $user_id     WP User ID.
 * @param int    $product_id  WP Post ID of the Course or Membership.
 * @param string $new_status  The value to update the new status with after removal is complete.
 * @param string $trigger     Only remove the student if the original enrollment trigger matches the submitted value.
 *                            Passing "any" will remove regardless of enrollment trigger.
 * @return boolean
 */
function llms_unenroll_student( $user_id, $product_id, $new_status = 'expired', $trigger = 'any' ) {
	$student = new LLMS_Student( $user_id );
	return $student->unenroll( $product_id, $trigger, $new_status );
}

/**
 * Update a user.
 *
 * @since 3.0.0
 * @since 3.7.0 Unknown.
 * @since 5.0.0 Updated to utilize LLMS_Form_Handler class.
 *
 * @param array  $data Array of user data.
 * @param string $location (Optional) screen to perform validations for, accepts "account" or "checkout". Default value: 'account'
 * @param array  $args   Additional arguments passed to the short-circuit filter.
 * @return int|WP_Error WP_User ID on success or error object on failure.
 */
function llms_update_user( $data = array(), $location = 'account', $args = array() ) {
	return LLMS_Form_Handler::instance()->submit( $data, $location, $args );
}

/**
 * Performs validations for submitted user data.
 *
 * The related functions `llms_update_user()` and `llms_register_user()` automatically perform validations so this method
 * should only be used if you wish to test updates / registration without actually performing the registration or update action.
 *
 * @since 7.0.0
 *
 * @param array  $data     Array of user data.
 * @param string $location (Optional) screen to perform validations for, accepts "account" or "checkout". Default value: 'checkout'
 * @param array  $args     Additional arguments passed to the short-circuit filter.
 * @return boolean|WP_Error Returns `true` if the user data passes validation, otherwise returns an error object describing
 *                          the validation issues.
 */
function llms_validate_user( $data = array(), $location = 'checkout', $args = array() ) {
	$args['validate_only'] = true;
	return LLMS_Form_Handler::instance()->submit( $data, $location, $args );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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