I am using Robin Sewell’s forum_fill extension. It works beautifully for me (thank you, Robin), but I need to modify the logic for creating the text that gets copied from my weblog entry into the content of my forum topic post. I already have this logic working in an EE template that displays the weblog entry on a single page; I then use the same logic that EllisLabs uses for their own blog, with a “Discuss This Post” link to my forums, where I want discussion to be driven. I need a line of the logic in my template to be executed in the forum_fill extension so that I end up with two additional data elements (“channel” and “author”) being put into the forum topic before the main body content (“description”). I then need a blank line to follow the body before adding the “Read the original” which is the backlink to my weblog entry. Unfortunately, because I don’t know PHP, I don’t know how to translate my template logic into PHP.
As I understand this, Robin builds a “post” currently that consists of forum_title, forum_id, and forum_body, and then a backlink ($linkage). But I need a bit more from my weblog: I need it to become a post that consists of forum_title, forum_id, channel, author, a blank line, forum_body, a blank line, and $linkage.
Here’s the template logic I need to put into Robin’s PHP code:
{related_entries id="item_source"}{if no_related_entries} {/if}
Channel:<i> {title} </i> {/related_entries}
{if item_author} Author: {item_author} {/if}
Here’s what I believe to be the relevant part of Robin’s extension, as already modifed for my site:
class Forum_fill
{
var $settings = array();
var $name = 'Automated Forum Filler';
var $version = '1.0.0';
var $description = 'Creates forum data from weblog post';
var $settings_exist = 'n';
var $docs_url = 'http://media-cow.com/';
// -------------------------------
// Constructor - Extensions use this for settings
// -------------------------------
function Forum_fill($settings='')
{
$this->settings = $settings;
}
// END
function forum_data()
{
global $IN;
$linkage = "\nView the <a >original post</a>";
if ($IN->GBL('weblog_id', 'POST') == 4)
{
$_POST["forum_title"] = $IN->GBL('title', 'POST');
$_POST["forum_id"] = 8;
$_POST["forum_body"] = $IN->GBL('field_id_6', 'POST').$linkage;
}
elseif ($IN->GBL('weblog_id', 'POST') == 6)
{
$_POST["forum_title"] = $IN->GBL('title', 'POST');
$_POST["forum_id"] = 3;
$_POST["forum_body"] = $IN->GBL('field_id_15', 'POST').$linkage;
}
elseif ($IN->GBL('weblog_id', 'POST') == 8)
{
$_POST["forum_title"] = $IN->GBL('title', 'POST');
$_POST["forum_id"] = 4;
$_POST["forum_body"] = $IN->GBL('field_id_15', 'POST').$linkage;
}
elseif ($IN->GBL('weblog_id', 'POST') == 9)
{
$_POST["forum_title"] = $IN->GBL('title', 'POST');
$_POST["forum_id"] = 8;
$_POST["forum_body"] = $IN->GBL('field_id_15', 'POST').$linkage;
}
return;
}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.