Add some query from custom Plugin
#1
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?
Reply
#2
Any help?
Reply
#3
Please help
Reply
#4
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?
Reply
#5
(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
Reply
#6
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.
Reply
#7
(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
Reply
#8
$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.
Reply
#9
(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?
Reply
#10
You should use a plugin, but add it before $plugins->run_hooks("member_profile_end"); in member.php and see what happens.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)