After a couple of years of building drupal sites i finaly want to give something back to the community, This tutorial is for Drupal 7
What are we gonna do?
This tutorial will learn you how to give your users the ability to add nodes to a list of favorites and show those in a menu.
First you need the following modules, so download them from the drupal site and install:
- Flag
- Views
- Views Flag Refresh
Now walk through the following steps:
1. Go to admin/structure/flags
2. Add a new flag using the following credentials:
- Name => favorites
- Title => Favorites
- Flag link text => Add to your favorites
- Flag link description => Add this item to your favorites
- Flagged message => This item is added to your favorites
- Unflag link text => Delete from favorites
- Unflag link description => Delete this item from your favorites
- Unflagged message => This item is deleted from your favorites
3. Now choose a role(s) this is necessary because you will display the menu of an loged in user.
4. Now at "Flaggable content" add nodetypes so users can flag them to favorites.
5. Choose the view options.
6. Choose Linktype => JavaScript toggle
Ok you just tuned the flag module now we build a view to get this all in action.
1. Build a new view of type content, add a page and a block.
2. first we build the block options with this credentials:
- Choose format of fields
- Add field "Title"
- Add filter "Published"
- Create a Relation to "Flags" choose here for Flag "Favorites" and only show flags for the curent user
- Choose Use AJAX "Yes" and connect "Refresh display on flags" to your item.
- Choose the pager items settings you want.
3. Now set up your page so users can click on a more link to see al there items, (how this works is discribed in many other tutorials)
4. Go to you block settings and add the created block to you prefered region.
5. Now flag some content and check you menu.
------------------------------------------------------
Some extra cool action is possible by:
-adding some background images to your styles, when adding 2 stars one grey an one gold and connect those to the active status css class will give the users a direct view of the status of the node they are viewing.
- Add the module drupal beautytips to your site so a balloon will show a help text when flagging a node.
Succes!!!
Niels
Comments
Post to Documentation
This is great. However, I suggest you post this to the Documentation instead at http://drupal.org/documentation/site-recipes .
Oké
Oke, thanks i just added it to docs....