Recent Topics

1 May 27, 2008 16:14    

My b2evolution Version: 2.x

I would like to reproduce the blog memberlist you see when changing blog user permissions in the admin panel. I would like this list of usernames to appear on one of my sidebars.

anyone know of a widget or a function call that could produce this output?

Thanks.

2 May 27, 2008 17:43

Put this code in sidebar. You may want to edit the user link section or tell me where should it point to. Edit user or user profile?

/*
		 * Authors:
		 * TODO: allow multiple selection
		 */
		echo '<fieldset>';
		echo '<legend>'.T_('Authors').'</legend>';
		// Load current blog members into cache:
		$UserCache->load_blogmembers( $Blog->ID );
		if( count($UserCache->cache) )
		{
			echo '<ul>';
			foreach( $UserCache->cache as $loop_Obj )
			{
				echo '<li><input type="radio" name="author" value="'.$loop_Obj->ID.'" class="radio"';
				if( $loop_Obj->ID == $author ) echo ' checked="checked"';
				echo ' /> <a href="'.regenerate_url( 'author', 'author='.$loop_Obj->ID ).'">';
				$loop_Obj->preferred_name();
				echo '</a></li>';
			}
			echo '</ul>';
		}
		echo '</fieldset>';

3 May 28, 2008 00:58

Thanks for your reply.

Here's what I'm getting....

Notice: Undefined variable: UserCache

and

Fatal error: Call to a member function load_blogmembers() on a non-object

My version is 2.x...not 1.10. I must have accidently checked the wrong version when posting.

4 May 28, 2008 01:46

It's not a big problem. Add the following code before $UserCache->load_blogmembers...

$UserCache = & get_Cache( 'UserCache' );

5 May 28, 2008 01:53

incredible. it works like a charm.

thanks, sam2kb!


Form is loading...