XF 2.2 Is it possible to add to postbit -> if message contains text/link ?


Well-known member
We've been advised that under FTC rules we need to specify that affiliate links in posts need to be explicitly identified near to the link placement.

Is it possible, using the XF template system, to add a conditional that works along the lines of ... if message contains text (retailer name) -> add (affiliate message) to the bottom of the postbit.

This way we can put the message only where the links are present - giving transparency to visitors and members and properly adhering to FTC rules - but without blamming affiliate messages over every page of the site.

Any assistance much appreciated.
As far as I know, this would require an add-on. It's not a simple template edit you could do.

You could use custom thread fields to show a text field in the first post "this thread contains affiliate links" but it would only show in the default custom fields area (above/below first thread message as an example). Obviously, this would need to be manually checked.
Thanks @Brogan - we did manage to do it with the built-in advertising option using Thread view: Above message list but it's global and there aren't any controls to denote which nodes to display it on.

We ended up using Siropu's add-on and creating a new ad-position at the top of the message block, but under the navigation.
Hmmm not seeing them - the only options on the advertisement are which usergroups to display it to (or not). Whereabouts do you define included/excluded nodes?
In the template using conditionals for the templating.
There may be a 2.x version of this... but a lot of this still applies.

As an example... if you have multiple nodes, this would be an example of what worked in the 1.x days.
<xen:if is="in_array({$forum.node_id}, array(x, y, z))"> would be to only display in that array.
I do think some of the templating formatting has changed, but I'm sure Brogan can point you to the most current.
Thanks @Tracy Perry - so that would be in the thread_view template, wrapped around the template code that pulls the advert in?
Pretty sure that you can use the advertisement placement templates for XF 2.0 that would be appropriate and target the specific nodes you want it displayed in, as long as you didn't use it for actual ads.
If not using the advertisement placement, then it would most likely be the thread_view template.
Will the affiliate links always be in the first message of a thread or can they be in the replies as well?

Yes, in replies too and across multiple brands, keywords, and pages of each thread. The initial idea was to “search” a post message for links then add the notice to each postbit - on the basis that only a few posts per page contain them; but the single top-of-page solution seems to be working out okay and doesn’t spoil the layout or UX.
Top Bottom