• Resolved gutding

    (@gutding)


    Hi there,
    is it possible to hide lists on the manage subscription page?
    I have a dedicated list for special customers. New customers can subscribe to this list only on a password protected page. Every newsletter we send contains a link to the manage your subscription page. So everybody can subscribe to the special customers list when using the manage your subscription page, as I can not hide a list by default.
    In the MailPoet KB I’ve found code snippets for hiding elements on that page. How can I manage to hide that list if the customer is not already subscribed to it?
    Thanks for your input.
    Best regards, Rado

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Bruna a11n

    (@bruberries)

    Hi @gutding,

    is it possible to hide lists on the manage subscription page?

    Yes, you can hide particular lists from the Manage Subscription page. However, this will be applied to all subscribers, not only to those not subscribed to this list yet.

    To do so, you need to go to the MailPoet > Settings > Basics tab, check the “Manage Subscription page” settings and add there only the lists you’d like to be shown on this page for your subscribers.

    For reference: https://kb.mailpoet.com/article/184-the-manage-subscription-page

    Thread Starter gutding

    (@gutding)

    Hi Bruna,

    thanks for getting back to me. Yes, I know that I can manage which lists will be shown for all subscribers. But that does not help with my issue, where I want only already subscribed users to see a certain list.

    Actually I figured that out myself by now. Just had to dig into the arrays…
    If anybody else was interested, here is how I do it:

    add_filter( 'mailpoet_manage_subscription_page_form_fields', 'mp_remove_manage_fields', 10);
    function mp_remove_manage_fields( $form ) {	
    	$is_unset = false;
    	foreach($form as $key1 => $value){
    		// Field cf_2 is an extra field just for customers of my special list
    		// so it can go if the user is not already on that list
    		if ($value['id']=='cf_2') {
            	$key_cf_2 = $key1;
            	// if the check for special segment was before this check
            	if ($is_unset) {
            		unset($form[$key1]);
            	}
            }
    		if ($value['id']=='segments') {
    			$my_params = $value['params']['values'];
    			foreach($my_params as $key2 => $my_valP){
    				// my list has the id of 8
    				if ($my_valP['id']=8 and !$my_valP['is_checked']) {
    					unset($form[$key1]['params']['values'][$key2]);
    					// also delete the extra field for customers of this list
    					// see above
    					if (isset($key_cf_2)) {
    						unset($form[$key_cf_2]);
    					}
    					else {
            				$is_unset = true;
            			}
    				}
    			}
            }
    	}
    	return $form;
    }
    Plugin Author Bruna a11n

    (@bruberries)

    Hi @gutding,

    That’s nice! Thanks for sharing your workaround here so other users can benefit from it!

    Thread Starter gutding

    (@gutding)

    Sorry, there was a little error in my code. value[‘id’] looks like an integer but it is a string… So please use this:

    add_filter( 'mailpoet_manage_subscription_page_form_fields', 'mp_remove_manage_fields', 10);
    function mp_remove_manage_fields( $form ) {	
    	$is_unset = false;
    	foreach($form as $key1 => $value){
    		// Field cf_2 is an extra field just for customers of my special list
    		// so it can go if the user is not already on that list
    		if ($value['id']=='cf_2') {
            	$key_cf_2 = $key1;
            	// if the check for special segment was before this check
            	if ($is_unset) {
            		unset($form[$key1]);
            	}
            }
    		if ($value['id']=='segments') {
    			$my_params = $value['params']['values'];
    			foreach($my_params as $key2 => $my_valP){
    				// my list has the id of 8
    				if ($my_valP['id']=='8' and !$my_valP['is_checked']) {
    					unset($form[$key1]['params']['values'][$key2]);
    					// also delete the extra field for customers of this list
    					// see above
    					if (isset($key_cf_2)) {
    						unset($form[$key_cf_2]);
    					}
    					else {
            				$is_unset = true;
            			}
    				}
    			}
            }
    //        debug_log($value,"MP_MSP_Value");
    	}
    	return $form;
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Manage subscription hide lists’ is closed to new replies.