Add usermeta support to content locker shortcode

This commit is contained in:
Ultimate Member
2016-01-02 18:49:56 +02:00
parent 773749dec8
commit 8a95eda1ec
2 changed files with 13 additions and 2 deletions
+11
View File
@@ -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;
}