LLMS_Shortcode_User_Info::get_output()
Retrieve the actual content of the shortcode
Description Description
$atts & $content are both filtered before being passed to get_output() output is filtered so the return of get_output() doesn’t need its own filter
Return Return
(string)
Source Source
File: includes/shortcodes/class-llms-shortcode-user-info.php
protected function get_output() { /** * Filters the user used to retrieve user information displayed by the [llms-user] shortcode * * @since 5.0.0 * * @param integer $user_id The WP_User ID of the currently logged-in user or `0` if no user logged in. */ $user_id = apply_filters( 'llms_user_info_shortcode_user_id', get_current_user_id() ); $key = $this->get_attribute( 'key' ); $default = $this->get_attribute( 'or' ); if ( in_array( $key, $this->get_blocklist(), true ) ) { return ''; } // No user OR no key provided. if ( ! $user_id || ! $key ) { return $default; } $user = new WP_User( $user_id ); $val = $user->exists() ? $user->get( $key ) : null; return ! empty( $val ) && is_scalar( $val ) ? $val : $default; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |