Recent Topics

1 Jun 24, 2005 07:45    

Hi!

My problem is that I didn´t quite get why i have the user rights for blogs and(!) and the user level from 0-10.

I want the users to be able to write into blog, but not able to change entries from others. I tried lot´s of combinations but I only get 2 combinations:

user isn´t able to write anything into blog
or
user is able to write own articles and change texts from other.

How can I create users that can only write, change and delete own articles?

thanks a lot!

Regards,
Andre

2 Jun 24, 2005 08:53

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 :

if( ! is_logged_in() ) return false;

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)

3 Jun 24, 2005 09:00

THX for your help!

:D

4 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 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 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 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 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 Jul 22, 2005 13:11

Thank you; I eagerly await your reply.

10 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 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?".


Form is loading...