Forums

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

User macro not working after upgrade to 7.12.3

Kathryn Reddie
Contributor
September 6, 2021

Hi experts,

We are experiencing a problem with a user macro not displaying icons after upgrading to 7.12.3 over the weekend.

A user macro that has always worked that displays an icon (that the user selects from another page and copies in the URL to), with text and a hyperlink to a page is now not displaying the icon.

Does anyone know why this might have stopped working?  Is there some config we need to do to enable this?  I've tried to see what I could find but am drawing a blank.

Details of behaviour below.

Thanks in advance.
Kathryn.

It is now displaying <img src="https://intranet.xxx.xxx.xx/download/attachments/3810922222/Document-red.png?version=1&amp;modificationDate=1455518232000&amp;modifcationDate=1455518232000&amp;api=v2' class='img-responsive'>  Forms & Email templates

The link is still working though.

Here's my user macro:

## @Param Title:title=Title|type=string|required=true
## @Param Subtitle:title=Subtitle|type=string|desc=Optional subtitle|required=false
## @Param page:title=Page, email or external URL|type=confluence-content|desc=External URL must start with https|required=false
## @Param IconLink:title=Icon|type=string|required=false|desc=Display a custom icon by entering the URL of the image. <a href="https://intranet.xxx.xxx.xx/display/XXX/Icon+suite+-+intranet+only" target="_blank"><b>View available icons</b></a>
## @Param TitleColor:title=Title colour|type=enum|enumValues=blue,gray,red|required=true|desc=Select colour for the title text|default=blue
## @Param Background:title=Background colour|type=enum|enumValues=blue,light-blue,gray|required=true|desc=Select a background colour|default=gray
## @Param IconAlign:title=Center align?|type=boolean|desc=Set center alignment. Unchecked will align left.|default=true


#set ( $colonIndex = $parampage.indexOf(":") )
#if ( $colonIndex == -1 )
#set ( $spaceKey = $space.key )
#set ( $pageName = $parampage )
#else
#set ( $spaceKey = $parampage.substring(0, $colonIndex) )
#set ( $pageNameIndex = $colonIndex + 1 )
#set ( $pageName = $parampage.substring($pageNameIndex) )
#end

## Get the Page object instance
#set ( $page = $pageManager.getPage($spaceKey, $pageName) )

## Get the URL path from the Page object instance
#if ($parampage.startsWith("https"))
#set ($pageLink = $parampage)
#elseif ($parampage.contains("@"))
#set ($pageLink = ("mailto:$parampage"))
#else
#set ($pageLink = $page.urlPath)
#end

#if ($paramIconAlign == false)
#set ($alignment = ("icon-left"))
#end

#if ($paramTitleColor == "red")
#set ($LinkColor = ("red-text"))
#elseif ($paramTitleColor == "gray")
#set ($LinkColor = ("gray-text"))
#else
#set ($LinkColor = ("blue-text"))
#end

#if ($paramIconLink)
#set ($Icon = ("<img src='$paramIconLink' class='img-responsive'>"))
#end

#if ($paramSubtitle)
#set ($subtitle = ("<span class='subtitle'>$paramSubtitle</span>"))
#end

<div class="icon-widget $paramBackground $LinkColor $!alignment">
#if ($parampage)
<a href="$pageLink">$!Icon<span>$paramTitle</span>$!subtitle</a>
#else
<a href="javascript&colon;void(0);">$!Icon<span>$paramTitle</span>$!subtitle</a>
#end
</div>

2 answers

0 votes
Francisco Villar Romasanta September 13, 2021

Try this fix, variables must contain html in the name otherwise the html will be escaped

https://community.atlassian.com/t5/Confluence-questions/HTML-is-not-parsed-from-a-User-Macro-in-Confluence-7-11-0/qaq-p/1618139

0 votes
Alexis Robert
Community Champion
September 7, 2021

Hi @Kathryn Reddie , 

 

there might be several reasons why the user macro stopped working. Ususally, to investigate this kind of issue I'd advise you to start Confluence in Safe Mode and check if the problem is still present. 

Then I would activate one by one the addons, because there might be a conflict with a specific new version that prevents your user macro from working.

 

Let me know if this helps, 

 

--Alexis

Kathryn Reddie
Contributor
September 7, 2021

Thanks Alexis,

I started in Safe Mode in our DEV environment, but the problem was still present.

Does that mean it's an issue with the new version of Confluence itself? 

Or should I delete and recreate the user macro?

Thanks again,
Kathryn.

Francisco Villar Romasanta September 13, 2021

(double comment, please delete)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events