Recent Topics

1 Oct 30, 2005 16:05    

Hi I am rather new to b2. I've been playing around with it for awhile making test blogs, but am only now ready to launch my first live blog. There is one thing I would like to modify if I can, and that is...

When someone registers two new things appear to them. That being an “Edit” and “admin” buttons. Now if they click on ether they are taken to the “back office” page. Once there there are a set of tabs. If they click on any of them they are told “permission denied”, and that is good.

The problem is that for them to get out of there, they can ether use the browser “back” button or use “go to blogs”, which will take the to the “default” blog and not back to the one they came from.

What I really would like is that the “Edit” and “admin” buttons never appear until I manually upgrade there permissions. There doesn't seen to me that there is any reason for them to know that the “back office” even is there since they can't use it anyway.

If someone could tell me how to make it so these button don't switch on until I upgrade them to level 2 or add them to a bloggers group I would greatly appreciate it.

Thanks

2 Oct 31, 2005 15:33

First, the Admin link: One quick way would be to take the user_admin_link() function out of your skins. But if you want it to be available to some users, then try this. Open /b2evocore/_functions_users.php and find this around line 450:

function user_admin_link( $before = '', $after = '', $page = 'b2edit.php', $link_text = '', $link_title = '#' )
{
        global $admin_url, $blog, $current_User;
        
        if( ! is_logged_in() ) return false;
                if( $current_User->get('level') == 0 )
        { // If user is NOT active:
                return false;
        }

change the line that says

  if( $current_User->get('level') == 0 )


to

  if( $current_User->get('level') < 2 )


and only level 2 or higher will see the admin link.

3 Oct 31, 2005 15:38

The edit link will be similar. The quickest way to make them go away is to edit the skin and remove the $Item->edit_link(). But you can find the code for this function in /b2evocore/_class_item.php . Looking at that code, it appears that the 'Edit' link won't show up unless the user has a right to edit the post. So you probably don't need to do anything.

There's also an edit_link function in /b2evocore/_class_comment.php

4 Oct 31, 2005 16:19

Thanks admin link gone :-)

You da manperson!!!

As for edit link, when I click on it, I'm taken to back office where if I click on edit tab, I get “permission denied”, so it seems that the link shows up even though I don't have permission?

Anyway i did find this code in class_item.php


	function edit_link( $before = ' ', $after = ' ', $text = '#', $title = '#', $class = '', $glue = '&amp;' )
	{
		global $current_User, $admin_url;
		
		if( ! is_logged_in() ) return false;

		if( ! $current_User->check_perm( 'blog_post_statuses', $this->status, false,
																			$this->blog_ID ) )
		{	// User has no right to edit this post
			return false;
		}

		if( $text == '#' ) $text = T_('Edit');
		if( $title == '#' ) $title = T_('Edit this post');

		echo $before;
		echo '<a href="'.$admin_url.'/b2edit.php?action=edit'.$glue.'post='.$this->ID;
		echo '" title="'.$title.'"';

		if( !empty( $class ) ) echo ' class="'.$class.'"';
		echo '>'.$text.'</a>';
		echo $after;

		return true;
	}

5 Oct 31, 2005 16:25

Somethings not right if it's showing you the link for an item and then giving you an error when you try to edit that item in the backoffice.


Form is loading...