Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3361761
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3361761
Commits
afb923a0
Commit
afb923a0
authored
19 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#36716
by m3vrick: made deleting user accounts work.
parent
7c862e92
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/user.module
+32
-23
32 additions, 23 deletions
modules/user.module
modules/user/user.module
+32
-23
32 additions, 23 deletions
modules/user/user.module
with
64 additions
and
46 deletions
modules/user.module
+
32
−
23
View file @
afb923a0
...
...
@@ -40,7 +40,7 @@ function user_external_load($authname) {
* user, such as user name or email address.
*
* @return
* A fully-loaded $user object.
* A fully-loaded $user object
upon successful user load or FALSE if user cannot be loaded
.
*/
function
user_load
(
$array
=
array
())
{
// Dynamically compose a SQL query:
...
...
@@ -75,7 +75,7 @@ function user_load($array = array()) {
user_module_invoke
(
'load'
,
$array
,
$user
);
}
else
{
$user
=
new
StdClass
()
;
$user
=
FALSE
;
}
return
$user
;
...
...
@@ -747,27 +747,32 @@ function user_menu($may_cache) {
}
else
{
if
(
arg
(
0
)
==
'user'
&&
is_numeric
(
arg
(
1
)))
{
$user_exists
=
user_load
(
array
(
'uid'
=>
arg
(
1
),
'status'
=>
1
));
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
),
'title'
=>
t
(
'user'
),
'type'
=>
MENU_CALLBACK
,
'callback'
=>
'user_view'
,
'callback arguments'
=>
arg
(
1
),
'access'
=>
$view_access
);
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/view'
,
'title'
=>
t
(
'view'
),
'access'
=>
$view_access
,
'type'
=>
MENU_DEFAULT_LOCAL_TASK
,
'weight'
=>
-
10
);
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/edit'
,
'title'
=>
t
(
'edit'
),
'callback'
=>
'user_edit'
,
'access'
=>
$admin_access
||
$user
->
uid
==
arg
(
1
),
'type'
=>
MENU_LOCAL_TASK
);
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/delete'
,
'title'
=>
t
(
'delete'
),
'callback'
=>
'user_edit'
,
'access'
=>
$admin_access
,
'type'
=>
MENU_CALLBACK
);
if
(
arg
(
2
)
==
'edit'
)
{
if
((
$categories
=
_user_categories
())
&&
(
count
(
$categories
)
>
1
))
{
foreach
(
$categories
as
$key
=>
$category
)
{
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/edit/'
.
$category
[
'name'
],
'title'
=>
$category
[
'title'
],
'type'
=>
$category
[
'name'
]
==
'account'
?
MENU_DEFAULT_LOCAL_TASK
:
MENU_LOCAL_TASK
,
'weight'
=>
$category
[
'weight'
],
'access'
=>
(
$admin_access
||
$user
->
uid
==
arg
(
1
)));
if
(
$user_exists
!==
FALSE
)
{
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/view'
,
'title'
=>
t
(
'view'
),
'access'
=>
$view_access
,
'type'
=>
MENU_DEFAULT_LOCAL_TASK
,
'weight'
=>
-
10
);
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/edit'
,
'title'
=>
t
(
'edit'
),
'callback'
=>
'user_edit'
,
'access'
=>
$admin_access
||
$user
->
uid
==
arg
(
1
),
'type'
=>
MENU_LOCAL_TASK
);
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/delete'
,
'title'
=>
t
(
'delete'
),
'callback'
=>
'user_edit'
,
'access'
=>
$admin_access
,
'type'
=>
MENU_CALLBACK
);
if
(
arg
(
2
)
==
'edit'
)
{
if
((
$categories
=
_user_categories
())
&&
(
count
(
$categories
)
>
1
))
{
foreach
(
$categories
as
$key
=>
$category
)
{
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/edit/'
.
$category
[
'name'
],
'title'
=>
$category
[
'title'
],
'type'
=>
$category
[
'name'
]
==
'account'
?
MENU_DEFAULT_LOCAL_TASK
:
MENU_LOCAL_TASK
,
'weight'
=>
$category
[
'weight'
],
'access'
=>
(
$admin_access
||
$user
->
uid
==
arg
(
1
)));
}
}
}
}
...
...
@@ -1258,6 +1263,7 @@ function user_edit($category = 'account') {
db_query
(
'DELETE FROM {sessions} WHERE uid = %d'
,
$account
->
uid
);
db_query
(
'DELETE FROM {users_roles} WHERE uid = %d'
,
$account
->
uid
);
db_query
(
'DELETE FROM {authmap} WHERE uid = %d'
,
$account
->
uid
);
watchdog
(
'user'
,
t
(
'Deleted user: %name %email.'
,
array
(
'%name'
=>
theme
(
'placeholder'
,
$account
->
name
),
'%email'
=>
theme
(
'placeholder'
,
'<'
.
$account
->
mail
.
'>'
))),
WATCHDOG_NOTICE
);
drupal_set_message
(
t
(
'The account has been deleted.'
));
module_invoke_all
(
'user'
,
'delete'
,
$edit
,
$account
);
drupal_goto
(
'admin/user'
);
...
...
@@ -1267,8 +1273,12 @@ function user_edit($category = 'account') {
}
}
else
if
(
$_POST
[
'op'
]
==
t
(
'Delete'
))
{
if
(
$_REQUEST
[
'destination'
])
{
$destination
=
drupal_get_destination
();
unset
(
$_REQUEST
[
'destination'
]);
}
// Note: we redirect from user/uid/edit to user/uid/delete to make the tabs disappear.
drupal_goto
(
"user/
$account->uid
/delete"
);
drupal_goto
(
"user/
$account->uid
/delete"
,
$destination
);
}
$form
=
_user_forms
(
$edit
,
$account
,
$category
);
...
...
@@ -1757,13 +1767,12 @@ function user_admin_account() {
$result
=
pager_query
(
$sql
,
50
);
$status
=
array
(
t
(
'blocked'
),
t
(
'active'
));
$destination
=
drupal_get_destination
();
while
(
$account
=
db_fetch_object
(
$result
))
{
$rows
[]
=
array
(
theme
(
'username'
,
$account
),
$status
[
$account
->
status
],
format_interval
(
time
()
-
$account
->
created
),
$account
->
access
?
t
(
'%time ago'
,
array
(
'%time'
=>
format_interval
(
time
()
-
$account
->
access
)))
:
t
(
'never'
),
l
(
t
(
'edit'
),
"user/
$account->uid
/edit"
,
array
()
,
$destination
));
l
(
t
(
'edit'
),
"user/
$account->uid
/edit"
,
array
()));
}
$output
=
theme
(
'table'
,
$header
,
$rows
);
...
...
This diff is collapsed.
Click to expand it.
modules/user/user.module
+
32
−
23
View file @
afb923a0
...
...
@@ -40,7 +40,7 @@ function user_external_load($authname) {
* user, such as user name or email address.
*
* @return
* A fully-loaded $user object.
* A fully-loaded $user object
upon successful user load or FALSE if user cannot be loaded
.
*/
function
user_load
(
$array
=
array
())
{
// Dynamically compose a SQL query:
...
...
@@ -75,7 +75,7 @@ function user_load($array = array()) {
user_module_invoke
(
'load'
,
$array
,
$user
);
}
else
{
$user
=
new
StdClass
()
;
$user
=
FALSE
;
}
return
$user
;
...
...
@@ -747,27 +747,32 @@ function user_menu($may_cache) {
}
else
{
if
(
arg
(
0
)
==
'user'
&&
is_numeric
(
arg
(
1
)))
{
$user_exists
=
user_load
(
array
(
'uid'
=>
arg
(
1
),
'status'
=>
1
));
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
),
'title'
=>
t
(
'user'
),
'type'
=>
MENU_CALLBACK
,
'callback'
=>
'user_view'
,
'callback arguments'
=>
arg
(
1
),
'access'
=>
$view_access
);
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/view'
,
'title'
=>
t
(
'view'
),
'access'
=>
$view_access
,
'type'
=>
MENU_DEFAULT_LOCAL_TASK
,
'weight'
=>
-
10
);
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/edit'
,
'title'
=>
t
(
'edit'
),
'callback'
=>
'user_edit'
,
'access'
=>
$admin_access
||
$user
->
uid
==
arg
(
1
),
'type'
=>
MENU_LOCAL_TASK
);
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/delete'
,
'title'
=>
t
(
'delete'
),
'callback'
=>
'user_edit'
,
'access'
=>
$admin_access
,
'type'
=>
MENU_CALLBACK
);
if
(
arg
(
2
)
==
'edit'
)
{
if
((
$categories
=
_user_categories
())
&&
(
count
(
$categories
)
>
1
))
{
foreach
(
$categories
as
$key
=>
$category
)
{
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/edit/'
.
$category
[
'name'
],
'title'
=>
$category
[
'title'
],
'type'
=>
$category
[
'name'
]
==
'account'
?
MENU_DEFAULT_LOCAL_TASK
:
MENU_LOCAL_TASK
,
'weight'
=>
$category
[
'weight'
],
'access'
=>
(
$admin_access
||
$user
->
uid
==
arg
(
1
)));
if
(
$user_exists
!==
FALSE
)
{
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/view'
,
'title'
=>
t
(
'view'
),
'access'
=>
$view_access
,
'type'
=>
MENU_DEFAULT_LOCAL_TASK
,
'weight'
=>
-
10
);
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/edit'
,
'title'
=>
t
(
'edit'
),
'callback'
=>
'user_edit'
,
'access'
=>
$admin_access
||
$user
->
uid
==
arg
(
1
),
'type'
=>
MENU_LOCAL_TASK
);
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/delete'
,
'title'
=>
t
(
'delete'
),
'callback'
=>
'user_edit'
,
'access'
=>
$admin_access
,
'type'
=>
MENU_CALLBACK
);
if
(
arg
(
2
)
==
'edit'
)
{
if
((
$categories
=
_user_categories
())
&&
(
count
(
$categories
)
>
1
))
{
foreach
(
$categories
as
$key
=>
$category
)
{
$items
[]
=
array
(
'path'
=>
'user/'
.
arg
(
1
)
.
'/edit/'
.
$category
[
'name'
],
'title'
=>
$category
[
'title'
],
'type'
=>
$category
[
'name'
]
==
'account'
?
MENU_DEFAULT_LOCAL_TASK
:
MENU_LOCAL_TASK
,
'weight'
=>
$category
[
'weight'
],
'access'
=>
(
$admin_access
||
$user
->
uid
==
arg
(
1
)));
}
}
}
}
...
...
@@ -1258,6 +1263,7 @@ function user_edit($category = 'account') {
db_query
(
'DELETE FROM {sessions} WHERE uid = %d'
,
$account
->
uid
);
db_query
(
'DELETE FROM {users_roles} WHERE uid = %d'
,
$account
->
uid
);
db_query
(
'DELETE FROM {authmap} WHERE uid = %d'
,
$account
->
uid
);
watchdog
(
'user'
,
t
(
'Deleted user: %name %email.'
,
array
(
'%name'
=>
theme
(
'placeholder'
,
$account
->
name
),
'%email'
=>
theme
(
'placeholder'
,
'<'
.
$account
->
mail
.
'>'
))),
WATCHDOG_NOTICE
);
drupal_set_message
(
t
(
'The account has been deleted.'
));
module_invoke_all
(
'user'
,
'delete'
,
$edit
,
$account
);
drupal_goto
(
'admin/user'
);
...
...
@@ -1267,8 +1273,12 @@ function user_edit($category = 'account') {
}
}
else
if
(
$_POST
[
'op'
]
==
t
(
'Delete'
))
{
if
(
$_REQUEST
[
'destination'
])
{
$destination
=
drupal_get_destination
();
unset
(
$_REQUEST
[
'destination'
]);
}
// Note: we redirect from user/uid/edit to user/uid/delete to make the tabs disappear.
drupal_goto
(
"user/
$account->uid
/delete"
);
drupal_goto
(
"user/
$account->uid
/delete"
,
$destination
);
}
$form
=
_user_forms
(
$edit
,
$account
,
$category
);
...
...
@@ -1757,13 +1767,12 @@ function user_admin_account() {
$result
=
pager_query
(
$sql
,
50
);
$status
=
array
(
t
(
'blocked'
),
t
(
'active'
));
$destination
=
drupal_get_destination
();
while
(
$account
=
db_fetch_object
(
$result
))
{
$rows
[]
=
array
(
theme
(
'username'
,
$account
),
$status
[
$account
->
status
],
format_interval
(
time
()
-
$account
->
created
),
$account
->
access
?
t
(
'%time ago'
,
array
(
'%time'
=>
format_interval
(
time
()
-
$account
->
access
)))
:
t
(
'never'
),
l
(
t
(
'edit'
),
"user/
$account->uid
/edit"
,
array
()
,
$destination
));
l
(
t
(
'edit'
),
"user/
$account->uid
/edit"
,
array
()));
}
$output
=
theme
(
'table'
,
$header
,
$rows
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment