We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
R. D. shared this code with us:
/** * Replace {current_user:role_is:[...]} Merge Tag * * @param string $text Text to be parsed for Merge Tag. * * @return string */ add_filter( 'gform_replace_merge_tags', function ( $text ) { preg_match( '#{current_user:role_is:(.*?)}#', $text, $matches ); if ( empty( $matches ) ) { return $text; } $roles = explode( '||', $matches[1] ); if ( array_intersect( wp_get_current_user()->roles, $roles ) ) { return str_replace( $matches[0], 'true', $text ); } return str_replace( $matches[0], 'false', $text ); }, 1, 1 );
You need to use it like so:
[gvlogic if='{current_user:role_is:administrator}']is an admin[else]not an admin[/gvlogic]
or
[gvlogic if='{current_user:role_is:admin||meeting-participant}']welcome[/gvlogic]`
We only have this way of filtering user roles at the moment: https://docs.gravitykit.com/article/447-filtering-entries-by-wordpress-user-roles
The text was updated successfully, but these errors were encountered:
No branches or pull requests
R. D. shared this code with us:
You need to use it like so:
or
We only have this way of filtering user roles at the moment: https://docs.gravitykit.com/article/447-filtering-entries-by-wordpress-user-roles
The text was updated successfully, but these errors were encountered: