Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3174996
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-3174996
Commits
b03af772
Commit
b03af772
authored
17 years ago
by
Gábor Hojtsy
Browse files
Options
Downloads
Patches
Plain Diff
#174233
by webernet: fix notices when editing comments and also fix a moderation bug along the way
parent
ac43420b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/comment/comment.module
+9
-6
9 additions, 6 deletions
modules/comment/comment.module
with
9 additions
and
6 deletions
modules/comment/comment.module
+
9
−
6
View file @
b03af772
...
...
@@ -773,7 +773,12 @@ function comment_save($edit) {
global
$user
;
if
(
user_access
(
'post comments'
)
&&
(
user_access
(
'administer comments'
)
||
node_comment_mode
(
$edit
[
'nid'
])
==
COMMENT_NODE_READ_WRITE
))
{
if
(
!
form_get_errors
())
{
$edit
+=
array
(
'mail'
=>
''
,
'homepage'
=>
''
,
'name'
=>
''
);
$edit
+=
array
(
'mail'
=>
''
,
'homepage'
=>
''
,
'name'
=>
''
,
'status'
=>
user_access
(
'post comments without approval'
)
?
COMMENT_PUBLISHED
:
COMMENT_NOT_PUBLISHED
,
);
if
(
$edit
[
'cid'
])
{
// Update the comment in the database.
db_query
(
"UPDATE
{
comments
}
SET status = %d, timestamp = %d, subject = '%s', comment = '%s', format = %d, uid = %d, name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d"
,
$edit
[
'status'
],
$edit
[
'timestamp'
],
$edit
[
'subject'
],
$edit
[
'comment'
],
$edit
[
'format'
],
$edit
[
'uid'
],
$edit
[
'name'
],
$edit
[
'mail'
],
$edit
[
'homepage'
],
$edit
[
'cid'
]);
...
...
@@ -786,8 +791,6 @@ function comment_save($edit) {
}
else
{
// Add the comment to database.
$status
=
user_access
(
'post comments without approval'
)
?
COMMENT_PUBLISHED
:
COMMENT_NOT_PUBLISHED
;
// Here we are building the thread field. See the documentation for
// comment_render().
if
(
$edit
[
'pid'
]
==
0
)
{
...
...
@@ -838,7 +841,7 @@ function comment_save($edit) {
$edit
[
'name'
]
=
$user
->
name
;
}
db_query
(
"INSERT INTO
{
comments
}
(nid, pid, uid, subject, comment, format, hostname, timestamp, status, thread, name, mail, homepage) VALUES (%d, %d, %d, '%s', '%s', %d, '%s', %d, %d, '%s', '%s', '%s', '%s')"
,
$edit
[
'nid'
],
$edit
[
'pid'
],
$edit
[
'uid'
],
$edit
[
'subject'
],
$edit
[
'comment'
],
$edit
[
'format'
],
ip_address
(),
$edit
[
'timestamp'
],
$status
,
$thread
,
$edit
[
'name'
],
$edit
[
'mail'
],
$edit
[
'homepage'
]);
db_query
(
"INSERT INTO
{
comments
}
(nid, pid, uid, subject, comment, format, hostname, timestamp, status, thread, name, mail, homepage) VALUES (%d, %d, %d, '%s', '%s', %d, '%s', %d, %d, '%s', '%s', '%s', '%s')"
,
$edit
[
'nid'
],
$edit
[
'pid'
],
$edit
[
'uid'
],
$edit
[
'subject'
],
$edit
[
'comment'
],
$edit
[
'format'
],
ip_address
(),
$edit
[
'timestamp'
],
$
edit
[
'
status
'
]
,
$thread
,
$edit
[
'name'
],
$edit
[
'mail'
],
$edit
[
'homepage'
]);
$edit
[
'cid'
]
=
db_last_insert_id
(
'comments'
,
'cid'
);
// Tell the other modules a new comment has been submitted.
...
...
@@ -854,11 +857,11 @@ function comment_save($edit) {
// Explain the approval queue if necessary, and then
// redirect the user to the node he's commenting on.
if
(
$status
==
COMMENT_NOT_PUBLISHED
)
{
if
(
$
edit
[
'
status
'
]
==
COMMENT_NOT_PUBLISHED
)
{
drupal_set_message
(
t
(
'Your comment has been queued for moderation by site administrators and will be published after approval.'
));
}
else
{
comment_invoke_comment
(
$edit
,
'publish'
);
comment_invoke_comment
(
$edit
,
'publish'
);
}
return
$edit
[
'cid'
];
}
...
...
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