Support » Plugin: Hustle - Pop-Ups, Slide-ins and Email Opt-ins » anyway pop up based on user agent?

  • Resolved alexlii

    (@alexlii)


    Hello,

    There are lots of browser, and also there are so manny Apps, and there are always embedded browser in Apps, so is there anyway to make pop up based on different User agent?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello @alexlii

    Hope you’re doing well today! 🙂

    Currently, there isn’t any display rule based on user-agents, I’ve already shared that with our developers though, so they can consider adding it in a future update.

    Thank you,
    Dimitris

    Thanks

    It will a big Gun if it could be achieved, and we could deliver different POP up content for different users from different Referrers.

    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello there @alexlii,

    hope you’re doing well today! 🙂

    Just an update here that this has been added in plugin’s pipeline. Can’t provide any specific estimated time though, hope you understand.

    In case it could be useful, and for future reference for other members, here’s a filter example to display a popup on Internet Explorer only.

    add_filter(
        'popup-output-data',
        function( $data, $popup ) {
            $ua = htmlentities( $_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8' );
    
            if ( 95 === $data['popup_id'] &&
            ( preg_match( '~MSIE|Internet Explorer~i', $ua ) ||
            strpos( $ua, 'Edge' ) !== false ||
            ( strpos( $ua, 'Trident/7.0' ) !== false && strpos( $ua, 'rv:11.0' ) !== false ) ) ) {
                return $data;
            }
            return $data['html_id'] = '';
        },
        15,
        2
    );

    Warm regards,
    Dimitris

    alexlii

    (@alexlii)

    wow, this is great!

    Two questions:

    1#should I input it into child theme function?

    2# should I change “Edge” for other user agent “ ? Like safari, or Micromessager” which is a emebed browser of Wechat App.

    By the way, here is plugin for your reference, which provide user agent detect:

    https://wordpress.org/plugins/redirection/

    but it is used for redirection and no Pop up:

    http://prntscr.com/nf2dk3

    Thanks

    • This reply was modified 1 month ago by  alexlii.
    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello @alexlii,
    hope you’re doing well!

    1) You can add in in the functions.php file of your child theme or create a separate MU plugin for it like wp-content/mu-plugins/hustle-agents.php (just create the /mu-plugins/ folder if it doesn’t exist and insert the opening PHP tag <?php on the very first line of that file)

    2) I’m afraid that conditional checks per browser are more complicated than that and depend on each browser agent. For doing so you should either advise a developer of yours or wait for the plugin update that will introduce this.

    Warm regards,
    Dimitris

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.