Title: [Plugin: Rating-Widget] Plugin doesnt save options
Last modified: August 19, 2016

---

# [Plugin: Rating-Widget] Plugin doesnt save options

 *  [wusis](https://wordpress.org/support/users/wusis/)
 * (@wusis)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rating-widget-plugin-doesnt-save-options/)
 * hey,
 * im using plugin 1.1.1 with 3.0.4 and it doesnt save any options.
    i am using 
   standard-template and changed no sourcecode. i’ve tried 1.0.4, but also doesnt
   work.
 * there is only one ‘save options’ button. no seconds one.
 * [http://wordpress.org/extend/plugins/rating-widget/](http://wordpress.org/extend/plugins/rating-widget/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Vova Feldman](https://wordpress.org/support/users/svovaf/)
 * (@svovaf)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rating-widget-plugin-doesnt-save-options/#post-1863547)
 * We had some problems with this version. Please try the newest 1.1.2 version, 
   and if it still don’t work you are more than welcome to connect me on [vova@rating-widget.com](https://wordpress.org/support/topic/plugin-rating-widget-plugin-doesnt-save-options/vova@rating-widget.com?output_format=md)
 *  [xfx](https://wordpress.org/support/users/xfx/)
 * (@xfx)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rating-widget-plugin-doesnt-save-options/#post-1863621)
 * I tried to implement the “Forcing log-in before rating” code change and it didn’t
   work. I was able to rate without being logged in.
 * Then I noticed that the widget stopped saving any changes.
    So I had to uninstall
   it and re-install it to get it to work.
 *  Plugin Author [Vova Feldman](https://wordpress.org/support/users/svovaf/)
 * (@svovaf)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rating-widget-plugin-doesnt-save-options/#post-1863622)
 * You are more than welcome to send me the changes you made so I can take a look
   and see what’s wrong – [vova@rating-widget.com](https://wordpress.org/support/topic/plugin-rating-widget-plugin-doesnt-save-options/vova@rating-widget.com?output_format=md)
 *  [xfx](https://wordpress.org/support/users/xfx/)
 * (@xfx)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rating-widget-plugin-doesnt-save-options/#post-1863624)
 * Hi svovaf,
 * Well, what I did was:
 * – Using the Plugins->Editor in WordPress I loaded the rating-widget.php file
 * – Then, I modified the following code:
    `RW.init("<?php echo WP_RW__USER_KEY;?
   >");`
 *  And changed it for this:
 *     ```
       RW.init("<?php echo WP_RW__USER_KEY; ?>",{
       beforeRate: function(vote, rating){
       if (!is_logged_in()){
       return false;
       }else{
       return get_user_id();
       }
       }
       });
       RW.render();
       ```
   
 * Again, the only way I could get the plugin to work again was by uninstalling 
   it and then re-installing it.
 * One thing I did though was to check the values on the database and although the
   values were correctly set, the plugin always used the default values and didn’t
   save any changes.
 *  Plugin Author [Vova Feldman](https://wordpress.org/support/users/svovaf/)
 * (@svovaf)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rating-widget-plugin-doesnt-save-options/#post-1863625)
 * Dear friend, I believe that you made some confuse of PHP inside JavaScript. is_logged_in()
   AND get_user_id() are both WP PHP functions (server-side). While the beforeRate
   must be a client-side function.
    If you have enough passions, I can promise you
   that in the coming week we’ll deploy a version that contain privacy settings 
   which enables disabling ratings when a user is logged out. If you are in a hurry,
   search for the next line in the code: `if ($data["rclass"] == "activity_update"
   ||`
 * And just remove the condition.
    **Before:**
 *     ```
       if ($data["rclass"] == "activity_update" ||
                               $data["rclass"] == "activity_comment")
                           {
                               $options_obj = json_decode($rw_settings[$data["rclass"]]["options"]);
                               $options_obj->readOnly = (!$is_logged);
                               $rw_settings[$data["rclass"]]["options"] = json_encode($options_obj);
                           }
       ```
   
 * **After:**
 *     ```
       $options_obj = json_decode($rw_settings[$data["rclass"]]["options"]);
                               $options_obj->readOnly = (!$is_logged);
                               $rw_settings[$data["rclass"]]["options"] = json_encode($options_obj);
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: Rating-Widget] Plugin doesnt save options’ is closed to new 
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/rating-widget_4db0e0.svg)
 * [Rating-Widget: Star Review System](https://wordpress.org/plugins/rating-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rating-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rating-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/rating-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rating-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rating-widget/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Vova Feldman](https://wordpress.org/support/users/svovaf/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-rating-widget-plugin-doesnt-save-options/#post-1863625)
 * Status: not resolved