• Resolved typopositive

    (@typopositive)


    Hello,
    I would like to know if there is some way to customize the text in different languages straight through the plugin interface?
    I’ve read the documentation, but I’m not developer, so I don’t know how to integrate this part of script through my back-office:
    $buoop = {
    text_xx: “”
    // custom notification text for language “xx”
    // e.g. text_de for german and text_it for italian
    };
    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Marco Steinbrecher

    (@macsteini)

    I haven’t implemented this feature due to lack of use cases as of yet. Hence, you can’t use the above without coding knowledge.

    Thread Starter typopositive

    (@typopositive)

    Thank you for the quick reply.
    I guess I will have to try anyway ??
    I imagine I should override this code in the functions.php of my child theme?
    Should I dequeue the script and enqueue my own?
    What is the best practice in this case?
    Thanks again!

    Plugin Author Marco Steinbrecher

    (@macsteini)

    Either way shouldn’t impact the performance too much. Try yourself and share your findings afterwards.

    @typopositive Until the dev add this feature, you can update the text with your custom text by dequeue the script and enqueue again in functions.php in child theme.

    ,text:"Mysite.com would like to remind you: Your browser {brow_name} is out of date. Please <a{up_but}>update</a> for more security, comfort and the best experience on mysite.com",api:2019.08};

    See the example below.

    /**
     *
     * WP Browser update plugin overide
     *
     */
    
    if (  function_exists( 'wpbu' ) )  {
    
    	function wpbu2() {
    		$wpbu_vars = explode(' ', get_option('wp_browserupdate_browsers'));
    		$wpbu_js = explode(' ', get_option('wp_browserupdate_js'));
    		var_dump($wpbu_js);
    		$browser = 'e:'.$wpbu_vars[0].',f:'.$wpbu_vars[1].',o:'.$wpbu_vars[2].',s:'.$wpbu_vars[3].(!isset($wpbu_vars[4])?'':',c:'.$wpbu_vars[4]);
    
    		echo '<script type="text/javascript">
    		var $buoop = {required:{'.$browser.'},test:'.(isset($wpbu_js[1]) ? $wpbu_js[1] : '').',newwindow:'.(isset($wpbu_js[2]) ? $wpbu_js[2] : '').',style:"'.(isset($wpbu_js[3]) ? $wpbu_js[3] : '').'",insecure:'.(isset($wpbu_js[4]) ? $wpbu_js[4] : '').',unsupported:'.(isset($wpbu_js[5]) ? $wpbu_js[5] : '').',mobile:'.(isset($wpbu_js[6]) ? $wpbu_js[6] : '').',shift_page_down:'.(isset($wpbu_js[7]) ? $wpbu_js[7] : '').',text:"Mysite.com would like to remind you: Your browser {brow_name} is out of date. Please <a{up_but}>update</a> for more security, comfort and the best experience on mysite.com",api:2019.08};
    
    		function $buo_f(){
    			var e = document.createElement("script");
    			e.src = "//browser-update.org/update.min.js";
    			document.body.appendChild(e);
    		};
    		try {document.addEventListener("DOMContentLoaded", $buo_f,false)}
    		catch(e){window.attachEvent("onload", $buo_f)}
    		</script>';
    	}
    
    	remove_action( 'wp_footer', 'wpbu' );
    	add_action('wp_footer', 'wpbu2');
    }

    Note: You need to update this code each time plugin updates this section of code

    • This reply was modified 5 years, 2 months ago by Jamil Ahmed.
    Thread Starter typopositive

    (@typopositive)

    @jimi007 Many thanks ??

    Hi – When we use the above code in the functions.php we have some strange coding appear at the bottom of the live site:

    array(8) { [0]=> string(1) “0” [1]=> string(5) “false” [2]=> string(4) “true” [3]=> string(6) “corner” [4]=> string(4) “true” [5]=> string(4) “true” [6]=> string(5) “false” [7]=> string(5) “false” }

    Are we doing something wrong/missing something?

    The plugin developer says it was something to do with the custom coding – “It seems you made manual changes to the plugin which causes this behaviour”.

    Thanks.

    @teamvolta Sorry I forget to remove var_dump while I was testing the code. Just remove this line or comment out so it will not render anymore

    Change this
    var_dump($wpbu_js);

    to

    //var_dump($wpbu_js);

    Corrected new code:

    /**
     *
     * WP Browser update plugin overide
     *
     */
    
    if (  function_exists( 'wpbu' ) )  {
    
    	function wpbu2() {
    		$wpbu_vars = explode(' ', get_option('wp_browserupdate_browsers'));
    		$wpbu_js = explode(' ', get_option('wp_browserupdate_js'));
    		$browser = 'e:'.$wpbu_vars[0].',f:'.$wpbu_vars[1].',o:'.$wpbu_vars[2].',s:'.$wpbu_vars[3].(!isset($wpbu_vars[4])?'':',c:'.$wpbu_vars[4]);
    
    		echo '<script type="text/javascript">
    		var $buoop = {required:{'.$browser.'},test:'.(isset($wpbu_js[1]) ? $wpbu_js[1] : '').',newwindow:'.(isset($wpbu_js[2]) ? $wpbu_js[2] : '').',style:"'.(isset($wpbu_js[3]) ? $wpbu_js[3] : '').'",insecure:'.(isset($wpbu_js[4]) ? $wpbu_js[4] : '').',unsupported:'.(isset($wpbu_js[5]) ? $wpbu_js[5] : '').',mobile:'.(isset($wpbu_js[6]) ? $wpbu_js[6] : '').',shift_page_down:'.(isset($wpbu_js[7]) ? $wpbu_js[7] : '').',text:"Mysite.com would like to remind you: Your browser {brow_name} is out of date. Please <a{up_but}>update</a> for more security, comfort and the best experience on mysite.com",api:2019.08};
    
    		function $buo_f(){
    			var e = document.createElement("script");
    			e.src = "//browser-update.org/update.min.js";
    			document.body.appendChild(e);
    		};
    		try {document.addEventListener("DOMContentLoaded", $buo_f,false)}
    		catch(e){window.attachEvent("onload", $buo_f)}
    		</script>';
    	}
    
    	remove_action( 'wp_footer', 'wpbu' );
    	add_action('wp_footer', 'wpbu2');
    }
    • This reply was modified 4 years, 11 months ago by Jamil Ahmed.

    Hi Jamil,

    that has worked perfectly – thank you very much ??

    Hey,

    Just want to add that it’s not really necessary to override the whole script enqueue. Since the plugin adds a global var $buoop; which is the config object you can just reference it’s properties and change them at will from another script as long as it’s enqueued after the plugins.

    $buoop.text = 'hello world';
    will change the text without having to to all that other stuff. And this is the entire config object exposed so really you could change anything you want.

    @jimi007 Thanks for posting this override! Is there some way to add a Hide/Ignore/Close button back in?

    @evanseabrook Yes you can add this code at the end of $buoop variable

    <a{ignore_but}>ignore</a>

    Complete snippet for your convenience

    /**
     *
     * WP Browser update plugin overide
     *
     */
    
    if (  function_exists( 'wpbu' ) )  {
    
    	function wpbu2() {
    		$wpbu_vars = explode(' ', get_option('wp_browserupdate_browsers'));
    		$wpbu_js = explode(' ', get_option('wp_browserupdate_js'));
    		$browser = 'e:'.$wpbu_vars[0].',f:'.$wpbu_vars[1].',o:'.$wpbu_vars[2].',s:'.$wpbu_vars[3].(!isset($wpbu_vars[4])?'':',c:'.$wpbu_vars[4]);
    
    		echo '<script type="text/javascript">
    		var $buoop = {required:{'.$browser.'},reminder:'.(isset($wpbu_js[0]) ? $wpbu_js[0] : '').',test:'.(isset($wpbu_js[1]) ? $wpbu_js[1] : '').',newwindow:'.(isset($wpbu_js[2]) ? $wpbu_js[2] : '').',style:"'.(isset($wpbu_js[3]) ? $wpbu_js[3] : '').'",insecure:'.(isset($wpbu_js[4]) ? $wpbu_js[4] : '').',unsupported:'.(isset($wpbu_js[5]) ? $wpbu_js[5] : '').',mobile:'.(isset($wpbu_js[6]) ? $wpbu_js[6] : '').',shift_page_down:'.(isset($wpbu_js[7]) ? $wpbu_js[7] : '').',text:"Fairytalez.com would like to remind you: Your browser {brow_name} is out of date. Please <a{up_but}>update</a> for more security, comfort and the best experience on fairytalez.com. <a{ignore_but}>ignore</a>",api:2019.08};
    		function $buo_f(){
    			var e = document.createElement("script");
    			e.src = "//browser-update.org/update.min.js";
    			document.body.appendChild(e);
    		};
    		try {document.addEventListener("DOMContentLoaded", $buo_f,false)}
    		catch(e){window.attachEvent("onload", $buo_f)}
    		</script>';
    	}
    
    	remove_action( 'wp_footer', 'wpbu' );
    	add_action('wp_footer', 'wpbu2');
    }
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Customize the text directly from the plugin interface’ is closed to new replies.