Not parse nlsposts into XF


Well-known member
XenScripts WP to XF bridge is installed. Within the WP post is a tag which brings in more WP headlines. When posted, a copy of the WP post is made into the XF forum. This creates a problem because XF cannot interpret the tag. Therefore, I don't want that part to be posted in the forum.

The following is an example:
[nlposts tag="Debt Limit 2013"]
What is Known
The FAQ explains that using the plain tag around BB Code will stop it from parsing. This is not quite what is needed, so maybe there is a different solution.

This is a portion of the XS script to put the WP post into the forum.

$body = '';
        if($post_contains == 'full')
            $body = '[quote]' . XenForo_Helper_String::autoLinkBbCode(XenForo_Html_Renderer_BbCode::renderFromHtml(nl2br($content))) . "[/quote]";
Can this be function above be written to strip out the nlspost tag?

Can a helper string be written to do this? (I've never done this before !). This thread seems like some help on creating the string.


Well-known member
Oh my. You are the champion. There were two places to put in that code and it works wonders if tag= is the only part of the code.

Now I have to figure out what to do if there is blog_id= as well as time_frame= are used....

I'm looking at your link right now to try to understand what you did and see if I can recreate it for the other options.


Well-known member
OK. What am I doing wrong here?

$body = preg_replace('/[nlposts .*/', '', $body);
My understanding is that the .* is any pattern after the nlposts ...


Well-known member
Oh !!! I think I understand !!

This seems to work. This means anything between the #, escape out the square brackets, the .* means anything after ... correct?

$body = preg_replace('#\[nlposts .*\]#', '', $body);