Ejemplo n.º 1
0
 /**
  * Activate the plugin
  */
 public static function activate()
 {
     global $Chronosly_Extend;
     //TODO MIRAR LA FUNCION add_role PARA AÑADIR ROLES DE USUARIOS NUEVOS
     // Capabilities for the chronosly custom post type
     $WP_Roles = new WP_Roles();
     foreach (array('chronosly_author', 'edit_' . CHRONOSLY_CAPABILITY_TYPE, 'read_' . CHRONOSLY_CAPABILITY_TYPE, 'delete_' . CHRONOSLY_CAPABILITY_TYPE, 'delete_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'edit_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'edit_others_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'edit_published_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'delete_published_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'delete_private_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'delete_others_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'publish_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'read_private_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'chronosly_options', 'chronosly_license') as $cap) {
         $WP_Roles->add_cap(CHRONOSLY_ADMIN_ROLE, $cap);
     }
     $ext = new Chronosly_Extend();
     //the new code will set CHRONOSLY_VERSION code to the latest
     //update templates and addons
     $ext->update_addons();
     $ext->update_templates();
     $ext->rebuild_template_addons("default");
     Chronosly_Cache::clear_cache();
     wp_schedule_event(time(), "daily", 'chronosly_update_addons');
     wp_schedule_event(time(), "daily", 'chronosly_update_templates');
 }