wink and unwink ref: website favorites

5 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: April 1, 2015   (RSS)

By Twocans - April 1, 2015

Hi yea,

A pre-purchase question

I was looking at the website-favorites plugin.

I see it mentions 

"Wink/Wave: A common dating site feature. You can trigger an alert upon winking or waving and allow users to view a list of users who have "winked" them."

and also 

"Favorite links dynamically update with ajax without requiring a page reload"

My question is, does it allow or does it do unlink were it required. Aka ..... ok person has clicked it there and then only to realise they didn't want to  and were they to click it again would it change ?

regards

Kenny

By gregThomas - April 1, 2015

Hi Kenny,

This is possible, there are two ways a user could remove someone from their favourites. Via the detail page that contained the button they used to favourite the person in the first place. Or via the favourites list page, which you can create to allow a user to manage their favourites.

Here is some relevant notes from the plugins readme file:

3) Add this code where you want the add/remove favorite links:

  <?php
    $tableOrTag = 'article';       // Update with your section's table name
    $recordNum  = $record['num'];  // Update this with current record number
  ?>

  <div class="<?php wsf_cssClassFor($tableOrTag, $recordNum, 'add'); ?>"
       style="<?php wsf_displayStyleFor($tableOrTag, $recordNum, 'add'); ?>">
    <a href="#" onclick="<?php wsf_onClickFor($tableOrTag, $recordNum, 'add'); ?>">Add Favorite</a>
  </div>

  <div class="<?php wsf_cssClassFor($tableOrTag, $recordNum, 'remove'); ?>"
       style="<?php wsf_displayStyleFor($tableOrTag, $recordNum, 'remove'); ?>">
    <a href="#" onclick="<?php wsf_onClickFor($tableOrTag, $recordNum, 'remove'); ?>">Remove Favorite</a>
  </div>

4) Reload the page and click "Add Favorite".  The link should change to
"Remove Favorite".  Reload the page and confirm the link still displays as
"Remove Favorite" indicating that the current page is a saved favorite.

And here is the relevant text from the favourites list page in the readme:

MANAGING FAVORITE RECORDS
-------------------------------------------------------------------------------
To allow the user to manage and remove their favorite links, such as in a
"My Profile" section of a website, use the above code to load the favorite
records, and this code below to display a "Remove" link beside each one:

  <h2>Favorites</h2>
  <?php foreach ($favoriteRecords as $record): ?>
    <?php
      $tableOrTag = 'news';          // Update with your section's table name
      $recordNum  = $record['num'];  // Update this with current record number
    ?>

    <div class="<?php wsf_cssClassFor($tableOrTag, $recordNum, 'remove'); ?>"
         style="<?php wsf_displayStyleFor($tableOrTag, $recordNum, 'remove'); ?>">
      <a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a> -
      <a href="#" onclick="<?php wsf_onClickFor($tableOrTag, $recordNum, 'removeAndReload'); ?>">Remove</a>
    </div>
  <?php endforeach; ?>

  <?php if (!$favoriteRecords): ?>
     You don't have any favorites yet.
  <?php endif; ?>

Just replace 'news' with your table name and $record['title'] with whatever fields
you want to display from the record.

Let me know if you have any other questions.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By gregThomas - April 1, 2015

Hi K, 

That function is definitely integrated by default. The readme contains some JS code to include in the header of your site to enable the functionality.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Twocans - April 1, 2015

Thank you

"So your saying one can kinda wink without the page needing to be refreshed"

Excellent

I will get it within the next week 

thanks very much and have a nice evening.

k