• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not parse nlsposts into XF

LPH

Well-known member
#1
Scenario
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:
Code:
[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.

Code:
$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.
 

LPH

Well-known member
#3
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.
 

LPH

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

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

LPH

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

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

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