API or custom code

  • Thomas Brugmans
  • Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 3 weeks ago #163365 by Thomas Brugmans
API or custom code was created by Thomas Brugmans
Hello,

I 'm using membership pro to sell services. I need to copy data from membership pro in other table and trigger an API to create DB in OVH products.
For the copy I can use php code and add it to the code while triggering order button, meanwhile I need to know what file is used to apply membership and start the copy on my other table.
I know that doing like this I will have to be carefuul while updating the component.
I can also create an API I saw a function in Membership pro but just with a key, no adress nor anything much for API

Meanwhile if someone see how I could do else or have the php page used while applying you will have all my gratitude :D

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

More
3 months 3 weeks ago #163378 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic API or custom code
Hello Thomas

1. The subscriptions data is stored in #__osmembership_subscribers table in case you want to copy data to other tables. Or in case you want to also get data for none core custom fields, use this method membershipprodoc.joomservices.com/develo...cription-information

2. For sending data to external, in the next release, we will include a HTTP plugin which allows sending subscription data to the URL you want. Maybe you can use it without having to write code

Tuan
The following user(s) said Thank You: Thomas Brugmans

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

  • Thomas Brugmans
  • Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 1 week ago #163718 by Thomas Brugmans
Replied by Thomas Brugmans on topic API or custom code
Hello Tuan
Thanks for your answer.
I did this code but the trigger does not seems to work, I saved it in PHP and copy it in the plugin folder
The goal is to copy information on different table on another DB

Can you catch an eye ?
Regards

File Attachment:

File Name: monplugin.zip
File Size:1 KB

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

More
3 months 1 week ago #163728 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic API or custom code
Hello Thomas

You cannot just copy it to plugin folder and have it to run. You need to create the complete plugin (contains at least the xml and the php script), zip it, install it via Joomla extensions installer, enable it to have it runs

You can look at some plugins in plugins/osmembership folder to see the sample

Regards,

Tuan

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

  • Thomas Brugmans
  • Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 1 week ago - 3 months 1 week ago #163742 by Thomas Brugmans
Replied by Thomas Brugmans on topic API or custom code
Manage to install it ;)
 
Last edit: 3 months 1 week ago by Thomas Brugmans.

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

More
3 months 1 week ago #163751 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic API or custom code
OK Thomas. Please enable, test it and let us know if you have any questions, please don't hesitate to ask

BTW, you should use Joomla API method to connect and works with external database instead of writing your own code like mysqli_connect.... Google and you should see some code for that

Regards,

Tuan

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

  • Thomas Brugmans
  • Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 1 week ago - 3 months 1 week ago #163753 by Thomas Brugmans
Replied by Thomas Brugmans on topic API or custom code
Ok it's installed but it doesn't work... I tried several possibilities like on membership activation etc but it doesn't work.
External DB are not updated...
In attachment the code of the plugin I tried

File Attachment:

File Name: os_projecture2.zip
File Size:1 KB

 
Last edit: 3 months 1 week ago by Thomas Brugmans.

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

More
3 months 1 week ago #163754 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic API or custom code
The attached is not a plugin, so I don't know how you could get it installed and executed. If you want to write PHP code and have it running like the attached code, I would suggest you to use this plugin membershipprodoc.joomservices.com/plugins/script-plugin

Just put the code you want to be executed there and it will be executed

Tuan

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

  • Thomas Brugmans
  • Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 1 week ago - 3 months 1 week ago #163820 by Thomas Brugmans
Replied by Thomas Brugmans on topic API or custom code
Wonderfull, it works great :D
Got just a last question, i try to dump an sql file and I need to locate my file.
should i the file in /www/plugins/osmembership/script/ and put the path like "file.sql"  to be right?
like
$sqlFile = "file.sql";
$command = "mysql -h $host -u $user -p $pass $deb_name < $sqlFile";
or should i use $sqlFile = "/www/plugins/osmembership/script/file.sql"
Last edit: 3 months 1 week ago by Thomas Brugmans.

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

More
3 months 1 week ago #163822 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic API or custom code
Hi Thomas

I don't understand this question. Where do you run the command? And I don't think it is something related to Membership Pro. This is a command line runs from console, so it is not something related to the plugin

Tuan

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