This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_activation_hook( __FILE__, 'add_last_activity_for_all_users' ); | |
function add_last_activity_for_all_users() { | |
global $wpdb; | |
$sql = $wpdb->prepare( " | |
SELECT | |
u.ID | |
FROM | |
$wpdb->users AS u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$age_filter = function ( $where = '' ) use ( $options ) { | |
$where .= " AND post_date > '" . date( 'Y-m-d', strtotime( '-' . $options[ 'max_post_age' ] ) ) . "'"; | |
return $where; | |
}; | |
add_filter( 'posts_where', $age_filter ); | |
$query = new WP_Query( $args ); | |
remove_filter( 'posts_where', $age_filter ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function basic_bs_register_settings() { | |
register_setting('basic_bs_settings_group', 'basic_bs_settings'); | |
} | |
add_action('admin_init', 'basic_bs_register_settings'); | |
$basic_bs_options = get_option('basic_bs_settings'); | |
function business_tools_admin_menu() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Delay post publishing | |
* Plugin URI: http://unserkaiser.com | |
* Description: Only allows publishing a post if the user registered one week ago. | |
* Version: 0.1 | |
* Author: Franz Josef Kaiser | |
* Author URI: http://unserkaiser.com | |
*/ | |
// Not a WordPress context? Stop. Why? Ask @toscho |