getUserProfiledata($access_token); $accountid = get_user_meta($user_id, 'lr_raas_uid', true); if (isset($responseFromLoginRadius->Uid) && $accountid == $responseFromLoginRadius->Uid) { if ($submit == 'Submit') { $objectid = isset($lr_raas_custom_obj_settings['custom_obj_id']) ? $lr_raas_custom_obj_settings['custom_obj_id'] : ''; if (empty($accountid) || empty($objectid)) { return; } // Create Custom Object $data = array(); foreach ($lr_Custom_Obj_Fields as $field) { $data['field_' . $field] = isset($_POST['field_' . $field]) ? trim($_POST['field_' . $field]) : ''; } try { $loginRadiusCustomObject->upsert($objectid, $accountid, $data); } catch (\LoginRadiusSDK\LoginRadiusException $e) { error_log($e->getErrorResponse()->description); } } Login_Helper::lr_user_login($user_id, false); } }catch (\LoginRadiusSDK\LoginRadiusException $e) { $message = isset($e->getErrorResponse()->description) ? $e->getErrorResponse()->description : $e->getMessage(); error_log($message); // If debug option is set and Social Profile not retrieved Login_Helper::login_radius_notify($message, 'isProfileNotRetrieved'); return; } } } /** * * @global type $lr_Custom_Obj_Fields * @global type $loginRadiusCustomObject * @global type $lr_raas_custom_obj_settings * @global type $lr_js_in_footer * @param type $user_id * @return type */ function render_form($user_id) { global $lr_Custom_Obj_Fields, $loginRadiusCustomObject, $lr_raas_custom_obj_settings, $lr_js_in_footer; $access_token = isset($_REQUEST['token']) ? $_REQUEST['token'] : ''; $objectid = isset($lr_raas_custom_obj_settings['custom_obj_id']) ? $lr_raas_custom_obj_settings['custom_obj_id'] : ''; $accountid = get_user_meta($user_id, 'lr_raas_uid', true); if (empty($accountid) || empty($objectid)) { error_log('Custom Object Account ID or Object ID is not set'); return; } try { $response = $loginRadiusCustomObject->getObjectByAccountid($objectid, $accountid); } catch (\LoginRadiusSDK\LoginRadiusException $e) { // Create Custom Object $data = array(); foreach ($lr_Custom_Obj_Fields as $field) { $data['field_' . $field] = ''; } try { $loginRadiusCustomObject->upsert($objectid, $accountid, $data); try { $response = $loginRadiusCustomObject->getObjectByAccountid($objectid, $accountid); } catch (\LoginRadiusSDK\LoginRadiusException $e) { error_log($e->getErrorResponse()->description); return; } } catch (\LoginRadiusSDK\LoginRadiusException $e) { error_log($e->getErrorResponse()->description); return; } } // Custom Object Exists - Check Data wp_enqueue_script('jquery'); wp_enqueue_script('jquery-validater', '//ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js', array('jquery'), LR_PLUGIN_VERSION, $lr_js_in_footer); wp_enqueue_style('lr_custom_object.css', LR_ROOT_URL . 'lr-custom-object/assets/css/lr_customobject_style.css'); ?>