Recent Topics

1 Feb 18, 2006 13:01    

Heres a hack to the backoffice that adds a checkbox to the post list instead of delete buttons/links, so you can delete multiple posts at once.

I've sent a pm to blueyed to see if this can get added into the 1.7> releases.

It's made for 1.7 but will probz work for all versions although i havent tested, heres the mod:

NOTE: The changed parts are only in the '//balupton mod {' and '//balupton mod }' comments, everything else is to help you know where to stick the code.

Line 371 of 'admin/edit_actions.php':

case 'delete':
		 * --------------------------------------------------------------------
		 * DELETE a post from db
		$AdminUI->title = T_('Deleting post...');
		require( dirname(__FILE__) . '/_menutop.php' );
		//balupton mod {
		param( 'post', 'string' );
		if( empty($post) ) {
			echo "<div class=\"panelinfo\">\n";
			echo "<h3>Please select at least one post to delete.</h3>\n";
			echo "</div>";
		if(substr($post,strlen($post)-1) == ',')
			$post = substr($post,0,strlen($post)-1);
		$posts = split(',',$post);
		for( $iPosts = 0; $iPosts < sizeof( $posts ); $iPosts++ ) {
			$post = $posts[$iPosts];
			// echo $post;
			if( ! ($edited_Item = & $ItemCache->get_by_ID( $post, false ) ) )
				echo '<div class="panelinfo"><p class="error">'.( T_('Oops, no post with this ID!') ).'</p></div>';
			$blog = $edited_Item->blog_ID;
			$location = 'b2browse.php?blog='.$blog.'&amp;filter=restore';
			// Check permission:
			$current_User->check_perm( 'blog_del_post', '', true, $blog );
			echo "<div class=\"panelinfo\">\n";
			echo '<h3>', T_('Deleting post...'), "</h3>\n";
			echo '<p>'.T_('Deleting Done...')."</p>\n";
			echo '<p>'.T_('No More Post #'.$post)."</p>\n";
			echo '</div>';
		//balupton mod }


Around line 195 of 'admin/':

	// Actions:
	echo '<td class="shrinkwrap">';
	// Display edit button if current user has the rights:
	$Item->edit_link( ' ', ' ', get_icon( 'edit' ), '#', '', $edit_item_url );

	// Display delete button if current user has the rights:
	// balupton mod {
	$canDelete = true;
	if( ! is_logged_in() ) 
		$canDelete =  false;
	if( ! $current_User->check_perm( 'blog_del_post', 'any', false, $Item->blog_ID ) )
	{ // User has right to delete this post
		$canDelete =  false;
	if ( $canDelete ) {
	<input type="checkbox" name="DelCHK<?=$line_count?>" id="DelCHK<?=$line_count?>" value="<?=$Item->ID?>" />
	<?php if ( false )
	$Item->delete_link( ' ', ' ', get_icon( 'delete' ), '#', '', false, $delete_item_url );
	// balupton mod }

	echo "</td>\n";

	echo '</tr>';
echo '</table>';

//balupton mod {
<script language="javascript" type="text/javascript">
function DelCHKFunc() {
	//you owe balupton for this one
	var url = String("<?=$admin_url.'edit_actions.php?action=delete&post='?>");
	var posts = String("");
	for(var i = 0; i < <?=$line_count?>; i++)
		if( document.getElementById("DelCHK"+String(i)).checked == true )
			posts += document.getElementById("DelCHK"+String(i)).value+",";
	if( posts == "" )
		alert('You must select some posts to delete.');
$r = '';
$r .= '<input type="button" title="Delete Selected Posts" value="Delete" onclick="if ( confirm(\'';
$r .= TS_('You are about to delete selected posts!\\n\'Cancel\' to stop, \'OK\' to delete.');
$r .= '\') ) { DelCHKFunc(); }"';
if( !empty( $class ) ) $r .= ' class="'.$class.'"';
$r .= '/>';
echo $r;
//balupton mod }

Around line 109 in the same file as above:

echo '<th>'.T_('Actions')."</th>\n";
echo "</tr>\n";

//balupton mod {
global $current_User, $admin_url;
//balupton mod }

$line_count = 0;
while( $Item = $MainList->get_item() )

Works perfectly for me, tested and all, just need to be updated for translations but thats not my area.

Hope this helps, don't forget to credit me if u use it.


2 Feb 18, 2006 14:51

Actually what would be good is if we keep those select boxes there, and in the sidebar you have:
[Delete Selected]
[Edit Selected]
[Move Selected]
[Delete Comments for Selected]
[Apply Chosen Publication Type for Selected]
[Apply Chosen Date & Time for Selected]

And just use the same stuff in the sidebar, just add those buttons a fair bit of javascript and mod up the actions page a bit, i think when this is done, b2evo will hit a new level for power users and mass blogs.

3 Feb 18, 2006 15:47

balupton, I like your mods.

I'll add it to the todo.

The question would be IMHO if we want the checkbox things with the "Full posts" lists or just the "Post list" list. Or both.

This is a more general design decision and it would mean to also have the checkboxes with the "Comments", "Tracker" and other tabs which might come for consistency reasons.

This has to be reviewed by Fran├žois.

4 Feb 18, 2006 15:59

I think just in the 'Post List' list because thats for power using, and the other is for more general use.
And anyway the functions that the checkboxes supply is for power usage, so you might as well have them in power mode ;)

I think having them in the 'Full Posts' list will just confuse the users, espicially new users who would only be using the 'Full Posts' view and are still getting used to b2evo.

5 Nov 26, 2006 23:59

I was wondering if the same could be done for deleting multiple blogs/users.
With the autoblog plugin there can be many new users and blogs and this would be handy. Using email systems like Gmail, I really miss the select all/none feature in administration, and it is the only thing I miss in b2evo :-)

(by the way, balupton, the gallery plugin is really nice)

6 Nov 27, 2006 03:17

I would imagine multiple deletes could be applied to anything that you could delete...

Although for your case, you would also want to delete a users blog when you delete the user yeh? Which would be more work...

And i don't think it would be that hard to add, especially for you :)

And thanks for the comment on the gallery plugin :-)

7 Feb 27, 2007 20:19


Can you tell me if this will work with 1.9.2?

I have implemented it but cannot get any checkboxes to show.
Privileges are correct for display of delete button
Double checked the hack input

I really like this solution and would really appreciate it if you could enlighten me...


Form is loading...

Open Source CMS – This forum is powered by b2evolution CMS, a complete engine for your website.