Recent Topics

1 Feb 13, 2015 06:14    

I am trying to implement posting by email and am running into an issue running the Create Post By Email scheduled task. The task starts fine, then hangs and times out. I have the cron job sending me emails when the job is run to see why it is not running properly. The error being returned is:

Fatal error: Call to a memeber function get() on a non-object in {path}/inc/users/model/_user.funcs.php on line 2227

Line 2227 is:

$limit = $UserSettings->get( $limit_setting, $user_ID );

Here is the corresponding block of code:

/**
 * Check if user can receive new email today with the given email type or the limit was already exceeded
 *
 * @param string the name of limit/day setting
 * @param string the name of the last email setting
 * @param integer the user ID
 * @return integer/boolean Number of next email counter if new email is allowed, false otherwise
 */
function check_allow_new_email( $limit_setting, $last_email_setting, $user_ID )
{
	global $UserSettings, $servertimenow;

	$limit = $UserSettings->get( $limit_setting, $user_ID );
	if( $limit == 0 )
	{ // user doesn't allow this kind of emails at all
		return false;
	}

	$email_count = 0;
	$last_email = $UserSettings->get( $last_email_setting, $user_ID );
	if( !empty( $last_email ) )
	{ // at least one email was sent
		$current_date = date( 'Y-m-d', $servertimenow );
		list( $last_email_ts, $last_email_count ) = explode( '_', $last_email );
		$last_date = date( 'Y-m-d', $last_email_ts );
		if( $last_date == $current_date )
		{ // last email was sent today
			if( $last_email_count >= $limit )
			{ // the limit was already reached
				return false;
			}
			$email_count = $last_email_count;
		}
	}

	$email_count++;

	return $email_count;
}

I am not very familiar with php and am at a loss as to where to start to get this fixed. On the remote publishing tab, I can connect to the server fine and simulate posting with no issues. But I cannot get the scheduled task to work.

Thanks

2 Feb 14, 2015 01:25

What version of b2evolution are you running?

3 Feb 14, 2015 01:28

I am running 5.2.1

4 Feb 14, 2015 01:32

OK we'll dig into that.


Form is loading...