MyBB Community Forums
Add some query from custom Plugin - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Add some query from custom Plugin (/thread-215304.html)

Pages: 1 2


Add some query from custom Plugin - CivilEA - 2018-01-10

Hello

I have a custom plugin the database like this:

[Image: 84902294699481701596.png]

i want to add some data in user control panel, I want if user had been buy subscription (has record in database)m can see detail of the own payments like:
- Time of subscription
- Time of end subscription
- Plan

and also can expire its subscription. (upgarded column when is 0 means expired).

could you please help me to add this codes?

Any help?


RE: Add some query from custom Plugin - CivilEA - 2018-01-17

Any help?


RE: Add some query from custom Plugin - CivilEA - 2018-12-25

Please help


RE: Add some query from custom Plugin - Omar G. - 2018-12-25

Which plugin do you use? It varies with the plugin, as it might include some helper code to make it easier. Otherwise you could end up coding everything from fetching the data to formatting.

What have you tried to accomplish this? Do you have an idea or have some work done?


RE: Add some query from custom Plugin - CivilEA - 2018-12-30

(2018-12-25, 08:12 PM)Omar G. Wrote: Which plugin do you use? It varies with the plugin, as it might include some helper code to make it easier. Otherwise you could end up coding everything from fetching the data to formatting.

What have you tried to accomplish this? Do you have an idea or have some work done?

Hello

this is custom plug-in that have been written specially for my site.
it is subscription by paypal plug-in


RE: Add some query from custom Plugin - Omar G. - 2018-12-30

Hook to member_profile_end, there you will need to fetch the data from the DB using the user profile ui $memprofile['uid'], since your table already has the UID stored as per your image.

Once you get all the row or the necessary columns you will need to format them accordingly for the output.


RE: Add some query from custom Plugin - CivilEA - 2018-12-31

(2018-12-30, 12:41 PM)Omar G. Wrote: Hook to member_profile_end, there you will need to fetch the data from the DB using the user profile ui $memprofile['threadnum'], since your table already has the UID stored as per your image.

Once you get all the row or the necessary columns  you will need to format them accordingly for the output.

thank you for your reply,

could you please give me simple example for doing it? Huh


RE: Add some query from custom Plugin - Omar G. - 2019-01-05

$memprofile['uid'] = (int)$memprofile['uid'];
$query = $db->simple_select('TABLE_NAME', '*', "uid='{$memprofile['uid']}' AND payment_status='Completed'");
$user_subscription = $db->fetch_array($query);

$user_subscription['plan'] = htmlspecialchars_uni($user_subscription['plan']);
$user_subscription['dateline'] = my_date('relative', (int)$user_subscription['dateline']);

There you have something to work upon.


RE: Add some query from custom Plugin - CivilEA - 2019-01-05

(2019-01-05, 05:18 AM)Omar G. Wrote:
$memprofile['uid'] = (int)$memprofile['uid'];
$query = $db->simple_select('TABLE_NAME', '*', "uid='{$memprofile['uid']}' AND payment_status='Completed'");
$user_subscription = $db->fetch_array($query);

$user_subscription['plan'] = htmlspecialchars_uni($user_subscription['plan']);
$user_subscription['dateline'] = my_date('relative', (int)$user_subscription['dateline']);

There you have something to work upon.

thank you dear Omar;

These codes shall be add to member profile template?


RE: Add some query from custom Plugin - Omar G. - 2019-01-05

You should use a plugin, but add it before $plugins->run_hooks("member_profile_end"); in member.php and see what happens.