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

can I know this???

no one can help me???

4 answers

1 accepted

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

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.

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))

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

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

both good answers ;-)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

1,785 views 25 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you