- b2evolution CMS Support Forums
- b2evolution Development
- A look into the future
- Feature requests and Feedback
- Massmail v. 1.8+
1 partus Jan 17, 2007 15:25
Hi folks,
I found the following hack
http://forums.b2evolution.net/viewtopic.php?t=4825&highlight=mass+mail
but it seems for an older version.
Now I tried a hack for version 1.86, but it doesn't work.
File "inc/view/user/_users_list.php"
In "Backend/Users" I wanted to open my Email-Client on clicking a button with bcc to all bloggers, but the hack only put myself in the related field...
I think this feature should implemented in a maintaince release or does anybody have a hack/idea for massmail to all bloggers?
Any suggestions?
<?php
/**
* This file implements the UI view for the user/group list for user/group editing.
*
* This file is part of the evoCore framework - {@link http://evocore.net/}
* See also {@link http://sourceforge.net/projects/evocms/}.
*
* @copyright (c)2003-2006 by Francois PLANQUE - {@link http://fplanque.net/}
*
* {@internal License choice
* - If you have received this file as part of a package, please find the license.txt file in
* the same folder or the closest folder above for complete license terms.
* - If you have received this file individually (e-g: from http://cvs.sourceforge.net/viewcvs.py/evocms/)
* then you must choose one of the following licenses before using the file:
* - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
* - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
* }}
*
* {@internal Open Source relicensing agreement:
* }}
*
* @package admin
*
* {@internal Below is a list of authors who have contributed to design/coding of this file: }}
* @author fplanque: Francois PLANQUE
*
* @version $Id: _users_list.php,v 1.4.2.4 2006/07/16 16:48:48 blueyed Exp $
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
/**
* @var User
*/
global $current_User;
/**
* @var GeneralSettings
*/
global $Settings;
/**
* @var DB
*/
global $DB;
// query which groups have users (in order to prevent deletion of groups which have users)
global $usedgroups; // We need this in a callback below
$usedgroups = $DB->get_col( 'SELECT grp_ID
FROM T_groups INNER JOIN T_users ON user_grp_ID = grp_ID
GROUP BY grp_ID');
/*
* Query user list:
*/
$keywords = $Request->param( 'keywords', 'string', '', true );
$where_clause = '';
if( !empty( $keywords ) )
{
$kw_array = split( ' ', $keywords );
foreach( $kw_array as $kw )
{
$where_clause .= 'CONCAT( user_login, \' \', user_firstname, \' \', user_lastname, \' \', user_nickname, \' \', user_email) LIKE "%'.$DB->escape($kw).'%" AND ';
}
}
$sql = "SELECT T_users.*, grp_ID, grp_name
FROM T_users RIGHT JOIN T_groups ON user_grp_ID = grp_ID
WHERE $where_clause 1
ORDER BY grp_name, *";
$Results = & new Results( $sql, 'user_', '-A' );
$Results->title = T_('Groups & Users');
/*
* Table icons:
*/
if( $current_User->check_perm( 'users', 'edit', false ) )
{ // create new user link
$Results->global_icon( T_('Add a user...'), 'new', '?ctrl=users&action=new_user', T_('Add user'), 3, 4 );
$Results->global_icon( T_('Add a group...'), 'new', '?ctrl=users&action=new_group', T_('Add group'), 3, 4 );
}
/**
* Callback to add filters on top of the result set
*
* @param Form
*/
function filter_userlist( & $Form )
{
global $Request;
$Form->text( 'keywords', $Request->get('keywords'), 20, T_('Keywords'), T_('Separate with space'), 50 );
}
$Results->filter_area = array(
'callback' => 'filter_userlist',
'url_ignore' => 'results_user_page,keywords',
'presets' => array(
'all' => array( T_('All users'), '?ctrl=users' ),
)
);
/*
* Grouping params:
*/
$Results->group_by = 'grp_ID';
$Results->ID_col = 'user_ID';
/*
* Group columns:
*/
$Results->grp_cols[] = array(
'td_class' => 'firstcol'.($current_User->check_perm( 'users', 'edit', false ) ? '' : ' lastcol' ),
'td_colspan' => -1, // nb_colds - 1
'td' => '<a href="?ctrl=users&grp_ID=$grp_ID$">$grp_name$</a>'
.'¤conditional( (#grp_ID# == '.$Settings->get('newusers_grp_ID').'), \' <span class="notes">('.T_('default group for new users').')</span>\' )¤',
);
function grp_actions( & $row )
{
global $usedgroups, $Settings;
$r = action_icon( T_('Edit this group...'), 'edit', regenerate_url( 'action', 'grp_ID='.$row->grp_ID ) );
$r .= action_icon( T_('Duplicate this group...'), 'copy', regenerate_url( 'action', 'action=new_group&grp_ID='.$row->grp_ID ) );
if( ($row->grp_ID != 1) && ($row->grp_ID != $Settings->get('newusers_grp_ID')) && !in_array( $row->grp_ID, $usedgroups ) )
{ // delete
$r .= action_icon( T_('Delete this group!'), 'delete', regenerate_url( 'action', 'action=delete_group&grp_ID='.$row->grp_ID ) );
}
return $r;
}
$Results->grp_cols[] = array(
'td_class' => 'shrinkwrap',
'td' => '%grp_actions( {row} )%',
);
/*
* Data columns:
*/
$Results->cols[] = array(
'th' => T_('ID'),
'th_class' => 'shrinkwrap',
'td_class' => 'shrinkwrap',
'order' => 'user_ID',
'td' => '$user_ID$',
);
$Results->cols[] = array(
'th' => T_('Login'),
'order' => 'user_login',
'td' => '<a href="?ctrl=users&user_ID=$user_ID$">$user_login$</a>',
);
$Results->cols[] = array(
'th' => T_('Nickname'),
'order' => 'user_nickname',
'td' => '$user_nickname$',
);
$Results->cols[] = array(
'th' => T_('Name'),
'order' => 'user_lastname, user_firstname',
'td' => '$user_firstname$ $user_lastname$',
);
// START mass email hack part 1
$mass_list = '';
// END mass email hack part 1
function user_mailto( $email )
{
// START mass email hack part 2
global $mass_list;
// END mass email hack part 2
if( empty( $email ) )
{
return ' ';
}
// START mass email hack part 3
$mass_list .= $email.', ';
// END mass email hack part 3
return action_icon( T_('Email').': '.$email, 'email', 'mailto:'.$email, T_('Email') );
}
$Results->cols[] = array(
'th' => T_('Email'),
'td_class' => 'shrinkwrap',
'td' => '%user_mailto( #user_email# )%',
);
$Results->cols[] = array(
'th' => T_('URL'),
'td_class' => 'shrinkwrap',
'td' => '¤conditional( (#user_url# != \'http://\') && (#user_url# != \'\'), \'<a href="$user_url$" title="Website: $user_url$">'
.get_icon( 'www', 'imgtag', array( 'class' => 'middle', 'title' => 'Website: $user_url$' ) ).'</a>\', \' \' )¤',
);
if( ! $current_User->check_perm( 'users', 'edit', false ) )
{
$Results->cols[] = array(
'th' => T_('Level'),
'td_class' => 'right',
'order' => 'user_level',
'default_dir' => 'D',
'td' => '$user_level$',
);
}
else
{
// START mass email hack part 4
$mass_list = substr($mass_list, 0, -2);
$mass_to = $current_User->get('email');
echo '<a href="mailto:'.$mass_to.'?bcc='.$mass_list.'" title="e-mail all users"><img src="rsc/img/massemail.png" alt="E-Mail an alle User" class="middle" /> E-Mail an alle User</a> ';
// END mass email hack part 4
$Results->cols[] = array(
'th' => T_('Level'),
'td_class' => 'right',
'order' => 'user_level',
'default_dir' => 'D',
'td' => '¤conditional( (#user_level# > 0), \''
.action_icon( TS_('Decrease user level'), 'decrease',
'%regenerate_url( \'action\', \'action=promote&prom=down&user_ID=$user_ID$\' )%' ).'\' )¤'
.'$user_level$ '
.'¤conditional( (#user_level# < 10), \''
.action_icon( TS_('Increase user level'), 'increase',
'%regenerate_url( \'action\', \'action=promote&prom=up&user_ID=$user_ID$\' )%' ).'\' )¤',
);
$Results->cols[] = array(
'th' => T_('Actions'),
'td_class' => 'shrinkwrap',
'td' => action_icon( T_('Edit this user...'), 'edit', '%regenerate_url( \'action\', \'user_ID=$user_ID$\' )%' )
.action_icon( T_('Duplicate this user...'), 'copy', '%regenerate_url( \'action\', \'action=new_user&user_ID=$user_ID$\' )%' )
.'¤conditional( (#user_ID# != 1) && (#user_ID# != '.$current_User->ID.'), \''
.action_icon( T_('Delete this user!'), 'delete', '%regenerate_url( \'action\', \'action=delete_user&user_ID=$user_ID$\' )%' ).'\' )¤'
);
}
// Display result :
$Results->display();
/*
nolog */
?>
____________________________________
Tried to work it on
Code below. We've done it with a SQL- Query