Recent Topics

1 Aug 15, 2008 19:38    

My b2evolution Version: 1.10.x

is there a way to send out a blanket email to all registered users?

If so, is there a way to do it by user type? i would like to send some updates, like a newsletter, to all of the bloggers on my community.

I have looked at the database and found the user table but it only has name and login.

2 Aug 15, 2008 20:16

it's the first time i wont advise advise someone to perform a search : P i remember myself asking Afwas about this one on [url=irc://irc.freenode.net/#b2evolution]Irc[/url], he has mentioned there was a similar post back than, i just had the time to make a quick search however i found nothing but related topics redirecting into each other.. maybe someone would provide the exact link to the solution that i couldnt find and cannot point to atm..But fyr.; it's doable ofc.. good luck in advance

3 Aug 15, 2008 20:21

tilqicom,

thanks for the vote of confidence. I searched but kept hitting dead ends and 'blog by email' stuff.

Hopefully, someone has an idea on this, or an old archived post.

cheers

4 Aug 15, 2008 21:58

Do you really use 1.10.x version or it's a forum bug again?

I made a hack for 2.x
Save the code as conf/hacks.php

<?php

$sender_name = 'Admin';
$sender_address = 'admin@blog.com';
$subject = 'Message subject';
$message = 'Message body';


if( !empty( $_GET['send_messages'] ) )
{
	global $Messages;
	
	$UserCache = & get_Cache( 'UserCache' );
	
	for( $recipient_User = & $UserCache->get_first(); !is_null($recipient_User); $recipient_User = & $UserCache->get_next() )
	{
		$recipient_name = quoted_printable_encode( trim($recipient_User->get('preferredname')) );
		$recipient_address =  $recipient_name.' <'.$recipient_User->get('email').'>';
		
		if( $recipient_User->group_ID != 1 )
		{
			if( send_mail( $recipient_address, $subject, $message, "$sender_name <$sender_address>" ) )
				$Messages->add( sprintf( T_('Your message has been sent to "%s"'), $recipient_User->get('preferredname') ), 'success' );
		}
	}
}


// Quoted printable encode
function quoted_printable_encode( $string, $charset = 'utf-8' )
{
  $string = rawurlencode($string);
  $string = str_replace("%","=",$string);
  return "=?".$charset."?Q?".$string."?=";
}

?>

Type the following in address bar to run the script

YOUR_BLOG/index.php?send_messages=1

If you want to try the script first use
if( $recipient_User->ID == 1 )

5 Aug 15, 2008 22:00

I'll probably make a plugin from this hack with HTML and attachments support.

6 Aug 16, 2008 00:18

sam2kb,

is the userid = 1 what distinguishes admin, bloggers, standard login, etc?

i am currently upgrading to the latest version (2.4.2 i believe), and can run your hack once I am done.

I would really like to push an email to varying levels and customize the email accordingly.

thanks again.

7 Aug 16, 2008 00:24

sam2kb wrote:

Do you really use 1.10.x version or it's a forum bug again?

I was also gonna mention that but i presumed the bug took action already..When talking of that tiny bug; is it really that hard to fix that bug ? or at least disable that dropdown box; so that the user will have to type his version instead of choosing a misleading one ?

8 Aug 16, 2008 02:14

This script was tested for 2 minutes or so that's why I think you should send a test message to admin first

if( $recipient_User->ID == 1 )

Then you can use any combination

Send to all users except Administrators

if( $recipient_User->group_ID != 1 )


Send to users #4 and #9

if( $recipient_User->ID == 4 || $recipient_User->ID == 9 )


Form is loading...