Example #1
0
function new_fields($user_id)
{
    // User muß Admin sein, sonst wird die Funktion nicht ausgeführt
    // GW 150730
    if (!current_user_can('manage_options')) {
        return false;
    }
    $editAllowed = current_user_can('manage_options');
    $fields = array(USER_GENDER => 'datr_gender', USER_TITLE => 'datr_title', USER_MANDANT => 'datr_mandantID', USER_DEPARTMENT => 'datr_department');
    $output = '<h3>' . USER_PROFILE_EXTRA_FIELDS . '</h3>
    <table class="form-table">';
    $output .= "<tr>\n        <th>" . LANGUAGE . "</th>\n            <td>" . View::outputOptions("datr_language", DaschugLocalisation::$languages, get_user_meta($user_id->ID, 'datr_plugin_language', true)) . "</td></tr>";
    foreach ($fields as $key => $value) {
        //View::userFormFieldsOutput($value, get_user_meta($user_id->ID, $value, true), $editAllowed);
        $output .= "<tr>\n            <th>{$key}</th>\n            <td>" . View::userFormFieldsOutput($value, get_user_meta($user_id->ID, $value, true), $editAllowed) . "</td>\n        </tr>";
    }
    $userLocations = EventDatabaseManager::getUserLocations($user_id->ID);
    $locations = EventDatabaseManager::getMandantLocations(get_user_meta($user_id->ID, 'datr_mandantID', true));
    $output .= View::outputUserLocations($locations, $userLocations, $editAllowed);
    $output .= '</table>';
    $output .= '<h3>' . USER_PROFILE_YOUR_ASSIGNMENTS . '</h3>
    <table class="form-table">';
    $output .= '<tr><td></td><td>' . ASSIGNMENTS_TITLE . '</td>';
    foreach (EventDatabaseManager::$userHasTopicsParams as $title => $key) {
        if ($key == 'repetition_frequency_days' or $key == 'topic_expiry_date') {
            // GW 140611
            $output .= "<td>" . $title . "</td>";
        }
    }
    $output .= '</tr>';
    echo $output;
    $topics = EventDatabaseManager::getAllTopics();
    foreach ($topics as $id => $title) {
        View::userHasTopicForm($id, $title, EventDatabaseManager::getAssignedTopicParams($user_id->ID, $id), $editAllowed);
    }
    echo "</table>";
    echo "<script src=\"/wp-content/plugins/daschug/check_user_meta.js\" type=\"text/javascript\"></script>";
}