Hi @mtnporcupine,
You can change your User Availability Settings to Disable/Hide ratings for non-logged users.
You can set this at your management dashbboard -> RatingWidget -> Settings.
Then look under the User Availability Settings.
Let me know if this worked for you.
Thanks.
Yes, that would work if I were using traditional WP login for my users, but we use a custom system that connects with our member database.
So really I’m looking for a way to programmatically toggle active/readonly as I embed the widget. For example, the top of the page will be read only (near the title) but the option to rate will be at the bottom of the page.
Thanks again!
You are right, we do NOT expose the readOnly property via the shortcodes. We have a LOT of properties, and we are only exposing the most used features.
If you are using [ratingwidget_raw] shortcode, you should follow the next steps:
- Open
rw-shortcodes.php
- Search for
function rw_the_post_shortcode
- Change the whole function with the following code:
function rw_the_rating_shortcode( $atts ) {
RWLogger::LogEnterence( 'rw_the_rating_shortcode' );
if ( RWLogger::IsOn() ) {
RWLogger::Log( 'rw_the_rating_shortcode', var_export( $atts, true ) );
}
extract( shortcode_atts( array(
'id' => 1,
'title' => '',
'permalink' => '',
'type' => 'blog-post',
'add_schema' => false,
'read_only' => false,
), $atts ) );
if ( is_string( $read_only ) ) {
$read_only = ( 'true' === strtolower( $read_only ) );
}
if ( is_string( $add_schema ) ) {
$add_schema = ( 'true' === strtolower( $add_schema ) );
}
return rw_get_rating( $id, $title, $permalink, $type, $add_schema, $read_only );
}
- Now search for
function rw_get_rating and replace the function with:
function rw_get_rating( $urid, $title = '', $permalink = '', $class = 'blog-post', $schema = false, $read_only = false ) {
$options = array();
if ($read_only)
$options['read-only'] = 'true';
return ratingwidget()->EmbedRawRating($urid, $title, $permalink, $class, $schema, false, false, $options );
}
If you are using [ratingwidget], use similar principles. Let us know if that worked.
Wow, thanks for the custom code. It worked perfectly (I’m using the shortcodes directly in PHP).
When using this code it does not grab my options set in the plugin (specifically styles). I was able to add another parameter to the options array to set the style type!
$options['style'] = 'flat_yellow';
Thanks again for your prompt replies. This seals the deal for us to upgrade to the pro account.
Happy it worked!
If you want to grab the options from the settings you need to set the type or $rclass (rating class property).
Check this link to find more about our shortcodes:
http://rating-widget.com/support/shortcodes/is-there-any-php-shortcodes-i-can-use-for-my-custom-posts-templates/#platform
For example, if you want to apply the settings of the posts ratings, use “blog-post” as the $rclass.