Membership Functionality II (IPN filters and drip feeds)

Inactive
  • 39 points
    Starting to get into this DEV thing
    I'm helpful
    dseason

    Member  —  8th March 2011 (1 year ago)         

    Hi,

    Tammie suggested that I make a new thread to provide clarification on exactly what I want to do.

    Current functionality (WORKING)

    I am currently automatically creating a subscription for a user with a specific level and set of rules when they register.

    $serializedData = serialize($data);
    
    $wpdb -> insert('wp_m_membership_rules',
    	array('level_id' => $user_id,
    		'rule_ive' => 'positive',
    		'rule_area' => 'posts',
    		'rule_value' => $serializedData,
    		'rule_order' => '1'),
    	array('%d', '%s', '%s', '%s', '%d'));
    
    $wpdb -> insert('wp_m_membership_levels',
    	array('id' => $user_id,
    		'level_title' => $user_id,
    		'level_slug' => $user_id,
    		'level_active' => '1',
    		'level_count' => $user_id),
    	array('%d', '%s', '%s', '%d', '%d'));
    
    $wpdb -> insert('wp_m_subscriptions',
    	array('id' => $user_id,
    		'sub_name' => $user_id,
    		'sub_active' => "0",
    		'sub_public' => "0",
    		'sub_count' => $user_id,
    		'sub_description' => "Subscription: $user_id."),
    	array('%d', '%s', '%d', '%d', '%d', '%s'));
    
    $wpdb -> insert('wp_m_subscriptions_levels',
    	array('sub_id' => $new_id,
    		'level_id' => $user_id,
    		'level_period' => "1",
    		'sub_type' => 'indefinite',
    		'level_price' => '',
    		'level_currency' => ' ',
    		'level_order' => $user_id,
    		'level_period_unit' => ""),
    	array('%d', '%d', '%d', '%s', '%d', '%d', '%s'));
    
    $wpdb -> insert('wp_m_membership_relationships',
    	array('user_id' => $user_id,
    		'sub_id' => $user_id,
    		'level_id' => $user_id,
    		'level_id' => $user_id,
    		'startdate' => $preparedDate,
    		'order_instance' => $user_id));

    This modifies the database to create a rule, level and subscription to a certain set of posts. However, they currently are not actively subscribed, so they do not have access to those posts.

    I can also dynamically adjust the rules in any way I want.

    Temporary functionality (NOT WORKING)

    1.) I currently have htaccess auth set to the root of the installation until the site goes live. I need to do paypal sandbox testing. What do I need to do for /paymentreturn/paypalexpress to be open to the public, so that Paypal does not get any errors?

    Future functionality (NOT WORKING)

    1.) I need to filter payment notification with a function. Upon successful payment received, modify a rule. What add_filter do I need to add for this to happen, and what variables do I have access to?

    1.A.) I also need to change "level_price" to reflect the price they paid. I will also need to change level_period_unit depending upon whether or not it's yearly or monthly.

    2.) I need to implement drip feeds, so that each post added to the rule takes 1 week before it becomes available. I would also like to print how long until the week has expired. How can I accomplish this?

    Thank you.