Changeset 676447
- Timestamp:
- 03/05/2013 01:52:15 PM (13 years ago)
- Location:
- wp-meetup-activity/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
wp-meetup-activity.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-meetup-activity/trunk/readme.txt
r668363 r676447 40 40 == Changelog == 41 41 42 = 0.1.5 = 43 * Fixed a bug with scheduled events (wp-cron) 44 42 45 = 0.1.4 = 43 46 * Added Meetup events support … … 64 67 == Upgrade Notice == 65 68 69 = 0.1.5 = 70 Bugfix release: scheduled events should not duplicate anymore 71 66 72 = 0.1.4 = 67 73 Added Meetup events support. Can you miss it ? -
wp-meetup-activity/trunk/wp-meetup-activity.php
r668363 r676447 4 4 Plugin URI: http://www.zerozone.it/wordpress-meetup-plugin/ 5 5 Description: Display group activity and events from Meetup.com in a widget for your wordpress 6 Version: 0.1. 46 Version: 0.1.5 7 7 Author: Michele "O-Zone" Pinassi 8 8 Author URI: http://www.zerozone.it/ … … 33 33 34 34 add_option('wpmeetupactivity_apikey', '', '', 'yes'); 35 add_option('wpmeetupactivity_events_desc', 'at %ADDRESS%. There are already %RSVP_YES% booked friends !', '', 'yes'); 35 36 add_action('admin_menu', 'wpmeetupactivity_plugin_menu'); 36 37 add_action('plugins_loaded', 'wpmeetupactivity_widget_init'); 37 add_action('plugins_loaded', 'wpmeetupactivity_update_db_check');38 38 add_action('init', 'wpmeetupactivity_register_styles'); 39 39 add_action('init', 'wpmeetupactivity_fb_init'); 40 40 41 register_activation_hook(__FILE__,'wpmeetupactivity_install'); 42 register_deactivation_hook( __FILE__,'wpmeetupactivity_uninstall'); 41 register_activation_hook(__FILE__,'wpmeetupactivity_activate'); 42 register_deactivation_hook( __FILE__,'wpmeetupactivity_deactivate'); 43 register_uninstall_hook( __FILE__, 'wpmeetupactivity_uninstall'); 43 44 44 45 global $wpdb; 45 46 46 define(WP_MEETUP_ACTIVITY,'0.1. 4');47 define(WP_MEETUP_ACTIVITY,'0.1.5'); 47 48 define(WP_MEETUP_ACTIVITY_TABLE, $wpdb->prefix."meetup_activity"); 48 49 49 50 /* 50 51 51 wpmeetupactivity_install() - Install plugin DATABASE 52 CRON procedures that run every hours to fetch new activity 52 53 53 54 */ 54 function wpmeetupactivity_install() { 55 56 add_action('wpmeetupactivity_hourly', 'wpmeetupactivity_plugin_cron_hourly'); 57 58 function wpmeetupactivity_plugin_cron_hourly() { 59 wpmeetupactivity_fetch_activity(); 60 wpmeetupactivity_fetch_events(); 61 } 62 63 /* 64 65 wpmeetupactivity_activate() - Install plugin DATABASE 66 67 */ 68 function wpmeetupactivity_activate() { 69 if(!wp_next_scheduled('wpmeetupactivity_hourly')) { 70 wp_schedule_event( current_time( 'timestamp' ), 'hourly', 'wpmeetupactivity_hourly'); 71 } 72 } 73 74 function wpmeetupactivity_update_db_check() { 55 75 global $wpdb; 56 76 57 $sql = "CREATE TABLE ".WP_MEETUP_ACTIVITY_TABLE."_act ( 77 if (get_site_option('wpmeetupactivity_db_version') != WP_MEETUP_ACTIVITY) { 78 $sql = "CREATE TABLE ".WP_MEETUP_ACTIVITY_TABLE."_act ( 58 79 id int(10) NOT NULL AUTO_INCREMENT, 59 80 group_id int(12) NOT NULL, … … 68 89 add_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 69 90 UNIQUE KEY id (id) 70 ) DEFAULT CHARSET = utf8;71 72 CREATE TABLE ".WP_MEETUP_ACTIVITY_TABLE."_events (91 ) DEFAULT CHARSET = utf8; 92 93 CREATE TABLE ".WP_MEETUP_ACTIVITY_TABLE."_events ( 73 94 id int(10) NOT NULL AUTO_INCREMENT, 74 95 group_id INT(12) NOT NULL, … … 86 107 PRIMARY KEY id (id), 87 108 UNIQUE KEY event_id (event_id) 88 ) DEFAULT CHARSET = utf8;89 90 CREATE TABLE ".WP_MEETUP_ACTIVITY_TABLE."_groups (109 ) DEFAULT CHARSET = utf8; 110 111 CREATE TABLE ".WP_MEETUP_ACTIVITY_TABLE."_groups ( 91 112 group_id mediumint(10) NOT NULL, 92 113 group_name text NOT NULL, 93 114 add_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 94 115 UNIQUE KEY group_id (group_id) 95 ) DEFAULT CHARSET = utf8;"; 96 97 98 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 99 dbDelta($sql); 100 add_option("wpmeetupactivity_db_version", WP_MEETUP_ACTIVITY); 101 } 102 103 function wpmeetupactivity_update_db_check() { 104 if (get_site_option('wpmeetupactivity_db_version') != WP_MEETUP_ACTIVITY) { 105 wpmeetupactivity_install(); 106 } 116 ) DEFAULT CHARSET = utf8;"; 117 118 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 119 dbDelta($sql); 120 add_option("wpmeetupactivity_db_version", WP_MEETUP_ACTIVITY); 121 122 echo "<div class=\"updated\"><p><strong>"; 123 echo __('Updated DB to '.WP_MEETUP_ACTIVITY, $wpmeetupactivity_textdomain); 124 echo "</strong></p></div>"; 125 126 wpmeetupactivity_activate(); 127 } 128 } 129 130 function wpmeetupactivity_deactivate() { 131 global $wpdb; 132 $timestamp = wp_next_scheduled('wpmeetupactivity_hourly'); 133 wp_unschedule_event($timestamp, 'hourly', 'wpmeetupactivity_hourly'); 107 134 } 108 135 … … 111 138 /* Perform a complete uninstall of DB tables on UNINSTALL */ 112 139 $wpdb->query($wpdb->prepare("DROP ".WP_MEETUP_ACTIVITY_TABLE."_groups; DROP ".WP_MEETUP_ACTIVITY_TABLE."_act;")); 140 /* Disable CRON */ 141 $timestamp = wp_next_scheduled('wpmeetupactivity_hourly'); 142 143 while($timestamp) { 144 wp_unschedule_event($timestamp, 'hourly', 'wpmeetupactivity_hourly'); 145 $timestamp = wp_next_scheduled('wpmeetupactivity_hourly'); 146 } 147 148 149 wp_clear_scheduled_hook( 'wpmeetupactivity_hourly' ); 150 113 151 } 114 152 … … 355 393 function wpmeetupactivity_widget_init() { 356 394 if ( function_exists( 'wp_register_sidebar_widget' ) ) { 357 wp_register_sidebar_widget('wpmeetupactivity','WP-Meetup-Activity', 'wpmeetupactivity_widget_activity' );358 wp_register_sidebar_widget('wpmeetupevents','WP-Meetup-Events', 'wpmeetupactivity_widget_events' );395 wp_register_sidebar_widget('wpmeetupactivity','WP-Meetup-Activity', 'wpmeetupactivity_widget_activity',array('description' => 'Display latest activity on your Meetups')); 396 wp_register_sidebar_widget('wpmeetupevents','WP-Meetup-Events', 'wpmeetupactivity_widget_events',array('description' => 'Display upcoming Meetups')); 359 397 } else { 360 398 // Deprecated function for older WP... … … 530 568 } 531 569 532 /*533 534 CRON procedures that run every hours to fetch new activity535 536 */537 538 register_activation_hook(__FILE__, 'wpmeetupactivity_plugin_cron_activation');539 add_action('wpmeetupactivity_hourly', 'wpmeetupactivity_plugin_cron_hourly');540 541 function wpmeetupactivity_plugin_cron_activation() {542 wp_schedule_event( current_time( 'timestamp' ), 'hourly', 'wpmeetupactivity_hourly');543 }544 545 function wpmeetupactivity_plugin_cron_hourly() {546 wpmeetupactivity_fetch_activity();547 wpmeetupactivity_fetch_events();548 }549 570 550 571 /* … … 718 739 global $wpdb; 719 740 global $facebook; 741 720 742 721 743 load_plugin_textdomain($wpmeetupactivity_textdomain, PLUGINDIR . '/' . dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)));
Note: See TracChangeset
for help on using the changeset viewer.