Action when a subcritpion is set to active

  • Spiros Delimpasis
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 11 months ago #63978 by Spiros Delimpasis
Action when a subcritpion is set to active was created by Spiros Delimpasis
When someone is subscribed for the first time and the subscription is set as active I want to update some records on the users table. I think this can be done by adding my code to the following file
administrator/components/com_osmembership/models/subscriber.php
in the function store

Am I on the right track?

Thank you.

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

More
8 years 11 months ago #63979 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Action when a subcritpion is set to active
Hi

That might not be a right way because the modification will be lost when you upgrade to latest version of the extension.

If you have the code ready, I think you can use this solution:

1. Go to Extensions -> Plugins Manager, find and publish the plugin "OS Membership PHP Script".

2. Then edit the subscription plan, there is a new tab called PHP Script Settings, page the script you want to run (to update users table) into "Scription Active Script" textarea input

3. You will have to repeat step #2 for all other plans

That's the proper solution. Other solution is writing a plugin to process onMembershipActive event (look at plugins/osmembership folder, you will see many plugins there which process this table). If you know how to write a Joomla plugin, that's a better way as well

Tuan

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

  • Spiros Delimpasis
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 11 months ago #63983 by Spiros Delimpasis
Replied by Spiros Delimpasis on topic Action when a subcritpion is set to active
Is it possible using the OS Membership PHP Script to use the Joomla Framework (eg current user object)?

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

More
8 years 11 months ago #63984 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Action when a subcritpion is set to active
Yes. That script run inside Joomla, so you can use any Joomla code

Tuan

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

  • Spiros Delimpasis
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 11 months ago #63989 by Spiros Delimpasis
Replied by Spiros Delimpasis on topic Action when a subcritpion is set to active
So for the Subscription Active Script, how do I use the record of the subscibers table that is being activated?

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

More
8 years 11 months ago #63991 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Action when a subcritpion is set to active
You can use $row object:

$row->first_name

$row->last_name

$row->email

$row->user_id

...

Tuan

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

More
8 years 1 day ago #81502 by Olle Haerstedt
Replied by Olle Haerstedt on topic Action when a subcritpion is set to active
Hi Tuan,

Do you have documentation on which fields are available for $row?

Regards
Olle

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

More
7 years 11 months ago #81550 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Action when a subcritpion is set to active
Hi Olle

I am sorry. I don't have documentation for it. All the fields in #__osmembership_subscribers table are available and can be accessible from that object

You can let me know what data you want to access and I will tell you whether it is possible and how to access it

Tuan

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