// 1. تسجيل صندوق الميتا بوكس الجديد في جانب صفحة المباراة
add_action('add_meta_boxes', 'ss_register_future_referee_metabox_fixed');
function ss_register_future_referee_metabox_fixed() {
add_meta_box(
'ss_future_ref_box_fixed',
'👨⚖️ طاقم تحكيم المباراة (المنظومة المطورة)',
'ss_display_future_referee_metabox_fixed',
'sp_event',
'side',
'default'
);
}
// 2. بناء واجهة الإدخال بشكل محمي داخل الدالة لضمان التنظيم ومنع التخبط
function ss_display_future_referee_metabox_fixed($post) {
wp_nonce_field('ss_future_ref_save_fixed', 'ss_future_ref_nonce_fixed');
$current_ref = get_post_meta($post->ID, '_ss_future_ref_id', true);
$yellow_cards = get_post_meta($post->ID, '_ss_future_ref_yellow', true);
$red_cards = get_post_meta($post->ID, '_ss_future_ref_red', true);
$penalties = get_post_meta($post->ID, '_ss_future_ref_pens', true);
$referees = get_posts(array('post_type' => 'referee', 'posts_per_page' => -1, 'post_status' => 'publish'));
// طباعة عناصر الواجهة برمجياً لحمايتها من الظهور في أعلى الصفحة
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
echo '
';
}
// 3. حفظ البيانات تلقائياً بداخل قاعدة البيانات
add_action('save_post_sp_event', 'ss_save_future_referee_metabox_fixed');
function ss_save_future_referee_metabox_fixed($post_id) {
if (!isset($_POST['ss_future_ref_nonce_fixed']) || !wp_verify_nonce($_POST['ss_future_ref_nonce_fixed'], 'ss_future_ref_save_fixed')) return;
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
if (!current_user_can('edit_post', $post_id)) return;
$fields = array('ss_future_ref_id', 'ss_future_ref_yellow', 'ss_future_ref_red', 'ss_future_ref_pens');
foreach ($fields as $field) {
if (isset($_POST[$field])) {
update_post_meta($post_id, '_' . $field, sanitize_text_field($_POST[$field]));
}
}
}
علي فائز زانجير - Lo3btna
علي فائز زانجير
البشائر
|
لاعب
🏆 دوري الدرجة الأولى
| الموسم / الفريق |
لعب | أهداف | صناعة | مساهمة | دقائق | التفاصيل |
|
2022/2021
البشائر
|
1 |
1 |
0 |
1 |
0' |
|
🔄 الانتقالات
لا توجد بيانات سجل انتقالات.