Hi,
I’m developing a custom CRM module which basically extends the member module.
I would like to call the logout function of my mod.crm.php like this:
http://www.example.com/index.php?ACT={AID:Crm:logout}
But this brings up a blank page and does not seem to do anything.
I’ve registered the action in upd.crm.php.
Thanks in advance.
Moved to Modules Forum by Moderator
That AID tag should get parsed and result in an integer. If the template parser doesn’t change the AID tag into an integer something is wrong. These tags are case sensitive so maybe you can try a few different ways of spelling Crm. To test for your method you could look up the action id in the database and use that directly.
You can write a tag in a normal template:
{exp:crm:logout}
that should trigger your method. I think the normal way is posting the ACT in a hidden input. I haven’t tried using it in the url directly. Also I found that in order to get output you need to use the output class. The fastes way to see if your method is called is to have it generate an error. Those always generate output 😊
Add file logout.php and put into them your logout implementation:
<?php
header(‘Content-Type: application/json’);
$_SESSION[usr]->logout();
echo json_encode([‘message’ => ‘ok’]); And call this file with AJAX:
[removed] function logout() { $.ajax({ url: ‘/logout.php’ }).then(function (res) { [removed].href = ‘/’; }); } [removed]
It’s always hard to build a custom CRM, but easier with Ergonized 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.