- Posts: 14
- Thank you received: 0
Retreive a value from subscribers database
- Yao KOUAKOU
- Topic Author
- Offline
- New Member
-
Less
More
8 years 1 month ago #95637
by Yao KOUAKOU
Retreive a value from subscribers database was created by Yao KOUAKOU
Hi Tuan,
I have 2 plans where , plan1 is public et plan2 only accessible by subscribers.
In plan1 i have a custom field A display only for plan1 and a custom field B only display for plan2.
1 - How/where could i modify the code to field B based on a the value of A. ( by taking it in the database ) ?
something like: select from DB field B value where memberId = who is connected
2 - How could make a custom field "Read_only" after subscription
I hope this is clear . Thank you in advance.
Best regards
Yao
I have 2 plans where , plan1 is public et plan2 only accessible by subscribers.
In plan1 i have a custom field A display only for plan1 and a custom field B only display for plan2.
1 - How/where could i modify the code to field B based on a the value of A. ( by taking it in the database ) ?
something like: select from DB field B value where memberId = who is connected
2 - How could make a custom field "Read_only" after subscription
I hope this is clear . Thank you in advance.
Best regards
Yao
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
8 years 1 month ago #95672
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Retreive a value from subscribers database
Hello Yao
1. It is hard to provide answer for this question as I don't know what field you want to get. In Membership Pro, the value for custom fields are stored in #__osmembership_field_value table. You can try to look at that table to see the structure and write the code yourself
2. Try to create a custom field, in Extra setting, set it to readonly, and check it again, I haven't tried but it should work
Tuan
1. It is hard to provide answer for this question as I don't know what field you want to get. In Membership Pro, the value for custom fields are stored in #__osmembership_field_value table. You can try to look at that table to see the structure and write the code yourself
2. Try to create a custom field, in Extra setting, set it to readonly, and check it again, I haven't tried but it should work
Tuan
Please Log in or Create an account to join the conversation.
- Yao KOUAKOU
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 14
- Thank you received: 0
8 years 1 month ago #96278
by Yao KOUAKOU
Replied by Yao KOUAKOU on topic Retreive a value from subscribers database
Thank you Tuan. I will try this.
I am also looking for an example on how to use " public onAfterStoreSubscription($row)" function because i wouldlike to populate et hidden custom field after this even in the database
Best
I am also looking for an example on how to use " public onAfterStoreSubscription($row)" function because i wouldlike to populate et hidden custom field after this even in the database
Best
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
8 years 1 month ago #96294
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Retreive a value from subscribers database
Hello Yao
Look at plugins/osmembership/userprofile/userprofile.php, you will see how we use the function in a plugin. Basically, inside that function, you can access to $row object which is a subscription record (a record of #__osmembership_subscribers table)
Not sure what you need to do, so I could not guide you further
Tuan
Look at plugins/osmembership/userprofile/userprofile.php, you will see how we use the function in a plugin. Basically, inside that function, you can access to $row object which is a subscription record (a record of #__osmembership_subscribers table)
Not sure what you need to do, so I could not guide you further
Tuan
Please Log in or Create an account to join the conversation.
- Yao KOUAKOU
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 14
- Thank you received: 0
8 years 1 month ago #96472
by Yao KOUAKOU
Replied by Yao KOUAKOU on topic Retreive a value from subscribers database
Hello Tuan,
I come to you to know if you can help me on that.
As i mentioned , i have 2 custom field. FieldA is a select box which came take 0, 1, 2 .... to 15 . I field is displayed in a play.
Then I have fieldB which hidden (textbox) .
At plan submission i would like to copy the value of FieldA into fieldB + 1. So, In the database fieldB value = fieldA value + 1
Best regards
Yao
I come to you to know if you can help me on that.
As i mentioned , i have 2 custom field. FieldA is a select box which came take 0, 1, 2 .... to 15 . I field is displayed in a play.
Then I have fieldB which hidden (textbox) .
At plan submission i would like to copy the value of FieldA into fieldB + 1. So, In the database fieldB value = fieldA value + 1
Best regards
Yao
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
8 years 1 month ago #96487
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Retreive a value from subscribers database
Hello Yao
Unfortunately, there is no way to configure Membership Pro to have it works like that. You would have to customize the code of the extension:
1. Open the file components/com_osmembership/controller/register.php
2. Look for the function process_subscription
3. Add this line of code at the beginning of the function
Then it should work as expected. Of course name_of_field_a and name_of_field_b need to be replaced with the name of the correct fields you want
Regards,
Tuan
Unfortunately, there is no way to configure Membership Pro to have it works like that. You would have to customize the code of the extension:
1. Open the file components/com_osmembership/controller/register.php
2. Look for the function process_subscription
3. Add this line of code at the beginning of the function
Code:
$this->input->post->set('name_of_field_b', (int) $this->input->post->get('name_of_field_a') + 1);
Then it should work as expected. Of course name_of_field_a and name_of_field_b need to be replaced with the name of the correct fields you want
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
8 years 1 month ago #96490
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Retreive a value from subscribers database
Attached is the modified file which is based on latest version 2.8.3 so that you can check and understand the idea
Tuan
Tuan
- Yao KOUAKOU
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 14
- Thank you received: 0
8 years 4 weeks ago #96662
by Yao KOUAKOU
Replied by Yao KOUAKOU on topic Retreive a value from subscribers database
HI Tuan ,
I tried but it doesn' t work .
I added : $this->input->post->set('osm_NB_PART_PROVISION', (int) $this->input->get('osm_familynumber') + 1); at the begining of process_subscription function .
'osm_NB_PART_PROVISION -> text field
'osm_familynumber' -> list field
I tried but it doesn' t work .
I added : $this->input->post->set('osm_NB_PART_PROVISION', (int) $this->input->get('osm_familynumber') + 1); at the begining of process_subscription function .
'osm_NB_PART_PROVISION -> text field
'osm_familynumber' -> list field
- Tuan Pham Ngoc
- Offline
- Administrator
-
8 years 4 weeks ago #96679
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Retreive a value from subscribers database
Hello
Please submit a support ticket sending us super admin account of your site. We are going to check and correct it for you
Regards,
Tuan
Please submit a support ticket sending us super admin account of your site. We are going to check and correct it for you
Regards,
Tuan
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.