| @@ -1176,10 +1176,8 @@ | ||
| 1176 | 1176 | * @param array $args Settings arguments. |
| 1177 | 1177 | * @return mixed |
| 1178 | 1178 | */ |
| 1179 | 1179 | public function customize_fields($fields) { |
| 1180 | - $wp_roles = $this->get_roles(); | |
| 1181 | - | |
| 1182 | 1180 | $fields['queue_management'] = Rules::is('source', $this->id, true, $fields['queue_management']); |
| 1183 | 1181 | $_fields = &$fields["appearance"]['fields']; |
| 1184 | 1182 | $conversion_position = &$_fields['position']['options']; |
| 1185 | 1183 | |
| @@ -1308,62 +1306,11 @@ | ||
| 1308 | 1306 | Rules::is('appear_condition', 'after_few_seconds'), |
| 1309 | 1307 | ]), |
| 1310 | 1308 | ]; |
| 1311 | 1309 | |
| 1312 | - $fields['targeting'] = [ | |
| 1313 | - 'label' => __('Targeting', 'notificationx'), | |
| 1314 | - 'type' => 'section', | |
| 1315 | - 'id' => 'targeting', | |
| 1316 | - 'classes' => 'nx-targeting', | |
| 1317 | - 'priority' => 100, | |
| 1318 | - 'info' => InfoTooltipManager::get_instance()->render('button'), | |
| 1319 | - 'fields' => [] | |
| 1320 | - ]; | |
| 1310 | + // Country / user-role targeting fields now live in NotificationX\Core\Targeting | |
| 1311 | + // and are injected for ALL notification types, not just the bar. See that class. | |
| 1321 | 1312 | |
| 1322 | - // Country Targeting | |
| 1323 | - $fields['targeting']['fields']['country_targeting'] = [ | |
| 1324 | - 'label' => __('Country Targeting', 'notificationx'), | |
| 1325 | - 'name' => 'country_targeting', | |
| 1326 | - 'type' => 'better-select', | |
| 1327 | - 'priority' => 10, | |
| 1328 | - 'is_pro' => true, | |
| 1329 | - 'multiple' => true, | |
| 1330 | - 'values' => [ 'label' => "All Country", 'value' => 'all' ], | |
| 1331 | - 'option' => GlobalFields::get_instance()->normalize_fields(Helper::nx_get_all_country()), | |
| 1332 | - 'ajax' => [ | |
| 1333 | - 'api' => "/notificationx/v1/get-data", | |
| 1334 | - 'data' => [ | |
| 1335 | - 'type' => "@type", | |
| 1336 | - 'source' => "@source", | |
| 1337 | - // 'field' => "country_targeting", | |
| 1338 | - ], | |
| 1339 | - ], | |
| 1340 | - 'rules' => Rules::is('source', $this->id), | |
| 1341 | - 'info' => InfoTooltipManager::get_instance()->render('targeting'), | |
| 1342 | - ]; | |
| 1343 | - | |
| 1344 | - // User Role Targeting | |
| 1345 | - $wp_roles_with_default = []; | |
| 1346 | - if( is_array( $wp_roles ) ) { | |
| 1347 | - $wp_roles_with_default = array_merge( | |
| 1348 | - [ 'all_users' => __('Show for All Users', 'notificationx') ], | |
| 1349 | - $wp_roles | |
| 1350 | - ); | |
| 1351 | - } | |
| 1352 | - $fields['targeting']['fields']['targeting_user_roles'] = [ | |
| 1353 | - 'label' => __('Set Target Audience', 'notificationx'), | |
| 1354 | - 'name' => 'targeting_user_roles', | |
| 1355 | - 'type' => 'select', | |
| 1356 | - 'priority' => 20, | |
| 1357 | - 'is_pro' => true, | |
| 1358 | - 'default' => ['all_users'], | |
| 1359 | - 'options' => GlobalFields::get_instance()->normalize_fields($wp_roles_with_default), | |
| 1360 | - 'multiple' => true, | |
| 1361 | - 'info' => InfoTooltipManager::get_instance()->render('targeting'), | |
| 1362 | - 'rules' => Rules::is('source', $this->id), | |
| 1363 | - ]; | |
| 1364 | - | |
| 1365 | - | |
| 1366 | 1313 | $fields["behaviour"]['fields']['display_last'] = Rules::is('source', $this->id, true, $fields["behaviour"]['fields']['display_last']); |
| 1367 | 1314 | $fields["behaviour"]['fields']['display_from'] = Rules::is('source', $this->id, true, $fields["behaviour"]['fields']['display_from']); |
| 1368 | 1315 | $fields["behaviour"]['fields']['loop'] = Rules::is('source', $this->id, true, $fields["behaviour"]['fields']['loop']); |
| 1369 | 1316 | $fields["behaviour"] = Rules::logicalRule([ |
| @@ -1538,14 +1485,14 @@ | ||
| 1538 | 1485 | foreach ($languages as $lang => $val) { |
| 1539 | 1486 | // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. |
| 1540 | 1487 | $elementor_post_id = apply_filters( 'wpml_object_id', $elementor_id, 'nx_bar', false, $lang); |
| 1541 | 1488 | if($elementor_post_id){ |
| 1542 | - wp_delete_post($elementor_post_id, true); | |
| 1489 | + Helper::delete_owned_post($elementor_post_id, 'nx_bar'); | |
| 1543 | 1490 | } |
| 1544 | 1491 | } |
| 1545 | 1492 | return; |
| 1546 | 1493 | } |
| 1547 | - wp_delete_post($elementor_id, true); | |
| 1494 | + Helper::delete_owned_post($elementor_id, 'nx_bar'); | |
| 1548 | 1495 | } |
| 1549 | 1496 | } |
| 1550 | 1497 | |
| 1551 | 1498 | /** |
| @@ -2190,14 +2137,14 @@ | ||
| 2190 | 2137 | foreach ($languages as $lang => $val) { |
| 2191 | 2138 | // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. |
| 2192 | 2139 | $wpml_pid = apply_filters( 'wpml_object_id', $pid, 'wp_block', false, $lang); |
| 2193 | 2140 | if($wpml_pid){ |
| 2194 | - wp_delete_post($wpml_pid, true); | |
| 2141 | + Helper::delete_owned_post($wpml_pid, 'nx_bar_eb'); | |
| 2195 | 2142 | } |
| 2196 | 2143 | } |
| 2197 | 2144 | return; |
| 2198 | 2145 | } |
| 2199 | - wp_delete_post($pid, true); | |
| 2146 | + Helper::delete_owned_post($pid, 'nx_bar_eb'); | |
| 2200 | 2147 | } |
| 2201 | 2148 | } |
| 2202 | 2149 | |
| 2203 | 2150 | public function templately_cloud_push_post_type($post_type){ |