Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $entry = EasyContactFormsClassLoader::getObject('CustomFormsEntries', TRUE, $id);
- $content = $entry->get('Content');
- $xml = simplexml_load_string($content);
- /************************************************************************************************
- *
- * Added this section to load contact information into the contact since the plug-in doesn't do it by default
- *
- ***********************************************************************************************/
- $load_user_info = array();
- foreach($xml->div as $div) {
- $id = $div->attributes()->id;
- $fld = EasyContactFormsClassLoader::getObject('CustomFormFields', true, $id);
- $load = $fld->get('Settings');
- $fxml = new EasyContactFormsSimpleXML($load);
- $loadapp = (string) $fxml->LinkToAppField;
- switch ($loadapp) {
- case 'Users_Name':
- case 'Users_Description':
- case 'Users_email':
- $load_user_info[str_replace('Users_', '', $loadapp)] = (string) $div->h1;
- break;
- default:
- }
- }
- /************************************************************************************************
- *
- * END: Added section to load contact information into the contact since the plug-in doesn't do it by default
- *
- ***********************************************************************************************/
- $userid = (string) $xml->attributes()->userid;
- $userid = empty($userid) ? NULL : intval($userid);
- if (empty($userid)) {
- $users = EasyContactFormsClassLoader::getObject('Users');
- $user = $users->getEmptyObject($newobjectmap);
- $siteuserid = $entry->get('SiteUser');
- $siteuserid = empty($siteuserid) ? NULL : $siteuserid;
- if (!is_null($siteuserid)) {
- $usrquery = "SELECT
- user_login AS username,
- user_email AS email,
- display_name AS name
- FROM
- #wp__users
- WHERE
- ID='$siteuserid'";
- $susr = EasyContactFormsDB::getObjects($usrquery);
- $susr = $susr[0];
- $susrname = !empty($susr->name) ? $susr->name : $susr->username;
- if (empty($susrname)) {
- $user->set('Description', $susrname);
- }
- if (empty($susr->email)) {
- $user->set('email', $susr->email);
- }
- $user->set('CMSId', $siteuserid);
- } else { //added Else statment here to set the contact information being gathered, with the three lines below.
- foreach($load_user_info as $kluo=>$luo) {
- $user->set($kluo, $luo);
- }
- } //end of added Else statement
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement