<?php
/*
Plugin Name: Updates Theme Flatsome 
Plugin URI: https://thienle.stie
Description: Automatic Flatsome theme updates and add a custom update URL
Version: 1.0
Author: ThienLe
*/

// Disable Flatsome update filters
function disable_flatsome_updates() {

  remove_filter( 'pre_set_site_transient_update_themes', 'flatsome_get_update_info', 1);
  remove_filter( 'pre_set_transient_update_themes', 'flatsome_get_update_info', 1);

}
add_action('init', 'disable_flatsome_updates');

// Require updater library
require_once plugin_dir_path( __FILE__ ) . 'theme-update-checker.php';

// Default updater 
$flatsome_updater = new ThemeUpdateChecker(
  'flatsome',
  'http://demo.lethien.site/update/?action=get_metadata&slug=flatsome' 
);
function enqueue_admin()
{
    ?>
<style>
    li#toplevel_page_flatsome-panel,
    li#wp-admin-bar-flatsome_panel,
    li#wp-admin-bar-flatsome-activate,
    {
        display: none;
    }
</style>
    <?php 
}
add_action( 'admin_head', 'enqueue_admin' ) ;