sugarCRM:注销后如何重定向到外部页面?

时间:2017-08-01 11:26:23

标签: php ajax logout sugarcrm suitecrm

我正在尝试重定向到我的外部页面上的页面,我到目前为止所尝试的是。我手动添加了一些文件。 在/custom/modules/Users/logic_hooks.php

<?php

    $hook_version = 1;
    $hook_array = Array();

    $hook_array['after_logout'] = Array();
    $hook_array['after_logout'][] = Array(
        //Processing index. For sorting the array.
        1,

        //Label. A string value to identify the hook.
        'after_logout example',

        //The PHP file where your class is located.
        'custom/modules/Users/logic_hooks_class.php',

        //The class the method is in.
        'logic_hooks_class',

        //The method to call.
        'after_logout_method'
    );

?>

In /custom/modules/Users/logic_hooks_class.php中的另一个文件

<?php

    if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class logic_hooks_class
    {
        function after_logout_method($bean, $event, $arguments)
        {

        header('Location: http://raviranjan.info/');
        }

         function AfterLogout(&$bean, $event, $arguments)  
    {  
        SugarApplication::redirect('http://raviranjan.info/');  
    }  
    }

?>

在从SugarCRM应用程序注销之前或之后,还有其他方法可以重定向或只是在屏幕上显示某些内容。

预先感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

有多种方法可以做到这一点。阅读以下详细信息:

  1. 通过处理注销链接的点击事件来显示任何其他类型的消息的警报。例如当用户点击该链接然后显示任何其他类型消息的提醒时。
  2. 注销后将用户重定向到您的自定义页面(您可以构建自定义入口点,可通过auth =&gt; false访问)。
  3. 您可以添加任何按钮或java脚本来显示消息,然后将其重定向到目标页面。
  4. 简单的jquery选择器,请参阅以下内容:

    $("a.utilsLink").click(function(){
    
    var r = confirm("Are you sure to logout?");
    if (r == true) {
        console.log("yes is clicked");
    } else {
         console.log("cancel is clicked...");
    return false;    
    }
    
    });