• Resolved pipoulito

    (@pipoulito)


    Hi,

    In admin , is it possible to set by defaul the trigger to DELAY /AUTO OPEN ?
    thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Kim L

    (@kimmyx)

    Hi @pipoulito,

    The short answer is no. There is no way to set a DEFAULT trigger for all newly created popups at the moment. This is to avoid inadvertently showing your popup everywhere while you’re still building it.

    We hope this answers your question. Let us know if we can help you with anything else. ??

    Thread Starter pipoulito

    (@pipoulito)

    Hi,

    thanks, even with a hook on y side or a php trick ?

    • This reply was modified 2 years ago by pipoulito.
    Plugin Support Kim L

    (@kimmyx)

    Hi @pipoulito,

    We’ll forward this question to our development team if they have suggestions on how to do that in the backend. We’ll let you know once we receive feedback. ??

    Cheers~

    Plugin Author Daniel Iser

    (@danieliser)

    @pipoulito – Are you trying to make all new popups use that trigger, or all popups in general, new and existing, use that trigger?

    IE filter defaults, or filter popup settings passed to the JavaScript?

    Thread Starter pipoulito

    (@pipoulito)

    i used this

    add_action('save_post', 'handle_pum_creation');
    function handle_pum_creation($post_id) {
    	$post = get_post( $post_id );
    	if( $post !== null && $post->post_status == 'publish' && $post->post_type == 'popup') {
    		$popup_settings = get_post_meta( $post_id, 'popup_settings' );
    		$popup_settings = $popup_settings[0];
    
    		if(isset($popup_settings['triggers']) && empty($popup_settings['triggers'])){
    			$popup_settings['triggers'][0] = [
    				'type'		=> 'auto_open',
    				'settings'	=> [
    					'delay'			=> 500,
    					'cookie_name'	=> [
    						0 	=> 'pum-'.$post_id
    					]
    				]
    			];
    		}
    		
    		if(isset($popup_settings['cookies']) && empty($popup_settings['cookies'])){
    			$popup_settings['cookies'][0] = [
    				'event'		=> 'on_popup_close',
    				'settings'	=> [
    					'name'			=> 'pum-'.$post_id,
    					'time'			=> '1 month',
    					'session'		=> false,
    					'path'			=> '1',
    					'key'			=> ''
    				]
    			];
    		}
    
    		update_post_meta($post_id, 'popup_settings', $popup_settings);
    	}
    }
    Bel

    (@belimperial)

    Hi @pipoulito

    Thank you for your reply.

    We found the same concern in our Facebook group.

    The user created a custom code that allows setting the trigger Time Delay/Auto Open as the default trigger.

    Here’s the code:

    add_action('save_post', 'handle_pum_creation');
    function handle_pum_creation($post_id) {
    $post = get_post( $post_id );
    if( $post !== null && $post->post_status == 'publish' && $post->post_type == 'popup') {
    $popup_settings = get_post_meta( $post_id, 'popup_settings' );
    $popup_settings = $popup_settings[0];
    if(isset($popup_settings['triggers']) && empty($popup_settings['triggers'])){
    $popup_settings['triggers'][0] = [
    'type' => 'auto_open',
    'settings' => [
    'delay' => 500,
    'cookie_name' => [
    0 => 'pum-'.$post_id
    ]
    ]
    ];
    }
    if(isset($popup_settings['cookies']) && empty($popup_settings['cookies'])){
    $popup_settings['cookies'][0] = [
    'event' => 'on_popup_close',
    'settings' => [
    'name' => 'pum-'.$post_id,
    'time' => '1 month',
    'session' => false,
    'path' => '1',
    'key' => ''
    ]
    ];
    }
    update_post_meta($post_id, 'popup_settings', $popup_settings);
    }
    }

    Reference link.

    Kindly try the code and update it according to your needs.

    Let us know how that goes. Thank you!

    Thread Starter pipoulito

    (@pipoulito)

    Yes it is me ??

    Plugin Support Kim L

    (@kimmyx)

    Hi @pipoulito,

    Great! ?? Were you able to successfully set the default trigger for your popups?

    Do let us know so we can mark this thread as resolved.

    Thank you! ??

    Thread Starter pipoulito

    (@pipoulito)

    yes thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘trigger’ is closed to new replies.