WordPress.org

Ready to get started?Download WordPress

Forums

Postie
[resolved] postie_post_after and get_mail.php (5 posts)

  1. maxpontello
    Member
    Posted 7 months ago #

    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://wordpress.org/plugins/postie/

  2. Wayne Allen
    Member
    Plugin Author

    Posted 7 months ago #

    That is very strange as the same code runs in both cases. Do you mind sharing the addon you've created? Please email postie-help@devzing.com

  3. maxpontello
    Member
    Posted 7 months ago #

    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://wordpress.org/plugins/ceceppa-multilingua/

    Thank you
    -max

  4. maxpontello
    Member
    Posted 7 months ago #

    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

  5. Wayne Allen
    Member
    Plugin Author

    Posted 7 months ago #

    Thanks for the update.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.