Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/** * 1. Create a custom Toggle field in your form and change the _Field Name_ and _Template Tag_ to "is_mystery_user" * 2. Add a "review_as_mystery_user" capability to the user role that can review as a mystery user (change this as needed) * 3. Add the code snippet to your website */ /** * This changes the "is_mystery_user" Toggle field in the review form to a Hidden field for specific users. */ function glsr_modify_is_mystery_user_field ($fields): array { // check if the user can review as a mystery user. // change as needed... if (!current_user_can('review_as_mystery_user')) { return $fields; } // This will change the "is_mystery_user" custom field type to a hidden field. // hidden field values cannot be tampered with! foreach ($fields as $field) { if ('is_mystery_user' === $field->original_name) { $field->id = ''; $field->is_raw = true; $field->original_type = 'hidden'; $field->type = 'hidden'; break; } } return $fields; } add_filter('site-reviews-authors/update-review-form/fields/all', 'glsr_modify_is_mystery_user_field', 10, 2); add_filter('site-reviews/review-form/fields/all', 'glsr_modify_is_mystery_user_field', 10, 2); /** * This changes the HTML _value_ of the rendered {{ is_mystery_user }} template tag. */ function glsr_modify_is_mystery_user_template_tag_value ($value, $tag): string { if (empty($value)) { return $value; } return '👻'; // change this to your custom html string... } add_filter('site-reviews/custom/value/is_mystery_user', 'glsr_modify_is_mystery_user_template_tag_value', 10, 2);
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)