Support » Plugin: Eonet Manual User Approve » WooCommerce support: any news?

  • maxgx

    (@maxgx)


    hi Antonio,

    a year ago you said you were going to check @ahcferret solution for WooCommerce compatibility.

    any news on your findings? because the fix does not really work: after registration, user is sent straight to the My Account dashboard and can carry on as logged in user.

    any help really appreciated!

    • This topic was modified 1 year ago by maxgx.
Viewing 2 replies - 1 through 2 (of 2 total)
  • maxgx

    (@maxgx)

    this seems to (finally!) work with WooCommerce 3.5.1, based on @ahcferret solution (woocommerce_registration_redirect instead of template_redirect):

    function wp4625_handleuserstates() {
    	if( is_user_logged_in() ) {
    		if( current_user_can('administrator') || current_user_can('editor') || current_user_can('edit_posts') ) {
    			// The user is an Admin, Editor or other WP user with permission to edit pages
    		} else {  
    			// get user status data from Eonet Manual User Approve plugin
    			$userapproved = get_user_meta( get_current_user_id(), 'eonet_mua_status' );
    			if(is_array($userapproved)) {
    				if( $userapproved[0]==1 ) {
    					// an approved user
    				} elseif( $userapproved[0]==0 ) {
    					// a pending user - ensure they are logged out!
    					wp_logout();
    					$url = get_option( 'woocommerce_myaccount_page_id' );
    					return $url;
    				} else {
    					// a disapproved user
    				}
    			} else {
    				// something unexpected happened
    			}
    		}
    	}
    }
    add_action('woocommerce_registration_redirect', 'wp4625_handleuserstates', 10);
    maxgx

    (@maxgx)

    there’s a mistake in the code above:

    change
    $url = get_option( 'woocommerce_myaccount_page_id' );

    into
    get_permalink( get_option( 'woocommerce_myaccount_page_id' ) );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WooCommerce support: any news?’ is closed to new replies.