We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

EE2: Custom module, direct function call

Development and Programming

Frans Cooijmans's avatar
Frans Cooijmans
36 posts
16 years ago
Frans Cooijmans's avatar Frans Cooijmans

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

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Just a quick note, we don’t directly support module coding questions in this forum. Moving to the Modules forum.

       
TKoorn's avatar
TKoorn
64 posts
16 years ago
TKoorn's avatar TKoorn

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.

       
Frans Cooijmans's avatar
Frans Cooijmans
36 posts
16 years ago
Frans Cooijmans's avatar Frans Cooijmans

if i change the url to: http://www.example.com/index.php?ACT=55 it doesn´t work either.

what is the normal way of executing a module function directly?

       
TKoorn's avatar
TKoorn
64 posts
16 years ago
TKoorn's avatar TKoorn

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 😊

       
Frans Cooijmans's avatar
Frans Cooijmans
36 posts
16 years ago
Frans Cooijmans's avatar Frans Cooijmans

will try that tomorrow….

Somehow the {path="logout"} is able to do it, so why can’t I.

I will post back my results.

       
Frans Cooijmans's avatar
Frans Cooijmans
36 posts
16 years ago
Frans Cooijmans's avatar Frans Cooijmans

Hmm,

http://www.example.com/index.php?ACT=58 works, had the wrong ID. (should do a mysql refresh after a remove/install 😊 )

but that also states that using the ID is not a good idea.

any other options why {AID:Crm:logout} is not replaced?

       
ezpost's avatar
ezpost
1 posts
4 years ago
ezpost's avatar ezpost

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]

Log out

It’s always hard to build a custom CRM, but easier with Ergonized 😊

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.