Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
228
Merge Requests
228
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
4b0ce935
Commit
4b0ce935
authored
Feb 26, 2013
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1634280
by EclipseGc, rlmumford: drupal_anonymous_user() should return a User entity.
parent
7da4cad9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
11 deletions
+13
-11
core/includes/bootstrap.inc
core/includes/bootstrap.inc
+11
-7
core/includes/theme.inc
core/includes/theme.inc
+0
-2
core/modules/comment/lib/Drupal/comment/CommentStorageController.php
...s/comment/lib/Drupal/comment/CommentStorageController.php
+1
-1
core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
...es/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
+1
-1
No files found.
core/includes/bootstrap.inc
View file @
4b0ce935
...
...
@@ -15,6 +15,7 @@
use
Drupal\Core\Language\Language
;
use
Drupal\Core\Lock\DatabaseLockBackend
;
use
Drupal\Core\Lock\LockBackendInterface
;
use
Drupal\user\Plugin\Core\Entity\User
;
/**
* @file
...
...
@@ -2032,15 +2033,18 @@ function drupal_hash_base64($data) {
/**
* Generates a default anonymous $user object.
*
* @return Object - the user object.
* @return Drupal\user\Plugin\Core\Entity\User
* The user object.
*/
function
drupal_anonymous_user
()
{
$user
=
new
stdClass
();
$user
->
uid
=
0
;
$user
->
hostname
=
ip_address
();
$user
->
roles
=
array
();
$user
->
roles
[
DRUPAL_ANONYMOUS_RID
]
=
DRUPAL_ANONYMOUS_RID
;
return
$user
;
$values
=
array
(
'uid'
=>
0
,
'hostname'
=>
ip_address
(),
'roles'
=>
array
(
DRUPAL_ANONYMOUS_RID
=>
DRUPAL_ANONYMOUS_RID
,
),
);
return
new
User
(
$values
,
'user'
);
}
/**
...
...
core/includes/theme.inc
View file @
4b0ce935
...
...
@@ -2650,8 +2650,6 @@ function _template_preprocess_default_variables() {
'title_prefix'
=>
array
(),
'title_suffix'
=>
array
(),
'db_is_active'
=>
!
defined
(
'MAINTENANCE_MODE'
),
// User module overrides these when it is loaded.
'user'
=>
drupal_anonymous_user
(),
'is_admin'
=>
FALSE
,
'logged_in'
=>
FALSE
,
);
...
...
core/modules/comment/lib/Drupal/comment/CommentStorageController.php
View file @
4b0ce935
...
...
@@ -148,7 +148,7 @@ protected function preSave(EntityInterface $comment) {
}
// We test the value with '===' because we need to modify anonymous
// users as well.
if
(
$comment
->
uid
->
target_id
===
$user
->
uid
&&
isset
(
$user
->
name
)
)
{
if
(
$comment
->
uid
->
target_id
===
$user
->
uid
&&
$user
->
uid
)
{
$comment
->
name
->
value
=
$user
->
name
;
}
// Add the values which aren't passed into the function.
...
...
core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
View file @
4b0ce935
...
...
@@ -33,7 +33,7 @@ function setUp() {
parent
::
setUp
();
$this
->
account
=
$this
->
drupalCreateUser
();
$this
->
anonymous
=
entity_create
(
'user'
,
(
array
)
drupal_anonymous_user
()
);
$this
->
anonymous
=
drupal_anonymous_user
(
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment