We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

PHP help need to do a conditional based on weblog entry status

Development and Programming

craiguffman's avatar
craiguffman
100 posts
16 years ago
craiguffman's avatar craiguffman

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]

       
craiguffman's avatar
craiguffman
100 posts
16 years ago
craiguffman's avatar craiguffman

I will make a PayPal contribution to the one who gives me the code I need to make this fix. Please respond!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.