CoursePress hook to all the network

I have Coursepress instaled in the network but I need to add a hook so that when the user create a site don't have immediatily the menu of coursePress.

Actually users choose their website with ProSite plugin, and automaticly the menu CoursePress is ready on their website because I activate CoursePress pro plugin for the network.

And they don't have access of plugin or CoursesPress setting, and some of them don't need to use CoursePress.

  • Dimitris

    Hello Sarah,

    hope you're doing good today!

    I've made couple of tests in a site of mine and I feel a bit lost on this.
    If you network activate CoursePress plugin, then it has separate options per site, so each subsite admin can remove this option from here:

    As you will notice in above screenshot, if there's no navigation menu assigned at all, then these elements can't be added automatically. This gives you another workaround, as you can use New Blog Templates plugin and create a basic template without any menus assigned.

    Another workaround would be not having CoursePress activated in whole network, so it won't be always active in each subsite, but admins can activate it, if they need it.

    Hope that was some help, please do let me know, if I'm missing something here! :slight_smile:

    Warm regards,
    Dimitris

  • Nahid

    Hey Sarah !
    Hope you are having a great day!

    You can add the following code in a mu-plugin to hide the CoursePress Pro menu items:

    <?php
    add_action( 'wp_head', 'wpmudev_hide_cp_menu_items' );
    function wpmudev_hide_cp_menu_items() {
    	echo '<style>
    		li#menu-item-cp-courses, li#menu-item-cp-dashboard, li#menu-item-cp-logout {
        		display: none;
    		}
    	</style>';
    }

    This'll require you to paste the mentioned code in a PHP file that ends with the extension .php, e.g. "anyname.php". This PHP file should be placed in {your root WordPress folder}/wp-content/mu-plugins (you'll need to create the folder named "mu-plugins" if it is not there already).

    Hope this helps. Let us know if this works for you. Thanks!

    Kind regards,
    Nahid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.