PriMoThemes — now s2Member® (official notice)
This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™
anointed wrote:they all seem to operate independently.
My primary blog uri restrictions have no effect on another site in the network
add_action('woocommerce_order_status_completed', 'woocommerce_paying_customer');
function woocommerce_paying_customer( $order_id ) {
$order = &new woocommerce_order( $order_id );
if ( $order->user_id > 0 ) update_user_meta( $order->user_id, 'paying_customer', 1 );
}
That's what it looks like to me. I would do something like this.Is assigning user level-1 all that is required for s2members to then kick in and allow access to the member?
Or is there other data that also must be checked/saved?
**If that is all that is required, could you ask Jason or one of the devs to give me a quick action snippet that I can add to woocommerce which I can hook to 'order_status_completed' which will tie s2members together?
<?php
add_action('woocommerce_order_status_completed', 'woocommerce_paying_customer');
function woocommerce_paying_customer($order_id)
{
if(is_object($order = &new woocommerce_order($order_id)) && !empty($order->user_id))
{
update_user_meta($order->user_id, 'paying_customer', 1);
$user = new WP_User($order->user_id);
$user->set_role("s2member_level1");
/**/
/* Or, do this if the Role clashes. */
// $user->add_cap("access_s2member_level0");
// $user->add_cap("access_s2member_level1");
}
}
?>
Users browsing this forum: No registered users and 3 guests