duan_2000 2017-08-01 11:26
浏览 69
已采纳

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

I am trying to redirect to a page on my external page, what I have tried till now is. Manually I added some files. In /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'
    );

?>

And another file in 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/');  
    }  
    }

?>

So is there any other way to redirecting or just show something on screen before or after logging out from SugarCRM application.

Advance Thanks for any help.

  • 写回答

1条回答 默认 最新

  • douzhan4522 2017-08-01 12:46
    关注

    There are multiple ways of doing this. Read following details:

    1. show alert of any other type of message by handling click event of logout link. e.g. when user click that link then show alert of any other type of message.
    2. after logout redirect user to your custom page( you can build custom entry point which will be accessible with auth=>false).
    3. you can add any button or java-script to show message then redirect it to your target page.

    Simple jquery selector, see following:

    $("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;    
    }
    
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画