Formidable Forms

Formidable Forms

  • Features
  • Pricing
  • Resources
    • Docs & Support
    • Blog
    • Community
  • Solutions
    • Web Applications
    • Calculators
    • Surveys
    • Directories
    • Payments
    • Contact forms
  • Login
  • Get Formidable Forms

How to Add a "Like" or "Add to Favorites" Button

Last Updated: April 28, 2020

Knowledge Base → Views → Examples → How to Add a "Like" or "Add to Favorites" Button

If you have a View where you would like users to be able to select specific entries to "like" and add to their list of favorites, follow the directions below to set this up. See an example of a Add to Favorites/Like button. This will only work for logged-in users.

Formidable Forms is the best WordPress Form Builder plugin. Get it for free!

Create Add to Favorites / Like Button Form

  1. Create a form titled "Add to Favorites". Add a Dynamic field and UserID field.
    • In the Dynamic field, set it up to load options from the form that is being used in your main View and select the title or name field if you have one; if not, any other field is fine. Display as a dropdown with Visibility set to Administrator.
    • Add [get param=entry] as the dynamic default value. This field will be used to grab the ID of each entry that users "like".
      Dynamic Default Value
    • If you would like to prevent users from "liking" the same entry multiple times, add this code to your theme functions.php file or your own plugin. Make sure to change 125 (in the code example) to the ID of your Dynamic field.
  2. In the Settings for the Add to Favorites form, do the following:
    • Select "Redirect to URL" and leave the URL box blank
    • Select "Submit this form with AJAX"
    • Select "Only logged-in users can see and submit this form"
    • Select "Allow logged-in users to edit their own previous responses"
    • Change the Submit Button Text to "Add to favorites" or any other text.
  3. Go into edit your main View.
    • Make sure the View is set to dynamic and the parameter name says 'entry'. If you already have a parameter name that you don't want to change, you could add another parameter to your detail link so it looks like this: [detaillink]&entry=[id].
    • In the dynamic content, insert your "Add to Favorites" form like this:
      [formidable id=31 minimize=1]

Display List of Users Who Favorited an Entry

If you would like to see a list of users who have "liked" each listing, follow the instructions below.

  1. Create a View for the "Add to Favorites" form.
  2. Set it to display All Entries.
  3. Put this in the content:
    <div id="frm_container_[id]">
    [981 show="display_name"][deletelink label="Remove from Favorites" prefix="frm_container_"]
    </div>

    Change '981' to the ID of your userID field.

  4. Add a filter in the Advanced Settings at the bottom that sets your Dynamic field equal to [get param=entry].
  5. Go into edit your main View and in the dynamic content, insert your new View you have just created.

Show a User Their Favorite Entries

If you want your users to be able to see all the entries they have "favorited", follow, these instructions below.

  1. Create a View called "Favorite Listings" that uses entries from the "Add to Favorites" form.
  2. Set it to display All Entries.
  3. Add any content you would like. If you want to add a "Remove from Favorites" link, add an opening div and closing div around the content with a deletelink included so it will look something like this:
    <div id="frm_container_[id]">
    Your content here
    [deletelink label="Remove from favorites" prefix="frm_container_"]
    </div>
  4. Add a filter in the Advanced Settings at the bottom that says 'UserID is equal to current_user'.
    Create View Filter User ID

Related Videos

  • How to bookmark favorite jobs
  • Create Add to Favorites / Like Button Form
  • Display List of Users Who Favorited an Entry
  • Show a User Their Favorite Entries
  • Related Videos
Categories
×

Categories

  • Installation & Getting Started
  • Account Management
  • Forms
  • Entries
  • Views
  • Styles
  • Importing & Exporting
  • Add-Ons
  • Extend Formidable Forms

Using WordPress and want to get Formidable Forms for free?

Get Formidable Forms Lite Now

You do not have permission to view this form. Maybe you need to log in?

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

Take on bigger projects Right Now

Get the tools you need to revolutionize your workflow and architect a masterpiece. Build the most advanced WordPress forms and actually use the data you collect in meaningful ways.

Get the most advanced WordPress form plugin and the only form builder with integrated Views.

Get Formidable Forms Now

Resources

  • Community
  • Affiliates
  • Contact
  • Free Online Form Builder

Top Features

  • Application Builder
  • Calculator Forms
  • Surveys & Polls
  • Quiz Maker
  • Form Templates
  • Application Templates
  • Directories
  • Donation Plugin

Company

  • About Us
  • Giving Back
  • Careers
  • Newsletter
  • WP Tasty
  • Nutrifox

Copyright © 2023 Strategy11, LLC. Formidable FormsĀ® is a registered trademark Strategy11, LLC.
Privacy Policy | Terms of Service | Sitemap

Join 300,000+ using Formidable Forms to create form-focused solutions fast. Get Started See User Reviews