WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. maxpontello
    Member
    Posted 10 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 10 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 10 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 10 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 10 months ago #

    Thanks for the update.

  6. rosariobocca
    Member
    Posted 1 month ago #

    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?

  7. esmi
    Forum Moderator
    Posted 1 month ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.