1 knurf Jun 24, 2005 07:45
3 knurf Jun 24, 2005 09:00
THX for your help!
:D
4 topanga Jun 24, 2005 09:07
if( ( $current_User->get( 'ID' ) == $Item->Author->get( 'ID' ) ) || ( $current_User->get( 'ID' ) == 1 ) )
{ // user is author
search is my friend ;)
5 shimmer Jun 30, 2005 06:43
I've been searching over the forums...my question is the same, however the code you gave only gives me errors.
I actually found where you got the code from (at least I'm assuming so) from my searches (the ones I found were on [url=http://forums.b2evolution.net/viewtopic.php?t=2065]this thread[/url] ...EdB's coding), and it worked nicely to remove the edit option within the user admin panel (I'm guessing that's what it is called? Members have to click on a link called "admin" before they can post new entries into the blogs)
But on the blog pages themselves, the edit link is still there. (thereby allowing members to still get to the edit page for those posts) I've been trying to see if there's a way to get users who are not the authors from editing other members' posts, but no matter where I put that code in within the editing section, it doesn't seem to work. (I've just disabled deleting options entirely from the admin account so I'm not worried about that, but I am worried about regular users editing other people's posts out)
It's probably harder since I don't know any php, but I've been doing some other generic web searches so I can read a basic amount of it now, but barely understanding isn't helping me much with perfecting the syntax :-/ Any advice on this would be appreciated
6 topanga Jun 30, 2005 09:15
Shimmer, strange, because I'm using it in my blog.
Only me, the admin, and the author can see the edit link in the blogpost and in the adminsection.
You say it is giving errors... so you have not putted this piece of code in it ?
7 c_ever Jul 21, 2005 10:55
The error message:
Fatal error: Call to a member function on a non-object in /var/www/html/b2/b2evocore/_class_item.php on line 823
I'm using:
if( ( ! $current_User->get( 'ID' ) == $Item->Author->get( 'ID' ) ) || ( ! $current_User->get( 'ID' ) == 1 ) )
{ // user is author
return false;
}
I've also verified that it is: ( ! $current_User->get( 'ID' ) == $Item->Author->get( 'ID' ) ) that causes the problem.
8 topanga Jul 22, 2005 10:52
You are right...
This 'trick' is not working anymore in 0.9.0.12
I'll find out another trick
9 c_ever Jul 22, 2005 13:11
Thank you; I eagerly await your reply.
10 lynnema Aug 25, 2005 23:47
Tacking onto this thread... I want to prevent ANYONE but me from being able to post or edit... How do I do this? When I look at the blog, I see the edit function...
11 edb Aug 26, 2005 00:10
I think I have a better answer than one I posted a long time ago in these forums. I should one day go back and edit the post that gives only a partial answer, but for now let's live in the present.
First off, and this should apply to lynnema's issue: if you don't give permission to post in a blog then they can't. Same for editing: if you don't give permission to edit then they can't edit ANYTHING - including their own posts.
Okay so you want to give permission to post and edit, but you don't want the author to edit everyone's stuff. [url=http://wonderwinds.com/hackblog.php/2005/01/31/lim_iting_who_can_delete_edit_publish_po]Try this hack[/url] - I use it successfully on v12. TTBOMK it works, but since I'm always logged in I can't really tell... okay - it works. I just opened myself in IE and do not have a link to edit posts. This hack works by going straight to the actual function the edit links (front or back) uses to ask "are you logged in and if so are you the author?".
the userlevel for the moment is used in version 0.9.0.x for 4 things :
level 0 : he can do nothing in the adminpanel. The admin has to promote him to minimum level 1 so he can do stuff.
level 1-2-3-4 : a normal user (you can use the level if you only want certain users to be able to upload pictures)
from level 5 on : the user can fill in/change the date when a post wil be published
level 10 : admin
in version 0.9.0.x there is no check if the user is able to alter posts that are not his own, when he has the rights to write/delete posts.
You can 'easily' hack the core if you definitely don't want that.
somewhere in the file b2evocore/_class_item.php (line 877), you will see this :
function delete_link
and
function edit_link
In both functions you have this line :
You have to add a test if the user is the author of the post.
I don't know it any more on the top of my head (don't the code here with me)