LLMS_Shortcode_Hide_Content::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.hide.content.php
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | protected function get_output() { // Backwards compatibility, get membership if set and fallback to the id. $ids = $this ->get_attribute( 'membership' ) ? $this ->get_attribute( 'membership' ) : $this ->get_attribute( 'id' ); // Explode, trim whitespace and remove empty values. $ids = ( array ) array_map ( 'trim' , array_filter ( explode ( ',' , $ids ) ) ); // Assume content is hidden. $hidden = true; if ( 'any' === $this ->get_attribute( 'relation' ) && ! empty ( $ids ) ) { foreach ( $ids as $id ) { if ( llms_is_user_enrolled( get_current_user_id(), $id ) ) { $hidden = false; break ; } } } elseif ( 'all' === $this ->get_attribute( 'relation' ) && ! empty ( $ids ) ) { $inc = 0; foreach ( $ids as $id ) { if ( llms_is_user_enrolled( get_current_user_id(), $id ) ) { $inc ++; } } if ( count ( $ids ) === $inc ) { $hidden = false; } } return ! $hidden ? do_shortcode( $this ->get_content() ) : $this ->get_attribute( 'message' ); } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.5.1 | |
3.24.1 | Introduced. |