Sharing Lists

Note: Check out the new extra options for sharing available in 2.x

Lists can be shared freely. You need to add ways to do two things :

  1. Sharing a list
  2. Viewing a shared list

1. Sharing a List

Lists are shared via their {list_id}. To share a list you'd create a similar to :

{exp:shortlist:view}
	{if count==1}
	<a href="{site_url}share/{list_id}">Share this list</a>
	{/if}
{/exp:shortlist:view}

Which would result in :

<a href="http://site.url/share/NXfVVO5sihRFsGlC">Share this list</a>

2. Viewing a shared list

This is very similar to the way to view the current user's list. All you need to do to view a shared list is supply the extra parameter on the :view tag :

{exp:shortlist:view list_id="{segment_3}"}
	…
{/exp:shortlist:view}

In addition to being able to view a list, you can allow other users to use items in the shared list for their own lists. A few additional variables come in handy here :

  • {is_owner} - tell if the viewer of a shared list is the owner (ie. the owner has visited the share url)
  • {in_list} - tell if an item from the list is in the current user's list.
  • {add_url} - use to allow a viewer of a list to add an item from the shared list to their own list (use with {in_list} for best effect)
  • {remove_url} - use to allow a viewer of a list to remove an item in the shared list from their own list (use with {in_list} for best effect)

View full documentation of the tags available in the :view loop

3. (Bonus!) Cloning a shared list

Additionally you can allow a user to clone all them items in a shared list in a single click. Use the {clone_url} within the :view loop to get the url for this link. You can also get the same url using the standalone tag {exp:shortlist:clone_url}

When a list is cloned all the items from the list are added to the current user's list. Any items that are already in the user's list are skipped.