Example #1
0
    $deactivate_url = YMIND_ADMIN_DIR_URL . 'admin.php?page=ymind/admin/ymind_admin.php';
    delete_option('ymind_license_key');
    echo '<script>window.location="' . $deactivate_url . '";</script>';
} else {
    if (isset($_REQUEST['ymind_uninstall']) && isset($_POST['go']) && current_user_can('edit_plugins')) {
        check_admin_referer('deactivate-plugin_' . YMIND_PLUGIN_DIRNAME . 'ymind.php');
        // deactivate using WP's plugin deactivation algorithm
        $current = get_option('active_plugins');
        array_splice($current, array_search(YMIND_PLUGIN_DIRNAME . 'ymind.php', $current), 1);
        update_option('active_plugins', $current);
        do_action('deactivate_' . YMIND_PLUGIN_DIRNAME . '/ymind.php');
        ymind_deactivate();
        //ymind_uninstall is in post so it will do a hard uninstall instead
        echo '<script>document.location="' . YMIND_ADMIN_DIR_URL . '";</script>';
    } else {
        $deactivate_url = YMIND_ADMIN_DIR_URL . 'admin.php?page=' . ymind_get('page') . '&ymind_deactivate=true';
        ?>
		
		<p><?php 
        _e('This will remove all Your Minder data including blocked members, IPs, and Logs. Only use this tool if you really mean to permanently remove Your Minder, otherwise deactivate/activate using the normal Plugin screen.', 'ymind');
        ?>
</p>
		<p><strong><?php 
        _e('Back up before removal! Once done this can not be undone!', 'ymind');
        ?>
</strong></p>
		<input type="button" name="go" value="<?php 
        _e('Remove YMIND and ALL of it\'s Data', 'ymind');
        ?>
" class="button" onclick="if (confirm('<?php 
        _e('Are you sure you want to delete Your Minder?', 'ymind');
function ymind_check_activate_account()
{
    global $wpdb;
    if (ymind_get('ymind_activate')) {
        $sql = 'SELECT user_id
				FROM ' . $wpdb->usermeta . '
				WHERE
					meta_key = "ymind_activation_key"
					AND meta_value = "' . mysql_real_escape_string(ymind_get('ymind_activate')) . '"';
        if ($id = $wpdb->get_var($sql)) {
            update_usermeta($id, 'ymind_locked_out', 0);
            delete_usermeta($id, 'ymind_activation_key');
            $redirect = get_option('ymind_activate_redirect');
            if ($redirect) {
                echo '<script>document.location="' . $redirect . '";</script>';
            }
        }
    }
}