Changeset 3215459
- Timestamp:
- 12/31/2024 05:54:36 PM (15 months ago)
- Location:
- dynamic-post/trunk
- Files:
-
- 3 edited
-
post-types/post_type_dynamic_post.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
wp_plugin_dynamic_post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
dynamic-post/trunk/post-types/post_type_dynamic_post.php
r3207786 r3215459 879 879 } 880 880 881 // Update Article Version882 function delete_all_posts_by_service2client() {883 $plugin_file = WP_PLUGIN_DIR . '/dynamic-post/wp_plugin_dynamic_post.php';884 885 if (file_exists($plugin_file)) {886 $plugin_headers = get_file_data($plugin_file, ['Version' => 'Version']);887 if (!empty($plugin_headers['Version'])) {888 check_plugin_updates_for_dynamicpost($plugin_headers['Version']);889 }890 }891 }892 893 function check_plugin_updates_for_dynamicpost($current_version) {894 $specific_plugin = 'plugin-slug/plugin-file.php';895 // Trigger a plugin update check896 wp_update_plugins();897 898 // Get the list of available updates899 $update_plugins = get_site_transient('update_plugins');900 901 if (!empty($update_plugins->response[$specific_plugin])) {902 $plugin_data = $update_plugins->response[$specific_plugin];903 $plugin_name = $plugin_data->slug;904 $new_version = $plugin_data->new_version;905 if (version_compare($new_version, $current_version, '>')) {906 del_post_add_new_post();907 }908 }909 }910 911 function del_post_add_new_post() {912 global $wpdb;913 914 // Fetch the last record from wp_api_status915 $results = $wpdb->get_results(916 "SELECT `date` FROM `{$wpdb->prefix}api_status` ORDER BY `date` DESC LIMIT 1",917 ARRAY_A918 );919 920 if (count($results) === 1) {921 922 $user = get_user_by('login', 'Service2Client');923 if ($user) {924 $user_id = $user->ID;925 926 // Get all posts by this user927 $args = [928 'author' => $user_id,929 'post_type' => 'any',930 'post_status' => 'any',931 'posts_per_page' => -1, // Fetch all posts932 ];933 934 $query = new WP_Query($args);935 if ($query->have_posts()) {936 foreach ($query->posts as $post) {937 // Permanently delete the post938 wp_delete_post($post->ID, true);939 940 }941 }942 943 // Clean up after WP_Query944 wp_reset_postdata();945 }946 947 // Add new posts948 $get_saved_cat_data = get_option('saved_cats');949 if (!empty($get_saved_cat_data)) {950 $pass_saved_cat['data_catgname'] = array_merge(...$get_saved_cat_data);951 $instanceOfClass = new Post_Type_Dynamic_Post();952 $instanceOfClass->insert_dynamic_posts($pass_saved_cat);953 }954 }955 }956 add_action('init', 'delete_all_posts_by_service2client');957 958 881 // Hook the functions 959 882 add_filter('tiny_mce_before_init', 'allow_iframes_for_editor_and_author'); 960 883 add_action('init', 'add_editor_and_author_capabilities'); 961 884 ?> 962 -
dynamic-post/trunk/readme.txt
r3207786 r3215459 6 6 Requires at least: 3.0 7 7 Tested up to: 6.7.1 8 Stable tag: 4. 088 Stable tag: 4.10 9 9 License: GPLv2 or later, Contact sales@service2client.com for duel licensing options. 10 10 … … 244 244 *Update Article Version Number Automatically* 245 245 246 = 4.10 = 247 *Reverting back to version 4.06* 248 246 249 == Upgrade Notice == 247 250 … … 367 370 = 4.08 = 368 371 Update Article Version Number Automatically 372 373 = 4.10 = 374 Reverting back to version 4.06 -
dynamic-post/trunk/wp_plugin_dynamic_post.php
r3207786 r3215459 4 4 Plugin URI: https://www.service2client.com/dynamicpost 5 5 Description: Auto post Service2Clients Dynamic Content articles to your blog on a monthly basis. CPA Content, Tax Content, Accounting Content. 6 Version: 4. 086 Version: 4.10 7 7 Author: Service2Client 8 8 Author URI: https://www.service2client.com
Note: See TracChangeset
for help on using the changeset viewer.