Hi all,
Before upgrading to Confluence v 5.10.5, my two custom User Macros worked fine. Here is the code of one of them:
## Macro name: number-of-comments
## Visibility: Visible only to system administrators in the Macro Browser
## Macro title: Number of comments
## Description: Returns the number of comments for a given page
## Categories: Confluence content, Reporting
## Macro body processing: No macro body
##
## Developed by: Nicolas Casel
## Date created: 03.07.2016
## Installed by: Nicolas Casel
## @param PageID:title=Page ID|type=int|required=false|desc=ID of page to count comments
##
## Check for page id parameter, otherwise use default of current page
#if (!$paramPageID)
#set ($paramPageID=$content.id)
#end
##
#set( $containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager') )
#set( $getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null) )
#set( $containerManager=$getInstanceMethod.invoke(null,null) )
#set( $containerContext=$containerManager.containerContext )
#set( $pageManager=$containerContext.getComponent('pageManager') )
#set( $commentManager=$containerContext.getComponent('commentManager') )
##
#set ($targetPage = $action.page)
## Set up integer object to handle string conversion of page id
#set($Integer = 0)
##
#if ($pageManager)
#set ($targetPage = $pageManager.getPage($Integer.parseInt($paramPageID)))
#end
##
#set($count = $commentManager.countComments($targetPage))
#if ($commentManager)
##<span class="commentcount">$count</span>
<aui-badge style="background-color: #d04437; color: white;">$count</aui-badge>
#end
#end
Since Confluence v 5.10.5, I get this message:
Error rendering macro 'number-of-comments' : Error occurred rendering template content
Any idea of the reason? Thank you!
Community moderators have prevented the ability to post new answers.
The easiest way to see what is wrong is to look in the log file <confluence_home_directory>/logs/atlassian-confluence.log. Whenever it shows an "Error occurred rendering template content", there will be an accompanying entry in the log file with more details.
One thing you might try is to change
#set ($targetPage = $action.page)
to
#set ($targetPage = $content)
The easiest way to see what is wrong is to look in the log file <confluence_home_directory>/logs/atlassian-confluence.log
Thanks for this insight.
In this case, I found the solution: removing the last:
#end
(last line)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.