function amr_trash_the_cache()
{
    ausers_delete_option('amr-users-cache-status');
    $text = __('Cache status records deleted, try building cache again', 'amr-users');
    $text = $text . '<br/>' . '<a href="">' . __('Return', 'amr-users') . '</a>';
    amr_users_message($text);
}
Exemplo n.º 2
0
function ausers_get_option($option)
{
    // allows user reports to be run either at site level and/or at blog level
    global $ausersadminurl, $amr_nicenames;
    if (amr_is_network_admin()) {
        $result = get_site_option('network_' . $option);
    } else {
        $result = get_option($option);
    }
    if (empty($result)) {
        // it's new, get defaults
        //if ($option == 'amr-users-no-lists' ) 	return ameta_default_main(); // old - leave for upgrade check
        if ($option == 'amr-users-main') {
            // and it's empty
            //-------------------------
            //if (WP_DEBUG) echo '<br />Renaming stored option "amr-users-no-lists" to "amr-users-main" ';
            $amain = get_site_option('amr-users-no-lists');
            // might return default ok, if not will have done upgrade check
            if (empty($amain)) {
                $amain = ausers_get_option('amr-users-no-lists');
                if (empty($amain)) {
                    $amain = ameta_default_main();
                }
            }
            $amain['version'] = AUSERS_VERSION;
            ausers_update_option('amr-users-main', $amain);
            ausers_delete_option('amr-users-no-lists');
            return $amain;
            //-------------------------
        }
        if ($option == 'amr-users') {
            return ameta_default_list_options();
        }
        if ($option == 'amr-users-nicenames-excluded') {
            return array('attachment_count' => true, 'activation_key' => true, 'dismissed_wp_pointers' => true, 'default_password_nag' => true, 'nav_menu_item_count' => true, 'revision_count' => true, 'comment_count' => true, 'show_admin_bar_front' => true, 'show_welcome_panel' => true, 'user_activation_key' => true, 'user_status' => true, 'yim' => true, 'aim' => true, 'jabber' => true, 'reply_count' => true, 'topic_count' => true, 'forum_count' => true, 'use_ssl' => true);
        }
        if ($option == 'amr-users-original-keys') {
            return array();
        }
        if ($option == 'amr-users-custom-headings') {
            return array();
        }
        if ($option == 'amr-users-prefixes-in-use') {
            return array();
        }
        if ($option == 'amr-users-nicenames') {
            $amr_nicenames = ameta_defaultnicenames();
        }
    }
    return $result;
}
Exemplo n.º 3
0
 function clear_all_cache()
 {
     global $wpdb;
     $sql = "TRUNCATE " . $this->table_name;
     $results = $wpdb->query($sql);
     if ($results) {
         $text = __('Cache cleared. ', 'amr-users');
     } else {
         $text = __('Error clearing cache, or no cache to clear. ', 'amr-users');
     }
     $result = ausers_delete_option('amr-users-cache-status');
     if ($result) {
         $text .= __('Cache status in db cleared', 'amr-users');
     } else {
         $text .= __('Error clearing cache in db, or no cache to clear', 'amr-users');
     }
     $text = $text . '<br/>' . '<a href="">' . __('Return', 'amr-users') . '</a>';
     amr_users_message($text);
     return $results;
 }
function amr_meta_keys_page()
{
    global $ausersadminurl;
    //amr_meta_main_admin_header('Find fields, make nice names' );
    amr_meta_admin_headings($plugin_page = '');
    // does the nonce check etc
    if (isset($_POST['action']) and !($_POST['action'] === "save")) {
        return;
    }
    echo PHP_EOL . '<div class="clear" style="clear:both;">&nbsp;</div>' . PHP_EOL;
    if (isset($_POST['deleteconfirmed']) and $_POST['deleteconfirmed'] === "Confirm Delete") {
        if (isset($_POST['delete']) and is_array($_POST['delete'])) {
            amr_delete_user_meta($_POST['delete']);
        } else {
            echo amr_users_message(__('No meta_keys selected for deletion', 'amr-users'));
        }
    } elseif (isset($_POST['delete']) and $_POST['delete'] === "Delete") {
        if (isset($_POST['del']) and is_array($_POST['del'])) {
            amr_confirm_delete_user_meta($_POST['del']);
        } else {
            echo amr_users_message(__('No meta_keys selected for deletion', 'amr-users'));
        }
        return;
    } elseif (isset($_POST['update']) and $_POST['update'] === "Update") {
        /* Validate the input and save */
        if (amrmeta_validate_excluded_keys()) {
            // updates inside the function now
        } else {
            echo '<h2>' . __('Validation failed', 'amr-users') . '</h2>';
        }
    } elseif (isset($_POST['resetex']) and $_POST['resetex'] === "Reset") {
        if (ausers_delete_option('amr-users-excluded-meta-keys')) {
            //201410 - wrong optionname
            echo '<h2>' . __('Deleting all excluded keys settings in database', 'amr-users') . '</h2>';
        }
    } else {
        //amrmeta_check_find_keys();
    }
    ameta_list_excluded_keys();
}
function amr_meta_reset()
{
    global $aopt;
    global $amain;
    global $amr_nicenames, $ausersadminurl;
    if (ausers_delete_option('amr-users')) {
        echo '<h2>' . __('Deleting number of lists and names in database', 'amr-users') . '</h2>';
    }
    //	else echo '<h3>'.__('Error deleting number of lists and names in database.','amr-users').'</h3>';
    if (ausers_delete_option('amr-users-main')) {
        echo '<h2>' . __('Deleting all main settings in database', 'amr-users') . '</h2>';
    }
    //	else echo '<h3>'.__('Error deleting all lists settings in database','amr-users').'</h3>';
    if (ausers_delete_option('amr-users-nicenames')) {
        echo '<h2>' . __('Deleting all nice name settings in database', 'amr-users') . '</h2>';
    }
    if (ausers_delete_option('amr-users-nicenames-excluded')) {
        echo '<h2>' . __('Deleting all nice name exclusion settings in database', 'amr-users') . '</h2>';
    }
    if (ausers_delete_option('amr-users-show-in-wplist')) {
        echo '<h2>' . __('Deleting the show in wp list settings', 'amr-users') . '</h2>';
    }
    //	else echo '<h3>'.__('Error deleting all lists settings in database','amr-users').'</h3>';
    if (ausers_delete_option('amr-users-cache-status')) {
        echo '<h2>' . __('Deleting cache status in database', 'amr-users') . '</h2>';
    }
    if (ausers_delete_option('amr-users-original-keys')) {
        echo '<h2>' . __('Deleting original keys mapping in database', 'amr-users') . '</h2>';
    }
    if (ausers_delete_option('amr-users-custom-headings')) {
        echo '<h2>' . __('Deleting custom-headings in database', 'amr-users') . '</h2>';
    }
    if (ausers_delete_option('amr-users-filtering')) {
        echo '<h2>' . __('Deleting amr-users-filtering in database', 'amr-users') . '</h2>';
    }
    if (ausers_delete_option('amr-users-prefixes-in-use')) {
        echo '<h2>' . __('Deleting amr-users-prefixes-in-use in database', 'amr-users') . '</h2>';
    }
    $c = new adb_cache();
    //$c->clear_all_cache();
    $c->deactivate();
    echo '<h2>' . __('All cached listings cleared.', 'amr-users') . '</h2>';
    unset($aopt);
    unset($amain);
    unset($amr_nicenames);
    echo '<h2><a href="' . $ausersadminurl . '?page=ameta-admin-general.php&tab=fields' . '">' . __('Click to find your user fields again.', 'amr-users') . '</a></h2>';
    die;
}
function amr_meta_nice_names_page()
{
    /* may be able to work generically */
    global $amr_nicenames;
    global $ausersadminurl;
    //amr_meta_main_admin_header('Find fields, make nice names' );
    amr_meta_admin_headings($plugin_page = '');
    // does the nonce check etc
    if (isset($_POST['action']) and !($_POST['action'] === "save")) {
        return;
    }
    echo PHP_EOL . '<div class="clear" style="clear:both;">&nbsp;</div>' . PHP_EOL;
    if (isset($_POST['update']) and $_POST['update'] === "Update") {
        /* Validate the input and save */
        if (amrmeta_validate_nicenames()) {
            // updates inside the function now
        } else {
            echo '<h2>' . __('Validation failed', 'amr-users') . '</h2>';
        }
    }
    if (isset($_POST['resetnice'])) {
        if (ausers_delete_option('amr-users-nicenames')) {
            echo '<h2>' . __('Deleting all nice name settings in database', 'amr-users') . '</h2>';
        }
        if (ausers_delete_option('amr-users-nicenames-excluded')) {
            echo '<h2>' . __('Deleting all nice name exclusion settings in database', 'amr-users') . '</h2>';
        }
        if (ausers_delete_option('amr-users-original-keys')) {
            echo '<h2>' . __('Deleting original keys mapping in database', 'amr-users') . '</h2>';
        }
    }
    if (isset($_POST['rebuild']) or isset($_POST['resetnice'])) {
        /* Rebuild the nicenames - could take a while */
        $amr_nicenames = ameta_rebuildnicenames();
        echo '<h3>' . __('Rebuild Complete.', 'amr-users') . '</h3>';
        return;
    } else {
        amrmeta_check_find_fields();
    }
    $amr_nicenames = ausers_get_option('amr-users-nicenames');
    ameta_list_nicenames_for_input($amr_nicenames);
}