コード例 #1
0
if (!current_user_can('manage_options')) {
    wp_die(printf('<div class="error fade"><p>%s</p></div>', __('You are not allowed to change the options of this plugin.', MAILUSERS_I18N_DOMAIN)));
}
if (mailusers_get_installed_version() != mailusers_get_current_version()) {
    ?>
	<div class="error fade">
		<p><?php 
    _e('It looks like you have an old version of the plugin activated. Please deactivate the plugin and activate it again to complete the installation of the new version.', MAILUSERS_I18N_DOMAIN);
    ?>
	</p>		
	<p>
		<?php 
    _e('Installed Version:', MAILUSERS_I18N_DOMAIN);
    ?>
 <?php 
    echo mailusers_get_installed_version();
    ?>
 <br/>
		<?php 
    _e('Current Version:', MAILUSERS_I18N_DOMAIN);
    ?>
 <?php 
    echo mailusers_get_current_version();
    ?>
	</p>
	</div>		
<?php 
}
//  Check to see if wp_mail() has been overloaded
if (class_exists('ReflectionFunction')) {
    $wp_mail = new ReflectionFunction('wp_mail');
コード例 #2
0
ファイル: email-users.php プロジェクト: kosir/thatcamp-org
function mailusers_plugin_activation()
{
    mailusers_init_i18n();
    $installed_version = mailusers_get_installed_version();
    if ($installed_version == mailusers_get_current_version()) {
        // do nothing
    } elseif ($installed_version == '') {
        $plugin_settings = mailusers_get_default_plugin_settings();
        //  Add the options which will add them if they don't
        //  exist but won't overwrite any existing settings.
        foreach ($plugin_settings as $key => $value) {
            add_option($key, $value);
        }
        mailusers_add_default_capabilities();
        mailusers_add_default_user_meta();
    } else {
        if ($installed_version >= '2.0' && $installed_version < '3.0.0') {
            // Version 2.x, a bug was corrected in the template, update it
            $plugin_settings = mailusers_get_default_plugin_settings();
            //  Add the options which will add them if they don't
            //  exist but won't overwrite any existing settings.
            foreach ($plugin_settings as $key => $value) {
                add_option($key, $value);
            }
            delete_option('mailusers_mail_user_level');
            delete_option('mailusers_mail_method');
            delete_option('mailusers_smtp_port');
            delete_option('mailusers_smtp_server');
            delete_option('mailusers_smtp_user');
            delete_option('mailusers_smtp_authentication');
            delete_option('mailusers_smtp_password');
            // Remove old capabilities
            $role = get_role('editor');
            $role->remove_cap('email_users');
            mailusers_add_default_capabilities();
            mailusers_add_default_user_meta();
        } else {
        }
    }
    // Update version number
    update_option('mailusers_version', mailusers_get_current_version());
}