Bookmarks
This module lets people bookmark (add to favorites) ExpressionEngine entries, members, comments and categories for quick access.
- Checking/adding a bookmark
- Listing bookmarked:
- Listing people who bookmarked certain data
- Total bookmarks
↑Checking/adding a bookmark
{exp:bookmarks:check type="comment" data_id="{comment_id}" form="yes" return="SAME_PAGE"}
{if not_bookmarked}
<input type="submit" value="add bookmark" />
{/if}
{if bookmarked}
<input type="submit" value="remove bookmark" />
{/if}
{/exp:bookmarks:check}
{exp:bookmarks:check} checks whether given data item was bookmarked. It can also display form to add/remove bookmark.
Conditional variables:
- {if bookmarked}{/if} — displayed if data has been bookmarked
- {if not_bookmarked}{/if} — displayed if data has not been bookmarked
Tag parameters:
- type — the type of data that is checked/bookmarked. Can be 'entry', 'comment', 'member' or 'category'. Defaults to 'entry'
- data_id — the ID of item to check/bookmark (value of entry_id, comment_id, member_id or category_id)
- form="yes" — wraps data into for for adding/removing bookmark
- site_id — you can restrict check to certain site. Defaults to current site. Separate multiple site_id's with a pipe |
- id — form ID (defaults to 'bookmark_form')
- class — form class (defaults to 'bookmark_form')
- name — form name (defaults to 'bookmark_form')
- return — a page to return after bookmarking. Can be a full URL or URI segments.
Use return="SAME_PAGE" to return user to the page used to display form. - skip_success_message="yes" — force redirect to return page without showing success message.
- ajax="yes" — turn on AJAX mode. The success or error messages shown upon submission will be shown as simple text, without using message templates. The "return" parameter will not be functional if you supply this parameter.
↑Lising bookmarked data
↑Entries
{exp:bookmarks:entries member_data="yes" custom_fields="yes"}
{if count==1}
<div class="box2">
<div class="header">
<div class="t">
<h3>MY BOOKMARKS</h3>
</div>
</div>
<ul class="broadcasters">
{/if}
<li>
<a class="img" href="{path=entry/{url_title}}"><img src="{photo_url}" alt="{title}" /></a>
<div class="text">
<a href="{path=entry/{url_title}}">{title}</a>
{if description}<p>{description}</p>{/if}}
</div>
</li>
{if count==total_results}
</ul>
</div>
{/if}
{/exp:bookmarks:entries}
{exp:bookmarks:entries} tag will display all channel entries bookmarked by user.
Tag parameters (all optional):
- member_id — ID of member to fetch bookmarks. Defaults to logged in user
- username — alternatively, you can specify username istead of member_id
- group_id — set this parameter to Channel ID if you want to restrict output to entries from certain channel
- site_id — you can restrict output to certain site. Defaults to current site. Separate multiple site_id's with a pipe |
- custom_fields="yes" — if set to "yes", will also parse custom fields data for bookmarked entries
- member_data="yes" — if set to "yes", will also parse entry author's data
- prefix — optional prefix for variables. Ex. if you set prefix="bookmark" you'll be able to use {bookmark:title} instead of {title}
- sort — sorting order. Possible values are 'asc', 'desc' (default) and 'random'
- return_ids_string — return ONLY pipe-separated string ot entry_ids (1|7|15|26) as {ids_string} variable
Single variables:
- remove_url — URL that user can click to remove entry from bookmarks
- bookmark_date format="%Y-%m-%d" — the date when entry was favorited
- entry_id
- title
- url_title
- entry_date
- and other standard entry fields
Additionally, if you have custom_fields="yes" set then all custom entry fields are parsed.
If you have member_data="yes" set then entry author's standard member profile fields are also parsed.
↑Members
{exp:bookmarks:members custom_fields="yes"}
{if count==1}
<div class="box2">
<div class="header">
<div class="t">
<h3>MY BOOKMARKED USERS</h3>
</div>
</div>
<ul class="broadcasters">
{/if}
<li>
<a class="img" href="{path=member/{username}}"><img src="{photo_url}" alt="{screen_name}" /></a>
<div class="text">
<a href="{path=member/{username}}">{screen_name}</a>
{if member_description}<p>{member_description}</p>{/if}}
</div>
</li>
{if count==total_results}
</ul>
</div>
{/if}
{/exp:bookmarks:members}
{exp:bookmarks:members} tag will display all site members bookmarked by user.
Tag parameters (all optional):
- member_id — ID of member to fetch bookmarks. Defaults to logged in user
- username — alternatively, you can specify username istead of member_id
- group_id — set this parameter to Group ID if you want to restrict output to members from certain groups
- custom_fields="yes" — if set to "yes", will also parse custom profile data for bookmarked members
- prefix — optional prefix for variables. Ex. if you set prefix="bookmark" you'll be able to use {bookmark:title} instead of {title}
- sort — sorting order. Possible values are 'asc', 'desc' (default) and 'random'
- return_ids_string — return ONLY pipe-separated string ot member_ids (1|7|15|26) as {ids_string} variable
Single variables:
- remove_url — URL that user can click to remove member from bookmarks
- bookmark_date format="%Y-%m-%d" — the date when member was favorited
- member_id
- username
- screen_name
- and other standard member profile fields
Additionally, if you have custom_fields="yes" set then all custom profile fields are parsed.
↑Comments
{exp:bookmarks:comments member_data="yes"}
{if count==1}
<div class="box2">
<div class="header">
<div class="t">
<h3>COMMENTS I LIKE</h3>
</div>
</div>
<ul class="broadcasters">
{/if}
<li>
<a class="img" href="{comment_url_title_auto_path}#c{comment_id}"><img src="{photo_url}" alt="{title}" /></a>
<div class="text">
<a href="{comment_url_title_auto_path}#c{comment_id}">{title}</a>
<p>{comment}</p>
</div>
</li>
{if count==total_results}
</ul>
</div>
{/if}
{/exp:bookmarks:comments}
{exp:bookmarks:comments} tag will display all comments bookmarked by user.
Tag parameters (all optional):
- member_id — ID of member to fetch bookmarks. Defaults to logged in user
- username — alternatively, you can specify username istead of member_id
- group_id — set this parameter to Channel ID if you want to restrict output to comments to entries from certain channel
- site_id — you can restrict output to certain site. Defaults to current site. Separate multiple site_id's with a pipe |
- member_data="yes" — if set to "yes", will also parse comment author's data
- prefix — optional prefix for variables. Ex. if you set prefix="bookmark" you'll be able to use {bookmark:title} instead of {title}
- sort — sorting order. Possible values are 'asc', 'desc' (default) and 'random'
- return_ids_string — return ONLY pipe-separated string ot comment_ids (1|7|15|26) as {ids_string} variable
Single variables:
- remove_url — URL that user can click to remove entry from bookmarks
- bookmark_date format="%Y-%m-%d" — the date when entry was favorited
- entry_id
- title
- url_title
- comment_id
- comment_url_title_auto_path
- comment_entry_id_auto_path
- comment
- and some other standard comment variables
If you have member_data="yes" set then comment author's standard member profile fields are also parsed.
↑Categories
{exp:bookmarks:categories custom_fields="yes"}
{if count==1}
<div class="box2">
<div class="header">
<div class="t">
<h3>CATEGORIES I LIKE</h3>
</div>
</div>
<ul class="broadcasters">
{/if}
<li>
<a class="img" href="{path=site/category/{category_url_title}}"><img src="{category_image}" alt="{category_name}" /></a>
<div class="text">
<a href="{path=site/category/{category_url_title}}">{category_name}</a>
{if custom_category_desc}<p>{custom_category_desc}</p>{/if}}
</div>
</li>
{if count==total_results}
</ul>
</div>
{/if}
{/exp:bookmarks:categories}
{exp:bookmarks:categories} tag will display all categories bookmarked by user.
Tag parameters (all optional):
- member_id — ID of member to fetch bookmarks. Defaults to logged in user
- username — alternatively, you can specify username istead of member_id
- group_id — set this parameter to Category Group ID if you want to restrict output to categories from certain group
- custom_fields="yes" — if set to "yes", will also parse custom category fields data for bookmarked categories
- prefix — optional prefix for variables. Ex. if you set prefix="bookmark" you'll be able to use {bookmark:title} instead of {title}
- sort — sorting order. Possible values are 'asc', 'desc' (default) and 'random'
- return_ids_string — return ONLY pipe-separated string ot category_ids (1|7|15|26) as {ids_string} variable
Single variables:
- remove_url — URL that user can click to remove category from bookmarks
- bookmark_date format="%Y-%m-%d" — the date when category was favorited
- category_id
- category_name
- category_url_title
- category_description
- and other standard category fields
Additionally, if you have custom_fields="yes" set then all custom category fields are parsed.
↑Listing people who bookmarked certain data
{exp:comment:entries}
{if no_results}no comments{/if}
<li>
{comment}
<span>
Bookmarked by
{exp:bookmarks:by type="comment" data_id="{comment_id}" backspace="1"}
{if no_results}none{/if}
{screen_name},
{/exp:bookmarks:by}
</span>
</li>
{/exp:comment:entries}
{exp:bookmarks:by} tag will display list or all people who bookmarked certain data.
Tag parameters:
- type — the type of data. Can be 'entry', 'comment', 'member' or 'category'. Defaults to 'entry'
- data_id — the ID of item to check against (value of entry_id, comment_id, member_id or category_id)
- custom_fields="yes" — if set to "yes", will also parse custom profile fiels from profiles of those who bookmarked
- prefix — optional prefix for variables. Ex. if you set prefix="bookmark" you'll be able to use {bookmark:title} instead of {title}
Single variables:
- member_id
- username
- screen_name
- photo_url
- avatar_url
- and other standard member profile fields
Additionally, if you have custom_fields="yes" set then all custom profile fields are parsed.
↑Total bookmarks
{exp:bookmarks:members total_only="yes"}
Members followed: {total_results}
{/exp:bookmarks:members}
Categories watched: {exp:bookmarks:categories total_only="yes"}
total_only="yes" parameter added to any of module tags: entries/members/categories/comments/by will result in tag returning only total number of bookmarks by member for tag's datatype.
It can be used without closing tag. If closing tag is used, the number of bookmarks is contained in the only availabe variable, total_results
You can also use {exp:bookmarks:total} (as single tag or pair) to get tital number of member's bookmarks, irrespectible of type.
{exp:bookmarks:total}
{total_results}
{/exp:bookmarks:total}