Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter subash1990

    (@subash1990)

    I am facing fatal error, can you help this,

    PHP Fatal error: Uncaught Error: Call to undefined function ASDK()

    How to solve this

    Thread Starter subash1990

    (@subash1990)

    Now is form is working, and the Form registration is successful, but I don’t want those who applied repeatedly in the same email. How to fix this, My code is mentioned below.

    use AlexaCRM\CRMToolkit\Settings;
        use AlexaCRM\CRMToolkit\Client as OrganizationService;
    
    //function for processing submitted data
        add_filter('wordpresscrm_shortcodes', 'changemode', 7, 1);
    
        function changemode($shortcodes) {
    	session_start();
        $contactid='';
    	if (isset($_SESSION['contactid'])) {
    	    $contactid = $_SESSION['contactid'];
    	}
    
    	if (isset($_POST['entity']) && !empty($_POST['entity']['emailaddress1'])) {
    	    $options = [
    		'serverUrl' => ASDK()->settings->serverUrl,
    		//'username' => ASDK()->settings->username,
    		//'password' => ASDK()->settings->password,
    		'authMode' => ASDK()->settings->authMode,
    	    ];
    	  //  $serviceSettings = new Settings($options);
    	   // $service = new OrganizationService($serviceSettings);
           $service = ASDK();
    	    $out = $service->retrieveMultiple('<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">' .
    		    '<entity name="contact">' .
    		    '<all-attributes />' .
    		    '<order attribute="fullname" descending="false" />' .
    		    '<filter type="and">' .
    		    '<condition attribute="emailaddress1" operator="eq" value="' . $_POST['entity']['emailaddress1'] . '" />' .
    		    '</filter>' .
    		    '</entity>' .
    		    '</fetch>');
    	    $count = $out->Count;
           // echo '<pre>';print_r($out);die;
    	    if ($count) {
                if (!$contactid) {
                    if (($out->Entities[0]->propertyValues['syn_isdeleted']['Value'] == 0) && ($out->Entities[0]->propertyValues['syn_isvalidated']['Value'] == 1)) {
                    wp_redirect(getHomeUrl() . '/message');
                    exit;
                    } else {
                    ACRM()->request->query->set('id', $out->Entities[0]->propertyValues['contactid']['Value']);
                    }
                }
    	    }
    	}
    	return $shortcodes;
        }
    Thread Starter subash1990

    (@subash1990)

    ok thanks, now it is working fine

    Thread Starter subash1990

    (@subash1990)

    I am using the Dynamic 365 plugin, recently I switch to OAuth2.0, and Now some issues occur with username and password. I have attached my old custom code, can you please help me, with how to change it as per the latest Oauth method code? This code’s purpose avoid multiple duplicate entries (Email already exists when registered)

    use AlexaCRM\CRMToolkit\Settings;
        use AlexaCRM\CRMToolkit\Client as OrganizationService;
    
    //function for processing submitted data
        add_filter('wordpresscrm_shortcodes', 'changemode', 7, 1);
    
        function changemode($shortcodes) {
    	session_start();
    	if (isset($_SESSION['contactid'])) {
    	    $contactid = $_SESSION['contactid'];
    	}
    	if (isset($_POST['entity']) && !empty($_POST['entity']['emailaddress1'])) {
    	    $options = [
    		'serverUrl' => ASDK()->settings->serverUrl,
    		'username' => ASDK()->settings->username,
    		'password' => ASDK()->settings->password,
    		'authMode' => ASDK()->settings->authMode,
    	    ];
            
    	    $serviceSettings = new Settings($options);
    	    $service = new OrganizationService($serviceSettings);
            
    
    	    $out = $service->retrieveMultiple('<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">' .
    		    '<entity name="contact">' .
    		    '<all-attributes />' .
    		    '<order attribute="fullname" descending="false" />' .
    		    '<filter type="and">' .
    		    '<condition attribute="emailaddress1" operator="eq" value="' . $_POST['entity']['emailaddress1'] . '" />' .
    		    '</filter>' .
    		    '</entity>' .
    		    '</fetch>');
    	    $count = $out->Count;
    
    	    if ($count) {
    		if (!$contactid) {
    		    if (($out->Entities[0]->propertyValues['syn_isdeleted']['Value'] == 0) && ($out->Entities[0]->propertyValues['syn_isvalidated']['Value'] == 1)) {
    			wp_redirect(getHomeUrl() . '/message');
    			exit;
    		    } else {
    			ACRM()->request->query->set('id', $out->Entities[0]->propertyValues['contactid']['Value']);
    		    }
    		}
    	    }
    	}
    	return $shortcodes;
        }
    • This reply was modified 3 years, 7 months ago by subash1990.
Viewing 4 replies - 1 through 4 (of 4 total)