SQL code to create custom fields

  • Ahmad Arshad
  • Topic Author
  • Away
  • Premium Member
  • Premium Member
More
2 years 7 months ago #146223 by Ahmad Arshad
SQL code to create custom fields was created by Ahmad Arshad
Dear Tuan,

When we install the membership pro component, it automatically creates a number of custom fields...

I am trying to make a plugin that creates / deletes custom fields as part of the installation and uninstall process..

Can you point me to the right area ?

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

More
2 years 7 months ago #146224 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic SQL code to create custom fields
The custom fields are stored in #__osmembership_fields table. So I guess somehow, you will have to insert data into that table manually

Not sure if it gives you the information? Or you want to know something else?

Tuan

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

  • Ahmad Arshad
  • Topic Author
  • Away
  • Premium Member
  • Premium Member
More
2 years 7 months ago #146230 by Ahmad Arshad
Replied by Ahmad Arshad on topic SQL code to create custom fields
Thanks Tuan,

I am guessing they get populated as part of install.sql script or something. I just wanted to look at that and maybe copy it for the ones that I want to install

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

More
2 years 7 months ago #146231 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic SQL code to create custom fields
Yes. It is included in administrator/components/com_osmembership/sql/fields.osmembership.sql file. And during the install/upgrade process, we check and if there are no fields in the table, execute that script to insert these default fields.
Code:
$coreFieldsSql = JPATH_ADMINISTRATOR . '/components/com_osmembership/sql/fields.osmembership.sql'; OSMembershipHelper::executeSqlFile($coreFieldsSql);

Something like that

Regards,

Tuan

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