Can’t get SafeCracker to work locally on MAMP.
Posted: 28 October 2010 04:09 PM   [ Ignore ]
Wallflower
Rank
Total Posts:  5
Joined  2010-08-31

Hi-

I have tried to get SC working on a local install running MAMP PRO; (PHP Ver: 5.2.13 | MySQL Ver: 5.1.44 | EE 2.1.1 - 20101020).
However it is giving this error..

A PHP Error was encountered
Severity
Notice
Message
Undefined propertyEE::$api_channel_fields
Filename
libraries/Safecracker_lib.php
Line Number
925

[28
-Oct-2010 21:58:00] PHP Fatal error:  Call to a member function set_settings() on a non-object in /Sandbox/EE/system/expressionengine/third_party/safecracker/libraries/Safecracker_lib.php on line 925 

Testing on a clean install.

Any thoughts?

Cheers
Lee

[ Edited: 28 October 2010 04:17 PM by greendesigned_ ]
Profile
 
 
Posted: 28 October 2010 07:15 PM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Do you have the latest build of SC? 20101026

Profile
 
 
Posted: 28 October 2010 07:21 PM   [ Ignore ]   [ # 2 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

If you do, indeed, have the latest SC build, this should fix it:

find this line near the top of the submit_entry function in /system/expressionengine/third_party/safecracker/libraries/safecracker_lib.php

$this->EE->load->library('api'); 

And add this line right below it:

$this->EE->api->instantiate('channel_fields'); 
Profile
 
 
Posted: 29 October 2010 12:52 AM   [ Ignore ]   [ # 3 ]
Wallflower
Rank
Total Posts:  5
Joined  2010-08-31

The SAEF is no longer throwing an error; however, no data is making it to the db. I am testing with only a title / url title / date.

Even a regular EE SAEF is not functioning.  I may have to chase this one up over at the EE support forum.

Thanks for looking into it Rob.

Profile
 
 
Posted: 29 October 2010 01:05 AM   [ Ignore ]   [ # 4 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

So what’s happening when you submit with a regular SAEF? Does it throw any errors? Or just redirects you like normal? I use MAMP BTW.

Profile
 
 
Posted: 29 October 2010 01:27 AM   [ Ignore ]   [ # 5 ]
Wallflower
Rank
Total Posts:  5
Joined  2010-08-31

Actually.. a basic EE SAEF worked…

Trying SafeCracker again on the fresh install -

A PHP Error was encountered
Severity
Notice
Message
Undefined propertySafecracker_lib::$localize
Filename
libraries/Safecracker_lib.php


Line Number
975
A PHP Error was encountered
Severity
Notice
Message
Trying to get property of non-object
Filename
libraries/Safecracker_lib.php
Line Number
975


A PHP Error was encountered
Severity
Warning
Message
Cannot modify header information headers already sent by (output started at /Sandbox/EE/system/codeigniter/system/core/Exceptions.php:171)
Filenamelibraries/Functions.php
Line Number
387 

Using latest SafeCracker + added mentioned line of code.

Profile
 
 
Posted: 29 October 2010 01:45 AM   [ Ignore ]   [ # 6 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Ah, you’ve found a bug.

Line 975:

$_POST[$field] $this->EE->localize->set_human_time($this->EE->localize->offset_entry_dst($this->localize->now$this->EE->input->post('dst_enabled'), FALSE)); 

Should be

$_POST[$field] $this->EE->localize->set_human_time($this->EE->localize->offset_entry_dst($this->EE->localize->now$this->EE->input->post('dst_enabled'), FALSE)); 
Profile
 
 
Posted: 29 October 2010 02:00 AM   [ Ignore ]   [ # 7 ]
Wallflower
Rank
Total Posts:  5
Joined  2010-08-31

Thanks Rob! All working now.

Profile