unsubscribe user in payment plugin

  • DannyB
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 4 months ago #73514 by DannyB
unsubscribe user in payment plugin was created by DannyB
Hello Tuan

I created a plugin to subscribe with SMS.
plan = lifetime (until user sends 'stop'), every week user get paid sms.
Everything works smooth.
Only 1 problem:
When user send 'stop' the user need to be removed from the paid group.
I set 'published' to 2 (expired) , but user is still active in the paid group.
I think i need to add some magic code to remove user from the paid group.
I could do this with joomla api , but maybe is there a function 'unsubribe', i can not find that.
any idea?

another question:
if user is expired, the user can create a new subscription i think?

By the way, creating plugins and setting up the component was easy. Me and my customer are very happy ;)

Please Log in or Create an account to join the conversation.

More
8 years 4 months ago #73540 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic unsubscribe user in payment plugin
Hi Danny

You can simply trigger onMembershipExpire event. For example, use this code:
Code:
JPluginHelper::importPlugin('osmembership'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onMembershipExpire', array($row));

$row is a subscription record object.

Regards,

Tuan

Please Log in or Create an account to join the conversation.