I need to create some conditional logic in a php extension that goes like this:
If the weblog entry status is “open” then “do what follows.” I have pasted the current code of the function below. It currently gathers data from the database on the creation of any weblog entry no matter the status and then creates a Forum post.
The logic I need in php is to do this ONLY WHEN THE STATUS IS SET TO “OPEN.” That way it won’t do it if the status is “Review.”
I don’t know how to code in php. Any help is much appreciated.
function forum_data()
{
global $IN;
$linkage = "\nView the <a >full 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;
}
[Mod edit: moved to Extension Technical Support forum]
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.