Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Vova Feldman

    (@svovaf)

    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 [email protected]

    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

    (@svovaf)

    You are more than welcome to send me the changes you made so I can take a look and see what’s wrong – [email protected]

    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

    (@svovaf)

    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.