• Resolved maxpontello

    (@maxpontello)


    Hello,

    I noticed a problem running a postie_post_after filter when the emails are fetched via get_mail.php.

    I use Postie 1.5.16 with WP 3.6.1 to post emails from a gmail account every hour. The cron job runs a wget calling the get_mail.php program.

    The filter is meant to setup language variables for another plugin (ceceppa multilanguage).

    Anyway, when I run postie from the “Run Postie” button, the filter runs properly. The other postie_post_before filters run perfectly in both cases.

    Do you have any idea?

    http://ww.wp.xz.cn/plugins/postie/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Wayne Allen

    (@wayneallen-1)

    That is very strange as the same code runs in both cases. Do you mind sharing the addon you’ve created? Please email [email protected]

    Thread Starter maxpontello

    (@maxpontello)

    Hello,

    this is my filterpostie.php

    add_filter('postie_post_after', 'add_def_lang');
    
    function add_def_lang($post) {
        $link = mysql_connect(':/var/run/mysqld/mysqld.sock', 'wordpress', '*******');
            if (!$link) {
    			die('Could not connect: ' . mysql_error());
            }
            mysql_select_db('wordpress', $link) or die('Could not select database.');
            $res = mysql_query('INSERT INTO wp_postmeta (post_id,meta_key,meta_value) VALUE ('.$post['ID'].',"_wplp_post_front",1)');
            $res = mysql_query('INSERT INTO wp_ceceppa_ml_posts (cml_post_lang_1,cml_post_id_1,cml_post_lang_2,cml_post_id_2) VALUE (1,'.$post['ID'].',0,0)');
            $res = mysql_query('UPDATE wp_options SET option_value=1 WHERE option_name="cml_page_lang_'.$post['ID'].'"');
            mysql_close();
        return $post;
    }

    the multilanguage plugin is http://ww.wp.xz.cn/plugins/ceceppa-multilingua/

    Thank you
    -max

    Thread Starter maxpontello

    (@maxpontello)

    Hello,

    I found that the problem was related to the other plugin.
    Today I got an update from the developer, with a dedicated function that works with both Postie debug and get_mail.php.

    function add_def_lang($post) {
     if(function_exists('cml_set_language_of_post')) {
                    $lang = 1;
                    cml_set_language_of_post( $post['ID'], $lang );
                    EchoInfo('Post ID: '.$post['ID'].' Language set to: '.$lang);
        }
        return $post;
    }

    Regards
    -max

    Plugin Author Wayne Allen

    (@wayneallen-1)

    Thanks for the update.

    i have same problema, but i using filterpostie.ph but not work with cron,
    if i run posti manual all ok, but if i run automatic with cron the new post don’t have set language…

    can you help me?

    If you require assistance then, as per the Forum Welcome, please post your own topic instead of tagging onto someone else’s topic.

    I am now closing this 9 month old resolved topic as it references an older version of WordPress.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘postie_post_after and get_mail.php’ is closed to new replies.