Hi Steven –
Thank you so much for writing up all the code snippets. I am sure we are pretty close now.
As you instructed, I replaced line 37 and removed the rest of my test code from manage.php. I activated the two code snippets based on the most recent versions you posted.
There appears to be a problem in loading the Infusionsoft code, which was working OK when called from inside the manage.php file.
When I use the code snippet as you wrote earlier, the page breaks – it only shows the admin sidebar plus the header “Connections: Add My Directory Entry”, with the form missing and the rest of the browser window blank.
When I leave out the Infusionsoft code, I can prepopulate the data using the info that comes from DAP for the logged in user. Hooray!
Here is the code that works well – it only relies on DAP info:
add_filter( 'cnl_admin_add_entry_object', 'cnl_alter_add_entry_object' );
add_filter( 'cnf_add_entry_object', 'cnl_alter_add_entry_object' );
function cnl_alter_add_entry_object( $entry ) {
// Add the filters necessary to save data in the cache.
add_filter( 'cn_email_cached', '__return_true' );
add_filter( 'cn_address_cached', '__return_true' );
include_once '/dap/dap-config.php';
if ( Dap_Session::isLoggedIn() ) {
$session = Dap_Session::getSession();
$user = $session->getUser();
$emailAddress = $user->getEmail();
$firstName = $user->getFirst_name();
$lastName = $user->getLast_name();
// Setup the name data to prepopulate.
$entry->setFirstName( $firstName );
$entry->setLastName( $lastName );
// Setup the email data to prepopulate.
$email = array();
$email[1] = array();
$email[1]['type'] = 'personal';
$email[1]['address'] = $emailAddress;
// Store the email address in the cache.
$entry->setEmailAddresses( $email );
// ACCESS USER INFO FROM INFUSIONSOFT API
include_once '/wp-content/plugins/connections-link/submenus/isdk.php';
// The following line causes an error, so it is commented out:
// $myApp = new iSDK;
// Remaining Infusionsoft code temporarily removed
}
return $entry;
}
In my earlier testing, I successfully placed and referenced the Infusionsoft API files (a few individual files plus an xmlrpc.3.0 directory) in the same submenus directory as the manage.php file. This is why the original include_once statement refers to the file locally:
include_once 'isdk.php';
The snippet breaks when the following line is called:
$myApp = new iSDK;
I tried modifying the line to:
include_once '/wp-content/plugins/connections-link/submenus/isdk.php';
but the snippet still breaks when the following line [$myApp = new iSDK;] is called.
Do you have any suggestions for where to place and how to reference the Infusionsoft API files successfully? Is there another directory that they should be placed into so that they function properly?
By the way, the snippet for outputting instructions does not appear to do anything. Is that because it isn’t called in Link 1.0.5 and will only be activated when I’ve got the beta set up?
Eric
-
This reply was modified 12 years, 2 months ago by
Eric Bobrow.
