2 afwas Aug 11, 2008 01:32

There are mails in the mailbox. So something else is going on. If I run the check from Global Settings->Features then the posts end up on the blog.
How does $current_User get set when getmail.php is run from cron?
Does it extract that from the email?
The email should start with:
User:pass
With your login and password. That is the $current_User. The post will be assigned to that user as author.
So if everything is correct there should not be this error.
It works fine from the admin menu.
It won't work when getmail.php is run from cron.
I would expect that would be a clue, but I don't know enough about b2 to figure out where the chain of events is breaking down. My hunch is that it has to do with how that variable gets passed. A different code path perhaps.
Maybe someone can point me in the right direction? I just don't know enough about b2 yet to know where to start looking. Is it a config issue? i.e. a user level problem?
My compass needle is spinning around and have no idea which way to turn. (^: GPS signal no good either.
I'm learning some PHP. But in reverse, sort of....
I placed some fwrites and coupled with parsing over $GLOBALS and using print_r I was able to capture what "state" things were in when the cron job ran. I wrote the output to a file (it ended up in the cron/ dir)
So once _param.funcs.php ran I got lots of output into the log file.
(The log file was 240kB of GLOBALS)
current_User was empty, no big surprise.
[current_User] =>
Also in the globals were all the emails in the pop account. So everything looks fine except that current_User is not defined. How/where/when does that happen? I would guess it's derived from the email but that's not happening.
Feel free to chime in if you think you know what's going on. (^:
Okay I had seen this thread before, but I didn't see the last post which was on page 2! <sound of slapping forehead>
http://forums.b2evolution.net/viewtopic.php?t=13891
So maybe this is all fixed, I'll soon find out.
This diff allows for a ":" in the user_pass. Hope this is appropriate for this group. Apologies if it should go somewhere else.
--- getmail.1.php 2008-08-14 11:54:47.000000000 -0700
+++ getmail.php 2008-08-14 11:53:13.000000000 -0700
@@ -559,7 +559,8 @@
echo_message( T_( 'Message content:' ) . '<code>' . htmlspecialchars( $content ) . '</code>', INFO, 3, true );
$user_login = trim( $a_authentication[0] );
- $user_pass = @trim( $a_authentication[1] );
+ $user_pass = substr( $a_body[0], ( strpos( $a_body[0], ':' ) + 1 ) );
+ $user_pass = @trim($user_pass);
echo_message( T_( 'Authenticating user' ) . ': ' . $user_login, INFO, 3, true );
// authenticate user
I had gotten getmail.php working for my situation after first upgrading to 2.4.1....but evidently I never used the functionality again until recently....to find that it had stopped working. Not sure if it was 2.4.2 or 2.4.5 that broke it.
But, I got it working again....I changed $loop_User to $current_User
The Dreamer
The 'non-object' here is $current_User. It is called but most likely empty. I suppose you ran getmail.php without an email being present to be processed. Anyway this is a bug because this should be caught with a normal message "No email found" in stead of throwing an error.