mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-19 14:43:49 +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;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user