| View previous topic :: View next topic |
| Author |
Message |
adriscoll Seasoned Poster

 Joined: 31 May 2007 Posts: 75
  
|
Posted: Fri Aug 15, 2008 12:38 Post subject: [1.10.x] emailing registered users |
|
|
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. |
|
| Back to top |
|
 |
tilqicom Guru

Joined: 14 Nov 2007 Posts: 1624
       votes: 20
|
Posted: Fri Aug 15, 2008 13:16 Post subject: |
|
|
it's the first time i wont advise advise someone to perform a search : P i remember myself asking Afwas about this one on Irc, 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 _________________
.: linkback ≠ spam, yes to linkback, no to spam  |
|
| Back to top |
|
 |
adriscoll Seasoned Poster

 Joined: 31 May 2007 Posts: 75
  
|
Posted: Fri Aug 15, 2008 13:21 Post subject: dead end search |
|
|
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 |
|
| Back to top |
|
 |
sam2kb da ruski mafia
Joined: 02 Dec 2007 Posts: 2927
   votes: 53
|
Posted: Fri Aug 15, 2008 14:58 Post subject: |
|
|
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: |
<?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
| Code: |
| YOUR_BLOG/index.php?send_messages=1 |
If you want to try the script first use
if( $recipient_User->ID == 1 ) _________________ Russian b2evolution | Download |
|
| Back to top |
|
 |
sam2kb da ruski mafia
Joined: 02 Dec 2007 Posts: 2927
   votes: 53
|
Posted: Fri Aug 15, 2008 15:00 Post subject: |
|
|
I'll probably make a plugin from this hack with HTML and attachments support. _________________ Russian b2evolution | Download |
|
| Back to top |
|
 |
adriscoll Seasoned Poster

 Joined: 31 May 2007 Posts: 75
  
|
Posted: Fri Aug 15, 2008 17:18 Post subject: emailing by designation |
|
|
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. |
|
| Back to top |
|
 |
tilqicom Guru

Joined: 14 Nov 2007 Posts: 1624
       votes: 20
|
Posted: Fri Aug 15, 2008 17:24 Post subject: version bug |
|
|
| 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 ? _________________
.: linkback ≠ spam, yes to linkback, no to spam  |
|
| Back to top |
|
 |
sam2kb da ruski mafia
Joined: 02 Dec 2007 Posts: 2927
   votes: 53
|
Posted: Fri Aug 15, 2008 19:14 Post subject: |
|
|
This script was tested for 2 minutes or so that's why I think you should send a test message to admin first
| PHP: |
|
if( $recipient_User->ID == 1 )
|
Then you can use any combination
Send to all users except Administrators
| PHP: |
|
if( $recipient_User->group_ID != 1 )
|
Send to users #4 and #9
| PHP: |
|
if( $recipient_User->ID == 4 || $recipient_User->ID == 9 )
|
_________________ Russian b2evolution | Download |
|
| Back to top |
|
 |
sam2kb da ruski mafia
Joined: 02 Dec 2007 Posts: 2927
   votes: 53
|
|
| Back to top |
|
 |
|