mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Add usermeta support to content locker shortcode
This commit is contained in:
@@ -120,6 +120,17 @@
|
||||
$content = str_replace($args['tags'], $args['tags_replace'], $content);
|
||||
}
|
||||
|
||||
$regex = '~\{([^}]*)\}~';
|
||||
preg_match_all($regex, $content, $matches);
|
||||
|
||||
// Support for all usermeta keys
|
||||
if ( isset( $matches[1] ) && is_array( $matches[1] ) && !empty( $matches[1] ) ) {
|
||||
foreach( $matches[1] as $match ) {
|
||||
$strip_key = str_replace('usermeta:','', $match );
|
||||
$content = str_replace( '{' . $match . '}', um_user( $strip_key ), $content);
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ class UM_Shortcodes {
|
||||
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
$args['lock_text'] = $this->convert_locker_tags( $args['lock_text'] );
|
||||
//$args['lock_text'] = $this->convert_locker_tags( $args['lock_text'] );
|
||||
|
||||
if ( !is_user_logged_in() ) {
|
||||
if ( $args['show_lock'] == 'no' ) {
|
||||
@@ -202,7 +202,7 @@ class UM_Shortcodes {
|
||||
$ultimatemember->shortcodes->load_template( 'login-to-view' );
|
||||
}
|
||||
} else {
|
||||
echo do_shortcode( $this->convert_locker_tags( $content ) );
|
||||
echo do_shortcode( $this->convert_locker_tags( wpautop( $content ) ) );
|
||||
}
|
||||
|
||||
$output = ob_get_contents();
|
||||
|
||||
Reference in New Issue
Block a user