Useful Snippets

Welcome!


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at Unwanted.cloud

RSS Latest posts from my personal blog


Most viewed posts


Subscribe to RSS feed


Hide activation nag for Visual Composer and Ultimate Addons for Visual Composer

Stanislav KhromovStanislav Khromov

vc-nag

Updated 2016-04-26

Tired of the message “Hola! Please activate your copy of Visual Composer to receive automatic updates.”?

Here’s a quick way of turning it off. Put this in your themes functions.php file:

setcookie('vchideactivationmsg', '1', strtotime('+3 years'), '/');
setcookie('vchideactivationmsg_vc11', (defined('WPB_VC_VERSION') ? WPB_VC_VERSION : '1'), strtotime('+3 years'), '/');

Or, you can save the snippet below as stop-vc-nag.php, put it in your wp-content/plugins folder and activate the “Stop Visual Composer Activation Nag” plugin!

<?php
/*
Plugin Name: Stop Visual Composer Activation Nag
Plugin URI:
Description:
Version: 2016.04.26
Author: khromov
Author URI: https://snippets.khromov.se
License: GPL2
*/

add_action('admin_init', function()
{
    if(is_admin()) {
        setcookie('vchideactivationmsg', '1', strtotime('+3 years'), '/');
        setcookie('vchideactivationmsg_vc11', (defined('WPB_VC_VERSION') ? WPB_VC_VERSION : '1'), strtotime('+3 years'), '/');
    }
});

Disable Visual Composer Ultimate Addons nag

To disable this nag you have to add the lines below to your wp-config.php file:

define('ULTIMATE_NO_EDIT_PAGE_NOTICE', true);
define('ULTIMATE_NO_PLUGIN_PAGE_NOTICE', true);

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
LinkedIn
Twitter
WordPress.org Profile
Visit my other blog

Comments 50
  • Diah Permatasari
    Posted on

    Diah Permatasari Diah Permatasari

    Reply Author

    Not worked :(


    • Stanislav Khromov
      Posted on

      Stanislav Khromov Stanislav Khromov

      Reply Author

      Hey Diah,

      Did you put this code in a plugin file and activate it?

      Which version of VC are you using?


  • Wt
    Posted on

    Wt Wt

    Reply Author

    Simple and effective! Thanks…


  • Aleksa
    Posted on

    Aleksa Aleksa

    Reply Author

    Extra work !!! “Stop Visual Composer Activation Nag” plugin GREAT TNX AGAIN !!!


  • Alex
    Posted on

    Alex Alex

    Reply Author

    How about buying Visual Composer and entering license? Looks like you are using it, why not pay developers that work constantly to improve it?


    • Stanislav Khromov
      Posted on

      Stanislav Khromov Stanislav Khromov

      Reply Author

      Versioning via Composer and multisite environments are two use cases off the top of my head that are perfectly valid without implying license violations. Some premium themes bundling VC without disabling this warning is another use case.


    • Elmer Twilley
      Posted on

      Elmer Twilley Elmer Twilley

      Reply Author

      First, cheers on this article, but the ultimate add-ons define doesn’t work.

      REPLY
      Many theme authors bundled VC with their themes, which WE purchased, but since about 4 months past, you get this screen nag no matter what you do. I am sure that the theme author(s) could prevent these nags with a little due diligence, however that leaves us without a solution until they do.


  • Andhi Irawan
    Posted on

    Andhi Irawan Andhi Irawan

    Reply Author

    Thanks for the plugin.
    You are right about some premium themes VC bundling without disabling this warning.
    I buy a premium theme that bundling VC in it.
    Although the themes we already buy / pay, VC nag remain frequent.
    The same thing we can do to Ultimate Addons for Visual Composer.

    add_action(‘admin_init’, function()
    {
    setcookie(‘vchideactivationmsg’, ‘1’, strtotime(‘+3 years’), ‘/’); //Visual Composer
    setcookie(‘uavchideactivationmsg’, ‘1’, strtotime(‘+3 years’), ‘/’); //Ultimate Addons for Visual Composer
    });


    • Stanislav Khromov
      Posted on

      Stanislav Khromov Stanislav Khromov

      Reply Author

      Hey Andhi,

      Thanks for the additional snippet, I added it to the main post!


    • Stanislav Khromov
      Posted on

      Stanislav Khromov Stanislav Khromov

      Reply Author

      Hey Andhi,

      It seems the snippet you provided does no longer work for Ultimate Addons (at least not for version 3.11.1). I have included an alternative snippet that should work at the bottom of the post.


  • Bjorn Solstad
    Posted on

    Bjorn Solstad Bjorn Solstad

    Reply Author

    Looks like it’s not working for Ultimate Addons where I tested it. Single install. Latest versions of everything. All cookies cleared.

    And yes, I have bought a bunch of licences for both products, but this is for a staging environment, so it’s actually not a live site.


    • Stanislav Khromov
      Posted on

      Stanislav Khromov Stanislav Khromov

      Reply Author

      Hi Bjorn,

      You are correct, seems that the snippet does not work. I have added an alternative way to disable the activation nag, check at the bottom of the post. Hope that helps.


  • Andhi Irawan
    Posted on

    Andhi Irawan Andhi Irawan

    Reply Author

    Hi Stanislav,
    I’ve tried all the latest snippet you.
    Only works for Visual Composer and do not work for the Ultimate Addons for Visual Composer.
    So finally I change it through html tags. Open wp-content\plugins\Ultimate_VC_Addons\admin\admin.php
    Find Howdy word.
    Above that word there is html tags .
    Add style = “display: none;” thus becoming
    But I do not know whether if the plugin update the tags will be lost or not.
    The same thing I did at Gravity Form.
    #gf_dashboard_message { display: none; }


  • majid
    Posted on

    majid majid

    Reply Author

    thanks a lot for sharing it worked for me


  • Jeremie
    Posted on

    Jeremie Jeremie

    Reply Author

    Hey,

    I was looking for a solution for that for a client as the theme includes the plugin without hiding the update nag…

    Andhi’s answer made me think and here is a safer solution than editing the plugin. Add this to your functions.php


    add_action('admin_head', 'hide_nag');

    function hide_nag() {
    echo '
    .update-nag.bsf-update-nag {
    display: none !important;
    }
    ';
    }

    This works for the ultimate addons but a little bit of customisation will make it work for every plugin.


    • Hammer
      Posted on

      Hammer Hammer

      Reply Author

      Does it work with the latest version of ultimate addons ? This does not work for me.


  • WP_God
    Posted on

    WP_God WP_God

    Reply Author

    If all the above solution fails, use below method:

    1. Open wp-content\plugins\Ultimate_VC_Addons\admin\admin.php

    Comment the line add_action( ‘admin_notices’, array( $this, ‘display_notice’ ) ) and save the file

    2. Open wp-content\plugins\Ultimate_VC_Addons\admin\auto-update\admin-functions.php

    Comment the line add_action(‘admin_notices’,’bsf_notices’,1000); and save the file

    This should keep away the nag messages on the screens.

    Thanks.


  • Yasir Bakhtiar
    Posted on

    Yasir Bakhtiar Yasir Bakhtiar

    Reply Author

    Work with Version 3.13.5. heres how u do it. Thanks WP_God

    1. wp-content\plugins\Ultimate_VC_Addons\admin\admin.php

    The codes look like this, at the top of the line.
    ============================================
    if($_SERVER[‘HTTP_HOST’] !== ‘localhost’ && $_SERVER[‘REMOTE_ADDR’] !== ‘127.0.0.1’ && $_SERVER[‘REMOTE_ADDR’] !== ‘::1’){
    //add_action( ‘admin_notices’, array( $this, ‘display_notice’ ) );
    //add_action( ‘plugins_loaded’, array($this, ‘check_for_update’) );
    //add_action( ‘in_plugin_update_message-
    ===================================================
    Change it into.
    ===============================================
    if($_SERVER[‘HTTP_HOST’] !== ‘localhost’ && $_SERVER[‘REMOTE_ADDR’] !== ‘127.0.0.1’ && $_SERVER[‘REMOTE_ADDR’] !== ‘::1’){
    add_action( ‘admin_notices’, array( $this, ‘display_notice’ ) );
    //add_action( ‘plugins_loaded’, array($this, ‘check_for_update’) );
    //add_action( ‘in_plugin_update_message-
    ================================================
    I only remove comment line on “add_action( ‘admin_notices’, array( $this, ‘display_notice’ ) );”

    2. wp-content\plugins\Ultimate_VC_Addons\admin\auto-update\admin-functions.php
    The codes look like this, Line 477
    ===============================================
    add_action(‘admin_notices’,’bsf_notices’,1000);
    add_action(‘network_admin_notices’,’bsf_notices’,1000);
    if(!function_exists(‘bsf_notices’)) {
    ===============================================
    Change it to.
    ==========================
    //add_action(‘admin_notices’,’bsf_notices’,1000);
    add_action(‘network_admin_notices’,’bsf_notices’,1000);
    if(!function_exists(‘bsf_notices’)) {
    ==========================

    Yeah have fun.


  • John
    Posted on

    John John

    Reply Author

    Thank you Yasir Bakhtiar.

    This worked for me. The next step is to get rid of the ‘Brainstorm’ tab in the admin menu.


    • Andhi Irawan
      Posted on

      Andhi Irawan Andhi Irawan

      Reply Author

      Hi, John, to remove Brainstorm tab, maybe you can use css :
      .toplevel_page_bsf-dashboard { display: none }
      or #toplevel_page_bsf-dashboard { display: none }

      bsf-dashboard is Brainstorm Force Dashboard
      admin.php?page=bsf-dashboard


      • Ray Kie
        Posted on

        Ray Kie Ray Kie

        Reply Author

        This does not work for me
        Ultimate Addons for Visual Composer v3.13.7


        • Andhi Irawan
          Posted on

          Andhi Irawan Andhi Irawan

          Reply Author

          Hi Ray,
          Which part is not working?
          Have you tried using css?

          Try this :

          .bsf-update-nag, #toplevel_page_bsf-registration {display:none}

          Put at the bottom of the file:
          yourdomain.com\wp-admin\css\wp-admin.min.css

          bsf-update-nag -> for notification
          toplevel_page_bsf-registration -> for Brainstorm menu in the left


  • Javier
    Posted on

    Javier Javier

    Reply Author

    For removing the Brainstorm item from the wp-admin menu you could add this to your functions.php:

    function custom_menu_page_removing() {
    remove_menu_page( ‘admin.php?page=bsf-registration’ );
    }
    add_action( ‘admin_menu’, ‘custom_menu_page_removing’ );

    as stated here:
    https://codex.wordpress.org/Function_Reference/remove_menu_page

    although I don’t know why it doesn’t work.

    so I’ve used CSS:

    function my_custom_css() {
    echo ‘
    .toplevel_page_bsf-registration {
    display: none !important;
    }
    ‘;
    }
    add_action(‘admin_head’, ‘my_custom_css’);


    • Stanislav Khromov
      Posted on

      Stanislav Khromov Stanislav Khromov

      Reply Author

      Hey Javier,

      It’s probably a priority issue – your code tries to remove the menu before the original plugin adds it. Try changing your filter to priority 999 so that it runs last. :-)


      • Javier
        Posted on

        Javier Javier

        Reply Author

        Hello there!

        Unfortunately it doesn’t work even with the lowest priority set

        So I’ve got to stick with the CSS solution

        Thanks for the tip anyway!


  • Shawn Hayes
    Posted on

    Shawn Hayes Shawn Hayes

    Reply Author

    Just add the below code to your theme functions.php to hide the notice:

    define(‘BSF_PRODUCTS_NOTICES’, false);

    I wrote a blog on this and also added how to disable the activation notice for Visual Composer itself:
    http://sharewebdesign.com/blog/remove-activation-notice-ultimate-addons-for-visual-composer/

    Hope this helps.
    Shawn


    • Gaunero
      Posted on

      Gaunero Gaunero

      Reply Author

      works like charm, perfect thnx


    • Hossam Hossny
      Posted on

      Hossam Hossny Hossam Hossny

      Reply Author

      That was the only solution that worked for me. Thanks, Shawn!
      Just create a folder mu-plugins under wp-contents then create a .php file and then copy and paste the code:

      That’s a must-use plugin that runs automatically without the need for activation or anything. Preferable method to hook in your code on top of everything without worrying about plugin/theme updates or even your child theme functions file. If you want a certain function to run with last priority just give your function the priority 999 so it run last.

      Cheers,
      Hossam


  • Carlos
    Posted on

    Carlos Carlos

    Reply Author

    hello I need you help not work!!
    I have the next error

    Parse error: syntax error, unexpected T_FUNCTION in /home4/speedda6/public_html/love/wp-content/plugins/stop-vc-nag.php on line 12


    • Stanislav Khromov
      Posted on

      Stanislav Khromov Stanislav Khromov

      Reply Author

      Hi Carlos,

      Looks like you are running a very old PHP version. Please upgrade your version of PHP to at least 5.3!


  • WP_God
    Posted on

    WP_God WP_God

    Reply Author

    Now the latest update of Ultimate addon (version 3.14.1) for nag screen is hidden by developer and none of the above solution work.

    So in order to get rid of the nag screen, only following solution will work after going deep into the code.

    Comment following line in \plugins\Ultimate_VC_Addons\admin\bsf-core\auto-update\admin-functions.php (line no is 478 and 479)

    add_action(‘admin_notices’,’bsf_notices’,1000);
    add_action(‘network_admin_notices’,’bsf_notices’,1000);

    So the line will look like this
    //add_action(‘admin_notices’,’bsf_notices’,1000);
    //add_action(‘network_admin_notices’,’bsf_notices’,1000);

    Hope this will help others as it did to me.


    • Shawn Hayes
      Posted on

      Shawn Hayes Shawn Hayes

      Reply Author

      @WP_God

      You shouldn’t hack plugin code as it can create problems for you in the future when updating.

      If you check out my solution above it should work for you. I have tested the solution on the latest release (version 3.14.1) and it’s working as it should.

      Thanks,
      Shawn


  • youpain
    Posted on

    youpain youpain

    Reply Author

    simple

    // disable activation vc
    setcookie(‘vchideactivationmsg’, ‘1’, strtotime(‘+3 years’), ‘/’); //Visual Composer
    add_action(‘admin_head’, ‘hide_nag’);
    function hide_nag() {echo ‘.update-nag.bsf-update-nag {display: none !important;}’;}


  • Rupinder
    Posted on

    Rupinder Rupinder

    Reply Author

    Hi, I want to deactivate the theme activation line in wordpress.

    How to hide theme activation line without adding purchase code????

    Please inform me.

    Thanks.


  • Mike
    Posted on

    Mike Mike

    Reply Author

    This worked:
    define(‘BSF_PRODUCTS_NOTICES’, false);

    Bonus: Add to wp-config.php
    At risk of losing the edit on a future theme update, I added it to wp-config.php (above the database settings) and it worked like a charm!!


  • Dudi
    Posted on

    Dudi Dudi

    Reply Author

    Worked perfectly. Thanks!


  • James Revillini
    Posted on

    James Revillini James Revillini

    Reply Author

    hello,
    mind if i turn this into an installable plugin and host it on my site or add it to the wordpress repo? not only would it save me a lot of time but i’m sure others as well. of course i’ll keep the credits as is but add myself so i can maintain the repo and answer questions.

    thanks,
    james


  • Faiz Khairi
    Posted on

    Faiz Khairi Faiz Khairi

    Reply Author

    If you want to disable License Nag for Ultimate Addons, paste code below in function.php

    define(‘BSF_PRODUCTS_NOTICES’, false);


  • James
    Posted on

    James James

    Reply Author

    decent solution but I found that adding this instead to your functions.php file works better:

    $_COOKIE[‘vchideactivationmsg_vc11’] = WPB_VC_VERSION;

    that way the message won’t even show up the first time and you don’t have to rely on setting a cookie.


  • Alex
    Posted on

    Alex Alex

    Reply Author

    Worked good! Thank you, it was so annoying.


  • Mahar Maqsood
    Posted on

    Mahar Maqsood Mahar Maqsood

    Reply Author

    Hey Hayes, This indeed worked. However, I am having trouble with a theme activation Notice. How can I deal with that. Newspaper 8.1


  • Edward Robirds
    Posted on

    Edward Robirds Edward Robirds

    Reply Author

    Thanks for this post, as it pointed me in the right direction. My fix is for v3.11.1 of the Brainstorm Force Ultimate Addons for Visual Composer. Navigating through the WP admin was extremely slow, and would take a minute or more to load each page, and would often time out.

    In order to fix this, I commented out line 7 of the “admin.php” file in the “/plugins/Ultimate_VC_Addons/admin/” folder …

    //add_action( ‘plugins_loaded’, array($this, ‘check_for_update’) );

    None of the functions.php updates helped to fix this performance issue (which I tried first).

    Hope this helps someone!


  • David Ionesi
    Posted on

    David Ionesi David Ionesi

    Reply Author

    Thank you! It worked like a charm.


  • Pothi Kalimuthu
    Posted on

    Pothi Kalimuthu Pothi Kalimuthu

    Reply Author

    Thank you. It still works!


  • sitranet
    Posted on

    sitranet sitranet

    Reply Author

    hi, i was tested all codes but the notice was not delete!!!
    can you help me?
    version: 3.16.17