By jeepfreak on
I must get this working. It's been one of the biggest selling points on my site... manage your own comments.
I've been hacking at comments.module and I've got the "edit" and "delete" links to show up by changing code around line 184.
Unfortunatly, when the links were clicked, I got "Access denied - You are not authorized to access this page."
So, I changed line 89 thinking that would cover it, but it doesn't and I don't see anything near line 955 or in the comment_delete function that needs changing.
What am I missing?
Thank you,
Billy
Comments
Sorry, I should have posted
Sorry, I should have posted snippets of the code for reference:
To get the links to show up, I edited line 684 (not 184 as previously stated)... The if(user_access('administer comments')) line below.
Then I edited the $access but it didn't fix the 'access denied' error.
To make this work properly
To make this work properly is slightly more complicated than I'm afraid you want it to be.
You're going to have to do 2 things.
First, for admin/comment/edit and /delete, change
'access' => $accessto'access' => 1Then, you'll need to edit comment_admin_edit() to actually check to see if the current user (use
global $userto get access to the $user variable, and compare$node->uidto$user->uidonce $node is loaded). Your code will look something like this:Now the bad news: I just looked at comment_admin_edit() and $node isn't actually loaded at that stage. SO you're going to have to get the uid like this:
Then use that $uid rather than $node->uid above.
You'll also need to make sure you get the right $cid -- it can come either as an argument or as
$edit['cid']depending on the context the function is called in.Now, the bit that actually saves teh comment then does a
drupal_goto('admin/comment')-- that won't be appropriate for all users. You'll want to check to see if the user has administer comments access, and if not, go to the node. Or maybe just edit that go to the node.You'll have to do similar things to comment_delete().
Does this all make sense? I wrote all this with the hope that you've gotten this far, you're familiar enough with PHP and Drupal that you can piece together what needs to be done with this info, but that's me making a wild guess at your knowledge.
Good luck!
-- Merlin
[Point the finger: Assign Blame!]
[Read my writing: ehalseymiles.com]
-- Merlin
[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]
That looks do-able for me.
That looks do-able for me. Thank you so much. I'll implement the changes and post the results.
Thanks again,
Billy