Favorites 2.5 Save

The Favorites:Save function, when placed in a template, will display the appropriate success or error message once a favorite has been saved. To save a Favorite, link to this template with the entry_id or url_title appended to the link.

Place this loop inside a new template (such as site/save_favorite) {exp:favorites:save}

Parameters

site=

site="site1|site2"

MSM Only: The "site" parameter is required for sites using Multiple Site Manager. Specifiy multiple sites with pipe character.

weblog=

weblog="weblog_c"

The "weblog" parameter is required when using URL Titles in the URL as they are not unique across weblogs.

Examples

The Favorites:Save function will output a confirm or error message. Below is an example of how a Favorites:Save template might look like (it is possible to add more than the below code to the template):
{exp:favorites:save weblog="weblog_c"}

To link to the Favorites:Save template, you’ll need to link to it like these examples:

Adding Favorites:
Within your Weblog:Entries or Favorites:Entries loops, place a link to the Favorites:Save template with either {entry_id} or {url_title} added as a segment.
{exp:weblog:entries}
<h2>{title}</h2>
<p><a href="{path='site/favorite_add'}{entry_id}">Save this entry to my Favorites</a></p>
{/exp:weblog:entries}

Adding Private Favorites:
Within your Weblog:Entries or Favorites:Entries loops, place a link to the Favorites:Save template with either {entry_id} or {url_title} added as a segment.
Append the word “private” as a segment and the entry will be added to the user’s Favorites list, but will not display on their Public favorites list.
{exp:weblog:entries}
<h2>{title}</h2>
<p><a href="{path='site/favorite_add'}{entry_id}/private">Make this entry a Private Favorite</a></p>
{/exp:weblog:entries}

Deleting Favorites:
Within your Weblog:Entries or Favorites:Entries loops, place a link to the Favorites:Save template with either {entry_id} or {url_title} added as a segment.
Append the word “delete” as a segment and the entry will be deleted from the user’s Favorites list.
{exp:weblog:entries}
<h2>{title}</h2>
<p><a href="{path='site/favorite_add'}{entry_id}/delete">Remove from my Favorites</a></p>
{/exp:weblog:entries}

To show all the links in one shot, simply just mash them together like this:

{exp:weblog:entries}
<h2>{title}</h2>
<p><a href="{path='site/favorite_add'}{entry_id}">Save this entry to my Favorites</a> | <a href="{path='site/favorite_add'}{entry_id}/private">Make this entry a Private Favorite</a> | <a href="{path='site/favorite_add'}{entry_id}/delete">Remove from my Favorites</a></p>
{/exp:weblog:entries}

Extras

We often use the Favorites module in combination with AJAX based functions. To enable this and make the AJAX calls faster, we keep all of the possible messages as preferences in the Favorites CP. Make sure you set your preferences before using the Favorites module.