=== Gravity Forms Sticky List ===
Contributors: fried_eggz
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8R393YVXREFN6
Tags: gravity forms, edit, list, delete
Requires at least: 3.0.1
Tested up to: 4.1
Stable tag: 1.2.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Sticky List is a Gravity Forms add-on that lets you list and edit entries from the front end.

== Description ==

#### Sticky List
Sticky List is an add-on for the WordPress plugin <a href="http://www.gravityforms.com/" target="_blank">Gravity Forms</a> that lets you list and edit entries from the front end. You can display a list on the front end where users can view, delete and edit submitted entries. 

#### Features

* Display a list of entries on the front end
* Choose who can se the list; entry creator, all logged in users or anyone.
* Support for (almost) all Gravity Forms fields
* Create/edit/delete Wordpress posts from the front end
* Conditional logic support
* View, edit and delete existing entries from the front-end
* Use existing entries as templates for duplication
* Conditional notifications
* Conditional confirmations
* List sorting and search (using <a href="http://www.listjs.com/">list.js</a>)
* List pagination
* Custom column labels
* Uses new <a href="http://www.gravityhelp.com/documentation/page/Gravity_Forms_API">Gravity Forms API</a> and the official <a href="http://www.gravityhelp.com/documentation/page/Add-On_Framework">Gravity Forms Add-on framework</a>
* Fully customizable with dead simple styles to override
* Fully localized. You can <a href="https://github.com/13pixlar/sticky-list/tree/master/languages">add your translation</a>
* Fully supported and maintained
* Completely free and open source

#### Planned features

* Support for multi page forms
* Support for multiple uploads in file field
* Support for GF 1.9 "Save and Continue" functionallity

#### Usage

1. Upload and activate the plugin
2. Go to the settings page of a form and click the Sticky List settings tab
3. Enable Sticky List for that form and choose your settings
4. Select the page/post where the **form** is embedded  
5. Go to the form editor and select what fields should be displayed in the list
6. Put the shortcode in a page/post with the corresponding form id, i.e:<br>
`[stickylist id="1"]`

If you want to display entries only from a specific user you can include the user ID like so:<br>
`[stickylist id="1" user="5"]`

To use this in a template file, for example on the user profile page (make user that the variable **$user_id** holds the ID of the user who's profile is being viewed):<br>
`echo do_shortcode( "[stickylist id='1' user='" . $user_id . "']");`

#### List and edit Gravity Form entries on the front end

Front end editing of entries has always been a problem in Gravity Forms. Solutions that exist are buggy and not very feature rich. Gravity Forms Sticky List aims to fill this gap and provide a simple and solid way to view, edit and delete entry submissions from the front end. The goal of the plugin is not to to display entries in a fancy way (<a href="https://gravityview.co/">GravityView</a> already does that brilliantly) but to provide a simple, lightweight and rock solid way to list, edit and delete submissions on the front-end. Lists can be embedded in any post or page.

#### Delete Gravity Form submissions from front end

Gravity Forms Sticky List uses a simple ajax approach to deleting entries. Deleted entries are moved to trash or permanently deleted depending on the per form settings.

#### Create, edit and delete Wordpress posts on the front end

If you attach a Post Field to your form you can use Sticky List to let your users create, edit and delete Wordpress posts from the front end. This makes Gravity Forms more powerful and allows you to create all sorts of features for your users.

#### List entries from a specific user

You can use the list to display entries from a specified user. This is helpful when building for example a user profile and are looking to display that user's submissions on the front end at his or hers profile page. Se the **usage** section form more info.

#### Sort and search entries

Sticky List uses the fast and lightweight <a href="http://www.listjs.com/">list.js</a> to allow for sorting the list and searching the entries. Searching entries is fast and results are updated immediately. 

#### Conditional confirmations and notifications

Gravity Forms Sticky List adds conditional confirmations and notifications so that different confirmations messages can be shown depending on if a new entry was submitted or if an existing entry was updated, and diffrent email notifications can be sent if an entry was added, updated or deleted.

#### Styling the list

Sticky List ships with a minimal stylesheet that is easy to override. The table has the class of `.sticky-list` attached to it which can be used to override the default styles. The stylesheet is located in `sticky-list/css/sticky-list_styles.css` in the plugins main directory. To override a style just copy it from <a href="https://github.com/13pixlar/sticky-list/blob/master/css/sticky-list_styles.css">sticky-list_styles.css</a> and paste it in your themes css-file, then modify the style to your liking.

#### Custom capabilities

Sticky List adds two capabilities that can be used to allow users to edit and delete entries in the list. These are `stickylist_edit_entries` and `stickylist_delete_entries`. Users/roles with these capabilities will be able to edit/delete entries in the list.

#### Developers

**Avalible filters**<br>
The filter `filter_entries` allows for filtering of the entries in the list.<br>
Paramters: $entries (array of entry objects)<br>

**Example**<br>
This code (when placed in functions.php) would filter out all entries where field ID 1 equals "some-text"<br>
`
add_filter('filter_entries','hide_some_rows' );
function hide_some_rows($entries) {
	foreach ($entries as $entryKey => $entryValue) {		
		if ($entryValue["1"] == "some-text") {
			unset($entries[$entryKey]);
		}
	}
	return $entries;
}
`

**Documentation**<br>
There is a fully documented version of the plugin on the <a href="https://github.com/13pixlar/sticky-list">Github project page</a>. This plugin is Open Source and pull requests are welcome.

**Note:** <a href="http://www.gravityforms.com/" target="_blank">Gravity Forms</a> version 1.8.19.2+ is required for this plugin.

#### Known issues

**The "Save & continue" feature in Gravity Forms 1.9 is not supported**<br>
This will be addressed in a future version of Sticky List.

**Sticky List does not currently support multi page forms**<br>
This functionallity will be added in a future version of Sticky List.

**Multiple file uploads in same field does not work**<br>
This will be addressed in a future version of Sticky List.

**Post image meta fields are not populated when editing an entry**<br>
When editing an entry that has Wordpress Post Image Field the meta inputs are not populated with existing values. This is due to how Gravity Form saves the data. This issue *might* be adressed in a future version if requested.

== Installation ==

1. Upload extracted folder to the '/wp-content/plugins/' directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Choose the required Sticky List settings on the individual form settings page.

== Frequently Asked Questions ==

= The plugin is activated but doesnt seem to work =

Sometimes after an upgrade Gravity Forms will fail to reactivate add-ons properly. Just deactivate and activate Sticky List manually from the plugins page in the WordPress admin.

= The list is empty, why? =

You need to check "Show in list" on the fields that you would like to appear in the list. This is done in the form editor when edtiting a field.

= The View and Edit links don't do anything =

In Sticky List settings for that form: make sure that you select the page/post where the FORM is embedded. The actual form is then used to view and/or edit the entries.

= Where are the Sticky List settings? =

Sticky List is activated on a per form basis. The settings are located in the individual form settings, right under Notifications.

= I still cant find any sticky list settings =

Make sure that the plugin is activated **and** that your Gravity Forms version is 1.8.19.2 or higher.

There is a bug in the Gravity Forms API in pervious versions that prevented fields from getting saved in the entry. The bug was fixed in version 1.8.19.2 of Gravity Forms. Make sure you use an <a href="http://www.gravityhelp.com/downloads/">updated version</a>. If you are not able to update Gravity Forms you can easily apply the patch manually to `plugins/gravityforms/includes/api.php`

On line `510`, remove 
`
if (empty($entry_id))
    $entry_id = $entry["id"];
`
and replace with
`
if (empty($entry_id)) {
    $entry_id = $entry["id"];
}else{
    $entry["id"] = $entry_id;
}
`

You also need to change the Sticky List plugin file to requre an earlier version of Gravity Forms

In `plugins/gravity-forms-sticky-list/class-sticky-list.php` on line `8` change 
`
protected $_min_gravityforms_version = "1.8.19.2";
`
to your version of Gravity Forms. Note that this change will be lost when updating Sticky List. Therefore its absolutely recommended that you update Gravity Forms when using this plugin on a production site.

== Screenshots ==

1. Sticky List settings page 

2. Sticky List settings page 

3. Sticky List field settings

4. Front end list 

== Changelog ==

= 1.2.5 =
* Feature: Allow duplication of entries in the list

= 1.2.4 =
* Added better date field support

= 1.2.3 =
* Added two custom capabilities for edit and delete

= 1.2.2 =
* Added better support for price option fields
* Fixed an undefined index notice

= 1.2.1 =
* Added better price field support
* Updated styles and enque priority

= 1.2 =
* Updated the code to use a better way of getting the currently logged in user

= 1.1.9.1 =
* Fixed a bug that would show the Sticky List menu item twice

= 1.1.9 =
* Update: Updated Sticky List to user Gravity Forms self initiation to prevent Sticky List from beeing deactivated on update

= 1.1.8 =
* Feature: Optionally display a confirmation on delete

= 1.1.7.1 =
* Fixed a fatal error that would crash the add-on if no user was logged in (Sorry!)

= 1.1.7 =
* Fixed an issue that prevented redirects from working
* Fixed an where list would be empty on BuddyPress
* Fixed some possible bugs with file uploads

= 1.1.6 =
* Feature: Added the option select a field by which the list is sorted

= 1.1.5 =
* Feature: Added the option show a link to WordPress post

= 1.1.4 =
* Added option to enable/disable file hyperlinks in list

= 1.1.3 =
* Fixed an issue where required file upload fields would not validate
* Added support for custom fields in WordPress post fields

= 1.1.2 =
* Fixed an issue where editing a WordPress post would disable comments

= 1.1.1 =
* Feature: Added the option to specify a user ID in the shortcode

= 1.1 = 
* Feature: Added pagination support

= 1.0.9 =
* Added support for file upload field (no multi upload yet unfortunately)
* Added option to prevent text wraping

= 1.0.8 =
* Added a filter for entries that are shown in the list
* Added setting for maximum number of entries to be shown in the list

= 1.0.7 =
* Added support for Post fields (create/edit/delete Wordpress posts).

= 1.0.6 =
* Updated confirmations to properly render merge tags.

= 1.0.5 =
* Fixed a nasty bug that prevented confirmation and notification settings from being displayed if Stickly List was active but not enabled for a form.

= 1.0.4 =
* Update: Added alphabetic sorting of pages/posts in embedd dropdown
* Update: Increased number of visible pages/posts in embedd dropdown
* Feature: Added the option to manually input an embedd url

= 1.0.3 =
* Fixed an issue where last name was displayed before first name in the list
* Fixed an issue that prevented some confirmations from displaying
* Fixed some undefined index warnings

= 1.0.2 =
* Fixed a problem where dependencies would not get included

= 1.0.1 =
* Fixed an issue where only the first 20 entries in the list were shown
* Fixed a bug where translation would not get loaded

= 1.0 =
* Initial release
