Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to know if a page is favourite using the pageId????

liljoint
Contributor
May 28, 2012

can I know this???

no one can help me???

4 answers

1 accepted

3 votes
Answer accepted
Remo Siegwart
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 3, 2013

We usually use the following simple user macro:

## @param PageId:title=Page Id|type=int|required=true|desc=The ID of the page

#set ( $Integer = 0 )
#set ( $pageId = $Integer.parseInt($paramPageId) )
#set ( $page = $pageManager.getPage($pageId) )

Is favourite? $page.isFavourite($action.remoteUser)

Hope this helps

3 votes
Azwandi Mohd Aris
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2012

You can do this via database:

select * from content_label where labelid IN (select labelid from label where namespace = 'my' AND name = 'favourite') AND contentid = INSERT-PAGE-ID-HERE;

Remember to change the INSERT-PAGE-ID-HERE accordingly.

If there is no row returned, page is not favourited.

1 vote
Sandro Herrmann [Communardo]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2012

Or you write a little usermacro which you can use on every page

## @param pageId:title=pageId|type=int|required=true|desc=Insert the pageId
#set($Integer = 0)
#set($parampageId = $Integer.parseInt($parampageId))

#set($pageById = $pageManager.getAbstractPage($parampageId))

#if($pageById)
    #foreach( $label in $pageById.labels)
        #if($label == "my:favourite")
            #set($isFavourite = true)
            #break
        #end    
    #end
    This page is #if(!$isFavourite) not #end a favourite page.
#else
    No page found!
#end

SubasreeN November 27, 2012

Is there anyway to find whether a page is favorited with a single velocitymethod. Since $helper.action.favouritePage is deprecated

0 votes
MatthewC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2012

both good answers ;-)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events