Make WordPress Core


Ignore:
Timestamp:
05/11/2006 11:05:45 PM (18 years ago)
Author:
ryan
Message:

Backport nonces and pluggable cookies.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/wp-includes/functions.php

    r3745 r3771  
    306306
    307307function get_user_option( $option, $user = 0 ) {
    308     global $wpdb, $current_user;
     308    global $wpdb;
    309309   
    310310    if ( empty($user) )
    311         $user = $current_user;
     311        $user = wp_get_current_user();
    312312    else
    313313        $user = get_userdata($user);
     
    11481148}
    11491149
     1150// Setup global user vars.  Used by set_current_user() for back compat.
     1151function setup_userdata($user_id = '') {
     1152    global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity;
     1153
     1154    if ( '' == $user_id )
     1155        $user = wp_get_current_user();
     1156    else
     1157        $user = new WP_User($user_id);
     1158
     1159    if ( 0 == $user->ID )
     1160        return;
     1161
     1162    $userdata = $user->data;
     1163    $user_login = $user->user_login;
     1164    $user_level = $user->user_level;
     1165    $user_ID    = $user->ID;
     1166    $user_email = $user->user_email;
     1167    $user_url   = $user->user_url;
     1168    $user_pass_md5  = md5($user->user_pass);
     1169    $user_identity  = $user->display_name;
     1170}
     1171
    11501172function is_new_day() {
    11511173    global $day, $previousday;
     
    22892311}
    22902312
     2313function wp_nonce_url($actionurl, $action = -1) {
     2314    return add_query_arg('_wpnonce', wp_create_nonce($action), $actionurl);
     2315}
     2316
     2317function wp_nonce_field($action = -1) {
     2318    echo '<input type="hidden" name="_wpnonce" value="' . wp_create_nonce($action) . '" />';
     2319}
     2320
    22912321?>
Note: See TracChangeset for help on using the changeset viewer.