WordPress.org

Make WordPress Core

Changeset 8916


Ignore:
Timestamp:
09/17/08 04:39:08 (7 years ago)
Author:
ryan
Message:

Edit and Delete links for users. see #7552

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r8911 r8916  
    12281228    if ( current_user_can( 'edit_user', $user_object->ID ) ) { 
    12291229        if ($current_user->ID == $user_object->ID) { 
    1230             $edit = 'profile.php'; 
     1230            $edit_link = 'profile.php'; 
    12311231        } else { 
    1232             $edit = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) ); 
    1233         } 
    1234         $edit = "<a href=\"$edit\">$user_object->user_login</a>"; 
     1232            $edit_link = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) ); 
     1233        } 
     1234        $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />"; 
     1235        $actions = array(); 
     1236        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 
     1237        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users') . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this user '%s'\n  'Cancel' to stop, 'OK' to delete."), $user_object->user_login )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 
     1238        $action_count = count($actions); 
     1239        $i = 0; 
     1240        foreach ( $actions as $action => $link ) { 
     1241            ++$i; 
     1242            ( $i == $action_count ) ? $sep = '' : $sep = ' | '; 
     1243            $edit .= "<span class='$action'>$link$sep</span>"; 
     1244        } 
    12351245    } else { 
    1236         $edit = $user_object->user_login; 
     1246        $edit = '<strong>' . $user_object->user_login . '</strong>'; 
    12371247    } 
    12381248    $role_name = isset($wp_roles->role_names[$role]) ? translate_with_context($wp_roles->role_names[$role]) : __('None'); 
    12391249    $r = "<tr id='user-$user_object->ID'$style> 
    12401250        <th scope='row' class='check-column'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></th> 
    1241         <td><strong>$edit</strong></td> 
     1251        <td>$edit</td> 
    12421252        <td>$user_object->first_name $user_object->last_name</td> 
    12431253        <td><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td> 
  • trunk/wp-admin/users.php

    r8867 r8916  
    115115    check_admin_referer('bulk-users'); 
    116116 
    117     if ( empty($_REQUEST['users']) ) { 
     117    if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { 
    118118        wp_redirect($redirect); 
    119119        exit(); 
     
    123123        $errors = new WP_Error('edit_users', __('You can&#8217;t delete users.')); 
    124124 
    125     $userids = $_REQUEST['users']; 
     125    if ( empty($_REQUEST['users']) ) 
     126        $userids = array(intval($_REQUEST['user'])); 
     127    else 
     128        $userids = $_REQUEST['users']; 
    126129 
    127130    include ('admin-header.php'); 
Note: See TracChangeset for help on using the changeset viewer.