writing plugins for wordpress mu
DESCRIPTION
Slides for my writing plugins presentation at WordCamp NYC 2009.TRANSCRIPT
- 1. WordCamp NYC 2009 Writing Plugins for WordPress MU by Ron Rennick
2. Where to find me
- http://wpmututorials.com
- http://ronandandrea.com /contact/
- http://freebpthemes.com
- http://musupport.net
- @wpmuguru
- http://profiles.wordpress.org/wpmuguru
3. Overview
- A little out of order -
- Background
- Traps
- Tips
- Tricks
- Discussion
4. Background
- Freelancing 16 years
- Teaching
- WordPress
5. Traps
- Template tags
6. Traps
- Template tags
- $_SERVER['PHP_SELF']
7. Traps
- Template tags
- $_SERVER['PHP_SELF']
- wp-content/uploads
8. Traps
- Template tags
- $_SERVER['PHP_SELF']
- wp-content/uploads
- plugin tables
9. Tips
- Am I WordPress MU ?
-
- global $wpmu_version;
-
- if( isset( $wpmu_version ) ) {
-
-
- // do MU specific code
-
-
- } else {
-
-
- // do standard WP code
-
-
- }
10. Tips
- Globals/Constants
- $current_blog
- $current_site
11. Tips
- Globals/Constants
- $current_blog
- $current_site
- VHOST
- $bp
12. Tips
- Functions
- get_site_option($key, $default)
- update_site_option($key, $value)
- is_site_admin()
13. Tips
- Functions
- get_site_option($key, $default)
- update_site_option($key, $value)
- is_site_admin()
- switch_to_blog($id)/restore_current_blog()
- $wpdb->get_blog_prefix($id)
14. Tips
- Constants
- WPMU_PLUGIN_DIR
- WPMU_PLUGIN_URL
- BLOGUPLOADDIR
15. Tips
- Global tables
- $wpdb->site
- $wpdb->blogs
- $wpdb->sitemeta
- $wpdb->sitecategories
16. Tricks
- Filters
- 'pre_site_option_' . $key
- 'site_option_' . $key
- 'pre_update_site_option_' . $key
- 'pre_add_site_option_' . $key
17. Tricks
- Hooks
- muplugins_loaded
- delete_blog
- wpmu_new_user
- wpmu_new_blog
18. Tricks
- Functions
- get_site_option($key, $default)
- update_site_option($key, $value)
19. Tricks
- Functions
- get_site_option($key, $default)
- update_site_option($key, $value)
- Tables
- make it global
- add blog_id field to table
20. Remember Code is poetry