Favorite documentation pages

As site member, I would like to mark documentation pages as favorites. A list of marked pages should appear as a tab on my user page, and the five most recently added should also appear as a block in the sidebar. This is important since it helps me access content I find useful.

How to Demo: 
  1. Log in to the site.
  2. Flag at least six documentation pages as favorites. (Create the pages first, if necessary.)
  3. Verify that the five most recently added are visible in a sidebar block, linking to the respective documentation pages.
  4. Verify that the block links to a page listing all six documentation pages, with links to the respective pages. Verify that this page appears as a tab at the acting user’s profile page.
Required Preparations: 
  • The site should have a documentation page content type, as provided by the first exercise in this suite.
Additional Comments: 
  • As with the previous exercise, this could be implemented as a tab found at each user page, or only on your own user page – the latter task being drastically simplified using Page manager (and an access rule to compare acting user with the user for whom to list favorites).
  • When building the block display, it is possible to use the flag relation option to include content flagged by current user only. However, this would make it difficult to use the more link – since the page display expects a contextual filter value. A better, but somewhat more heavy approach (for Views), is to use the same contextual filter settings but allow the block to fetch a default value for the filter.
Additional Resources: 
documentation_site_13.zip3.47 KB
Suggested Solution: 
  1. Add a new node flag. Give it the name favorite and the title favorite documentation. (See configuring flags in chapter 11.)
  2. Give the flag descriptive flag/unflag link texts, descriptions and confirmation messages. Allow all authenticated users to use the flag, and allow flags to be put on documentation pages only. (See configuring flags.)
  3. Add a new view. Give it the name favorites, and have it list content without any specified sort criteria. Create a page with the path user/%/favorites, displaying 10 teasers at a time, with a pager. Also create a block, showing five linked titles without any pager. (See creating new views in the Views basics chapter.)
  4. In View's main configuration panel, add a new relationship flags: node flag to get information about all the flags on the listed nodes. Use the favorite flag, and include only flagged content – but include content flagged by all users. (See combining Flag and Views in chapter 11.)
  5. Add another relationship, flags: user, to get information about the user setting each flag. (See combining Flag and Views.)
  6. Add a contextual filter user: uid, restricting the view to list only content where the flagging user has the user ID provided by the contextual filter value. If the filter value is missing – which will be the case for the block – provide default value from user ID from logged in user. Also validate that the filter argument is a user ID. (See configuring contextual filters in the advanced Views configuration chapter.)
  7. Add a sort criteria flags: flagged time, for sorting the list with newest flaggings on top. (See data fields from flags in chapter 11.)
  8. In the block display, override the contextual filter settings. Set the title to your recent favorites. Also override the more link option (in the middle column), setting it to yes. (See overridden configuration in the Views basics chapter.)
  9. Give the block the block name active user's favorites. Save the view. In the blocks administration page, place the new block in one of the sidebars.
Solution Video: 

Add comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.


Sate (not verified)

hi, how did you get pg4wp working ?I am trniyg it out using WP 3.0.2 and at wp-admin/setup-config.php?step=2 , I get a blank page.The logs arent showing me anything either.help!

Poeta (not verified)

To all : I have cleared and tried to show logic at my best, so now it's your turn you will think with your own mind or like Mr. Shohel Bhuiyan. This is not a piactoill post , not even any personal post but this is how we think to take our country ahead and beware of people who are trying to mislead us.

HendersonHarm (not verified)

<p>In March 2001, the Commercial Court in Novi Sad granted one half of the requested sum to?<i>O.F.P.S.</i>, but on 20 September 2012 the Commercial Appellate Court annulled the verdict and ordered a retrial. Similar to the previous case where the Commercial Appellate Court ruled that O.F.P.S. had no valid claim to royalties for communication to the public of Italian sound recordings in a Belgrade restaurant.?<i>O.F.P.S.</i>?did not provide any evidence that it had entered into an agreement with a corresponding collecting society in Italy, by virtue of which it could collect royalties.</p>

AngelaOi (not verified)

Всем привет! Ребят если кому нужно Снять дома, коттеджи, частный сектор, квартиры, эллинги, пансионаты, номера люкс, в Феодосии, Коктебеле, Приморском, Береговом, Новом свете, обращайтесь всё напрямую и без замарочек пишите на почту feodosiya.koktebel@mail.ru отвечу Всем!