Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-11-27 12:39:58

giampablo
Member
From: Italy
Registered: 2008-07-17
Posts: 86
Website

Integrating a Textpattern blog and a phpBB forum (plugin request)

The new plugin should automatically create new topics in the (external) phpBB forum for every new post in my blog.

Ideally the plugin should provide:
  • a txp tag for displaying the current number of responses to the post in the forum and
  • a quick link to the forum thread for reading the discussion, (where registered forum users can add a reply), and also
  • a txp tag to display recent forum responses in the sidebar or at the bottom of the article.

My need is to replace completely the textpattern comments system, letting the discussion happen only on the forum.
A bridge between textpattern and forum subscription systems is not required.

Offline

#2 2016-11-27 16:29:27

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,702
Website

Re: Integrating a Textpattern blog and a phpBB forum (plugin request)

I’m not sure about the first part; that may require a plugin for phpBB rather than for txp. For the second and third parts there are some options:

  • rah_swap allows you to temporarily swap database connections from within txp to draw in information from another database. Together with smd_query, you can use that to access specific information and display it on your txp site. I use this, for example, to query a member database based on vanilla forum. As far as I recall, both databases need to be on the same server account.
  • I’m pretty certain phpBB offers a feed for new forum responses. Does it also provide a feed per forum thread? If so, you could use smd_xml to process the feed responses like comments at the bottom of the article.

If you changed your concept around so that your topics are authored in the phpBB forum in the first place, rather than in txp and then copied over, you could use a combination of the above to present output from the forum in a section of your txp site. The end result would be similar if not identical.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2016-11-27 18:20:53

giampablo
Member
From: Italy
Registered: 2008-07-17
Posts: 86
Website

Re: Integrating a Textpattern blog and a phpBB forum (plugin request)

Ok. I will investigate if phpBB has such a plugin.

If you changed your concept around so that your topics are authored in the phpBB forum in the first place, rather than in txp and then copied over, you could use a combination of the above to present output from the forum in a section of your txp site. The end result would be similar if not identical.

I could consider above option. I preview some problems, by the way, i.e. textile formatting? Article image?
So I guess it is harder to get an automatism this way, while from txp to phpBB it can be done, maybe. I know that in wordpress such a plugin exists (even if obsolete and not supported anymore…)

Offline

#4 2016-11-27 20:03:27

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,702
Website

Re: Integrating a Textpattern blog and a phpBB forum (plugin request)

My alternative suggestion was to write the article in phpBB forum and then display that in your textpattern site. You don’t need to actually duplicate the article in textpattern, just display the phpbb article in the context of your textpattern site. I’m not sure that an article image is then relevant. You’d need to see how images are communicated as part of the phpbb database or forum feed.

Either way, if you need to textile other text, you can use <txp:smd_wrap transform="textile">…</txp:smd_wrap>.

Example: the search mask and list on www.dachverband-lehm.de/firmen as well as the individual profile pages of the members are all sourced directly from a parallel forum database. The templates are in textpattern but none of the data is duplicated in textpattern. In my case direct database access was best, but an xml feed would also work for sourcing a series of articles from a forum. vanilla has/had a textile plugin, so I use smd_wrap to textile the output.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2019-07-12 11:43:33

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: Integrating a Textpattern blog and a phpBB forum (plugin request)

This thread is a little bit older, but anyway. With textpattern 4.7.3 and phpbb 3.2.7 the following integration is possible.

As jakob mentioned, there is a RSS feed for every thread and one can use smd_xml to read RSS feeds and manipulated the data. It’s probably also possible to use mka_simplepie or etc_query for this purpose.

In any case you have to activate forum feeds in the administration area (/adm/index.php?i=acp_board&mode=feed).

After that you’ll get your feeds under these urls:
/feed/topic/THREAD_ID

You can now use this THREAD_ID in a custom_field named for example threadid. I post all my textpattern articles with the Feed post bot to a forum in my board. After that I add this thread id to the appropriate article. And use it in the article form in the following way:

<div>

   <txp:variable name="forumcomments"><txp:smd_xml data='FORUM_URL/feed/topic/<txp:custom_field name="threadid" />' record="entry" fields="updated, name, id, link, content" limit="2" cache_time="1" transform="replace|%<entry><author><name><\!\[CDATA\[RSS-POSTER[\s\S]+?<\/entry>%">{id}</txp:smd_xml></txp:variable>

     <txp:if_variable name="forumcomments" value="">
          <p>
                <a class="comment" href="FORUM_URL/posting.php?mode=reply&f=FORUM_ID&t=<txp:custom_field name='threadid' />" title="Forum: <txp:title no_widow='0' />">Write the first comment in our forum</a>
          </p>

     <txp:else />
          <txp:smd_xml
          data='FORUM_URL/feed/topic/<txp:custom_field name="threadid" />'
          record="entry" fields="updated, name, id, link, content" format="updated|date|%H:%I:%S %d.%m.%Y"
          wraptag="div" class="comment" limit="15" cache_time="600" transform="replace|%<entry><author><name><\!\[CDATA\[RSS-POSTER[\s\S]+?<\/entry>%">

                <div class="comment">
                   <a class="comment" href="{id}" title="{name} wrote in &bdquo;<txp:title no_widow='0' />&ldquo;">
                   <span class="author">{name}</span></a>  
                   <p class="comment">{content}</p>
                </div>
          </txp:smd_xml>

          <p>
                <a class="button" href="FORUM_URL/posting.php?mode=reply&f=FORUM_ID&t=<txp:custom_field name='threadid' />" title="Forum comment: <txp:title no_widow='0' />">Write a comment in our forum</a>
          </p>

     </txp:if_variable>

</div>

Explaining:
First it tests the RSS-Feed, if there are more than one posts. If there is only the first automatically by a bot made post, than readers are invited to write the first comment. For all others the existing replies are shown and the readers are invited to comment it further. Everything is cached for 10 minutes.

RSS-POSTER is this case the nick of the RSS bot and filtered out, so that there are only the replies shown.

Entries in these thread RSS and also other topic RSS have the following items: name, author, updated, published, id, link, title, content. Where content is the post, id the url, and name is the author’s name.

Ideally I would prefer a plugin like arc_twitter which is writing every textpattern article directly to the board and after that writing the THREAD_ID to the custom_field of this new textpattern article, but that’s probably to difficult to realize.
The second variant would be enhancing this Feed Bot extension in this way, that after posting the article to the board it adds the THREAD_ID to the appropriate article’s custom_field.

Offline

Board footer

Powered by FluxBB