Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2014, 10:13 PM
nogi nogi is offline
 
Join Date: Mar 2014
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default SQL query to pull out non-paying subscribers

I have various subscriptions on my site. The main one is called Premium, users that take this sub move from Regular to Premium user group and back when the sub expires. However, with the recent change of site ownership and paypal addresses, subs that are autorenewing/cancelling via PayPal aren't updating back on VB and the users are not reverting back to regular.

I've been able to proactively manage upcoming renewals by using the following query:
Membership Due Dates
Code:
SELECT user.username,user.email,subscriptionlog.expiry,subscriptionlog.status
FROM subscriptionlog AS subscriptionlog
LEFT JOIN user AS user ON (user.userid = subscriptionlog.userid)
But, how can I pull a list of users that are still in the Premium group but without any current subscription?
Reply With Quote
  #2  
Old 04-23-2014, 10:22 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The old owner needs to cancel the subs in paypal on their end. Because they are renewing, or they'd get dropped.
Reply With Quote
  #3  
Old 04-23-2014, 10:48 PM
nogi nogi is offline
 
Join Date: Mar 2014
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery View Post
The old owner needs to cancel the subs in paypal on their end. Because they are renewing, or they'd get dropped.
He has already done this. This has/is causing me another issue with subs, I've got a ton of these messages in the logs now:

Quote:
vb_error_code authentication_failure
txn_type subscr_cancel
I've taken over the email/domain as well. All the previous subs were associated with his PayPal account, I couldn't see anyway to migrate them over to my PayPal account. Upon cancelling them all on his PayPal - VB tried to cancel the subs on my forum and fails, which is kind of right as peoples subs shouldn't be cut short just because of ownership change.

So far, I've disabled the old sub and created a new one to stop the renewal failures. Problem with this is people can't seem to be bothered to go through the process again resulting in loss of subscribers. For some subscribers that don't renew, the group membership isn't reverting to the old ones, hence the SQL query request.
Reply With Quote
  #4  
Old 04-24-2014, 08:48 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't have subscriptions set up so I can't test this, but I think you should be able to add this to the end of the query you posted above:
Code:
WHERE user.usergroupid = P AND subscriptionlog.expirydate < UNIX_TIMESTAMP()

Where you'd replace the P with the usergroupid of the Premium group. You might also want to add "AND subscriptionlog.subscriptionid = S" if it's possible for users to have more than one subscription (to make sure you're matching the subscriptionid S of the Premium subscription).

I have to admit that I don't understand a lot about paid subscriptions. Do the records get removed from the subscription log when the subscription is done? If so, you might want to change your query to "...FROM user LEFT JOIN subscriptionlog", that way you'll find users even if they have no record in the subscriptionlog (and I think it still would work since in that case expirydate should be NULL).
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:20 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.18116 seconds
  • Memory Usage 2,193KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete