/**
 * Updates extra fields. Input validation needed, but we don't know what the user wants to accept...
 *
 * @return void
 * @author Vadimk
 */
function eud_update_ExtraFields()
{
    $get_user_id = get_user_id();
    foreach ($_POST as $key => $value) {
        if (strpos($key, 'eud') === 0) {
            $key = str_replace('eud', '', $key);
            if (!empty($value)) {
                eud_update_option($get_user_id, $key, $value);
            } else {
                eud_delete_option($get_user_id, $key, $value);
            }
        }
    }
}
Esempio n. 2
0
/**
 * Updates extra fields. Input validation needed, but we don't know what the user wants to accept...
 *
 * @return void
 * @author Vadimk
 */
function eud_update_ExtraFields()
{
    $get_user_id = get_user_id();
    $all_fields = unserialize(get_option('eud_fields'));
    $slug2cap = array();
    // This will rewrite any duplicate field setting, anyway it's ambiguous
    foreach ($all_fields as $field) {
        $slug2cap[$field[1]] = $field[3];
    }
    foreach ($_POST as $key => $value) {
        if (strpos($key, 'eud') === 0) {
            $key = str_replace('eud', '', $key);
            if ($key && array_key_exists($key, $slug2cap) && current_user_can($slug2cap[$key])) {
                if (!empty($value)) {
                    eud_update_option($get_user_id, $key, $value);
                } else {
                    eud_delete_option($get_user_id, $key, $value);
                }
            }
        }
    }
}