Explorar o código

Ticket #4971 - Build-in API support: Create profile without autocreation

romanlesnikov hai 1 ano
pai
achega
4f16ba2b88
Modificáronse 1 ficheiros con 16 adicións e 1 borrados
  1. 16 1
      template/scripts/BxBaseServiceAccount.php

+ 16 - 1
template/scripts/BxBaseServiceAccount.php

@@ -69,7 +69,22 @@ class BxBaseServiceAccount extends BxDol
             else if($mixedResult === true){
                 $sRedirectUrl = BxDolForm::getSubmittedValue('relocate','post');
                 if(empty($sRedirectUrl)){
-                    $sRedirectUrl = '/';
+                    if (!getParam('sys_account_auto_profile_creation')){
+                        
+                        $aModulesProfile = bx_srv('system', 'get_modules_by_type', ['profile']);
+
+                        $sDefaultProfileType = getParam('sys_account_default_profile_type');
+                        if(count($aModulesProfile) == 1)
+                            $sProfileModule = $aModulesProfile[0]['name'];
+                        else if(!empty($sDefaultProfileType)) 
+                            $sProfileModule = $sDefaultProfileType;
+                        
+                        $sRedirectUrl = !empty($sProfileModule) ? bx_api_get_relative_url(BxDolPermalinks::getInstance()->permalink(BxDolService::call($sProfileModule, 'profile_create_url', array(false)))) : '/';
+
+                    }
+                    else{
+                        $sRedirectUrl = '/';
+                    }    
                 }
                 else{
                     $parts = parse_url($sRedirectUrl);