Viewing 4 replies - 1 through 4 (of 4 total)
  • I’d like to know this as well. Currently you click the remove all favs button and the posts are still there. To users this might seem like it’s not working.

    I figured this out but you have to edit one of the plugin’s core files which sucks but it’s all we can do for now.

    In the file ClearFavoritesButton.php (plugins/favorites/app/Entities/Favorite/)

    1. Find:

    $out = '<button class="simplefavorites-clear" data-siteid="' . $this->site_id . '">' . $this->text . '</button>';

    and change to:

    $out = '<button class="simplefavorites-clear" onclick="FavReload()" data-siteid="' . $this->site_id . '">' . $this->text . '</button>';

    2. In footer.php add:

    <script>
    function FavReload() {
       setTimeout(myTimeFunction, 1500);
    }
    function myTimeFunction() {
       document.location.reload(true);
    }
    </script>

    The 1500 equals 1.5 seconds, you can change that if needed. Only tested this on Chrome so no guarantees it’ll work on all browsers.

    I was looking for a solution to this as well. Thank you for the code! Works fine here on Chrome & Firefox so far.

    Hello.

    You probably solved the problem, but that may not be the best way to solve it.

    If you update the plugin in the future, your code will be lost. So its better if you add this to your .js file, or in the footer between the <script> tags.

    // reload after clearing favorites
    $(".simplefavorites-clear").click(function(){
        setTimeout(myTimeFunction, 1500);
    });	
    function myTimeFunction() {
       document.location.reload(true);
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Refreshing the page on click (clear favorites button)’ is closed to new replies.