Initialize public HG Inschrijvingen source
This commit is contained in:
commit
c84fea26a0
23 files changed
+1623
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: HG Inschrijvingen
|
||||
* Description: Activiteiten, geplande momenten en inschrijvingen met reserveringen en handmatige bevestiging.
|
||||
* Version: 0.1.2
|
||||
* Update URI: https://code.hosting.hippogrief.nl/hippogrief/wp-plugins/src/branch/main/hg_registrations
|
||||
* Requires at least: 6.5
|
||||
* Requires PHP: 8.1
|
||||
* Author: Hippogrief
|
||||
* License: GPL-2.0-or-later
|
||||
* Text Domain: hg-registrations
|
||||
*/
|
||||
if (!defined('ABSPATH')) exit;
|
||||
require_once __DIR__ . '/includes/hg-plugin-updates.php';
|
||||
define('HGR_VERSION', '0.1.2');
|
||||
define('HGR_PATH', plugin_dir_path(__FILE__));
|
||||
define('HGR_URL', plugin_dir_url(__FILE__));
|
||||
require_once HGR_PATH . 'includes/hg-admin-menu.php';
|
||||
require HGR_PATH . 'includes/model.php';
|
||||
require HGR_PATH . 'includes/mail.php';
|
||||
require HGR_PATH . 'includes/frontend.php';
|
||||
require HGR_PATH . 'includes/admin.php';
|
||||
register_activation_hook(__FILE__, 'hgr_install');
|
||||
add_action('init', function () {
|
||||
register_post_type('hgr_activity', [
|
||||
'labels' => ['name'=>'Activiteiten', 'singular_name'=>'Activiteit', 'add_new_item'=>'Activiteit toevoegen', 'edit_item'=>'Activiteit bewerken'],
|
||||
'public'=>false, 'show_ui'=>true, 'show_in_menu'=>false, 'show_in_rest'=>true,
|
||||
'supports'=>['title','editor'], 'capability_type'=>'post', 'map_meta_cap'=>true,
|
||||
'capabilities'=>['create_posts'=>'manage_options','edit_posts'=>'manage_options','edit_others_posts'=>'manage_options','edit_published_posts'=>'manage_options','edit_private_posts'=>'manage_options','publish_posts'=>'manage_options','delete_posts'=>'manage_options','delete_others_posts'=>'manage_options','delete_published_posts'=>'manage_options','delete_private_posts'=>'manage_options','read_private_posts'=>'manage_options'],
|
||||
]);
|
||||
});
|
||||
add_action('admin_init', function () { if (get_option('hgr_schema') !== HGR_VERSION) hgr_install(); });
|
||||
add_filter('pre_delete_post',function($delete,$post) {
|
||||
if ($post->post_type==='hgr_activity') {
|
||||
global $wpdb;
|
||||
if ($wpdb->get_var($wpdb->prepare('SELECT id FROM '.hgr_table('moments').' WHERE activity_id=%d LIMIT 1',$post->ID))) return false;
|
||||
}
|
||||
return $delete;
|
||||
},10,2);
|
||||
Reference in new issue
Block a user