Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
newsletter (ezmlm) integration Details »»
newsletter (ezmlm) integration
Version: 1.00, by Till Till is offline
Developer Last Online: Aug 2007 Show Printable Version Email this Page

Version: 2.3.x Rating:
Released: 08-30-2003 Last Update: Never Installs: 2
 
No support by the author.

Hello,

this is a really small hack, very basic. It's the first I released too, certainly not the first I have done. It's so not rocket science or advanced l33t PHP code hacking. But since I didn't really find the same hack on the site, I guess it qualifies.

Preface:

We have Qmail running, and since we (ab)use Qmail a lot, we run ezmlm with it. Very nice combo, if I may add.

Anyways, ezmlm handles the subscription via email. You send an email to listname-subscribe@whatever.domain.tld and the user recieves an email asking to confirm it (double opt-in style).

So I guess it really works with any listmanager that does the subscription via email request and confirm.

So, I had to write this in order to enable users to sign up for our newsletter on registration.

Here we go:

Create a file called "register_subscribe.php" in your forum's home directory. Put the following PHP code in it:

PHP Code:
<?
// build headers
// $newsletter_email
$headers = "From: ".$newsletter_email." <".$newsletter_email.">\n";
$headers .= "Reply-To: ".$newsletter_email." <".$newsletter_email.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Sender: ".$newsletter_email." <".$newsletter_email.">\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
$headers .= "Return-Path: <".$newsletter_email.">\n";

// send email
mail("listname-subscribe@domain.tld", "", "", $headers);

/*
send confirmation email
mail("youraddy@domain.com", "new subscription request", "email: $newsletter_email", "From: whatever <whatever@whatever.com>");
*/
?>
That's the first part where you should adjust "listname-subscribe@domain.tld" to your list manager's subscription email address.

You can remove the comments for the other mail() function and adjust it with your email address, if you feel like it. Starting it off, it can be pretty useful to track who makes use of it, and who doesn't.

Next step is to go into your control panel, then "Templates", "Modify" and "Expand..." the list. Find "Registration Templates" and edit "registeradult".

I added the following lines:

Code:
<tr>
	<td bgcolor="#13486D"><normalfont><b>Would you like to recieve our newsletter?</b></normalfont></td>
	<td bgcolor="#13486D"><normalfont>Yes</normalfont>&nbsp;<input type="checkbox" class="bginput" name="subscribe_newsletter" size="25" maxlength="15" value="yes" checked></td>
</tr>
Right underneath of:

Code:
<tr>
	<td bgcolor="#1C5780"><normalfont><b>Enter Email Again:</b></normalfont></td>
	<td bgcolor="#1C5780"><normalfont><input type="text" class="bginput" name="emailconfirm" size="25" maxlength="50"></normalfont></td>
</tr>
OK, I guess that was pretty easy so far. We are almost done.

Now, let's go into register.php.

Assuming that you didn't edit the file before (and that you run vBulletin 2.3.2), you should find the following piece of code on line 476:

PHP Code:
  $homepage trim($homepage);
  if (
$homepage) {
    if (
preg_match('#^www\.#si'$homepage)) {
      
$homepage "http://$homepage";
    } else if (!
preg_match('#^[a-z0-9]+://#si'$homepage)) {
      
// homepage doesn't match the [url]http://-style[/url] format in the beginning -- possible attempted exploit
      
$homepage '';
    }
  } 
Right underneath, I added:

PHP Code:
  // do newsletter subscribing

  
if($_POST["subscribe_newsletter"]=="yes"){
    
// checkbox checked
    
$newsletter_email=$email;
    @include(
dirname(__FILE__)."/register_subscribe.php");
  } 
Why did I add it there? Well, just because that is the very last moment before the user gets written to the database. Which means that all validation has been done until this point, which means that there's not going to be another error message about the registration process.

Not being able to register for the board for whatever reason, but still getting the message to confirm list subscription might confuse users. If you know what I mean.

So yay! That should be it.

:banana:

You may change all variables used, you can even put the file into another directory or whatever. Please do not complain that it doesn't work after you changed everything.

The hack *should* work with any version of vBulletin. The line number may be different though, but I guess you can figure it out.

I won't have any screenshots right now, maybe later. If you guys need anything, let me know, I'll try to respond to each post in time - if possible.

Have fun,
Till

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 08-31-2003, 06:48 PM
colicab-d's Avatar
colicab-d colicab-d is offline
 
Join Date: Dec 2002
Location: Glasgow
Posts: 382
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

plz put your hack as txt or php file so that un-licensed users cant use it...

or so one of the mods will tell you
Reply With Quote
  #3  
Old 08-31-2003, 07:19 PM
Till Till is offline
 
Join Date: May 2002
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 09:48 PM colicab-d said this in Post #2
plz put your hack as txt or php file so that un-licensed users cant use it...

or so one of the mods will tell you
Why am I paying for this if I can have all the hacks for free? :laugh:

I'll do so if one of the moderators will require me to do so.
Reply With Quote
  #4  
Old 08-31-2003, 07:31 PM
Till Till is offline
 
Join Date: May 2002
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here it is.

I'll disclose a link and more info when the project is online (and we launched it).
Reply With Quote
  #5  
Old 08-31-2003, 07:41 PM
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Location: Georgia, USA
Posts: 2,519
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The reason is not so that non-licensed users cannot get it, although you should never put the instructions into the hack database for that purpose. The purpose is so that people can download it and have a copy on their machine so they can re-install it when they upgrade:
Quote:
From the Full Releases rules:
Please attache the hacking instructions in a text file of some sort, so that users can download and use them again in the case of a vBulletin upgrade.
Reply With Quote
  #6  
Old 08-31-2003, 09:48 PM
Till Till is offline
 
Join Date: May 2002
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Yesterday at 10:41 PM Link14716 said this in Post #5
The reason is not so that non-licensed users cannot get it, although you should never put the instructions into the hack database for that purpose. The purpose is so that people can download it and have a copy on their machine so they can re-install it when they upgrade:
I gotcha. Added the thread as .txt to it. I guess that works. I'll do a better release with my next hack.

Cheers,
Till
Reply With Quote
  #7  
Old 09-01-2003, 04:40 AM
SmEdD's Avatar
SmEdD SmEdD is offline
 
Join Date: Mar 2003
Location: Ontario, Canada
Posts: 381
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Yesterday at 03:48 PM colicab-d said this in Post #2
plz put your hack as txt or php file so that un-licensed users cant use it...

or so one of the mods will tell you
They cannot see it any ways A mod will also tell you that. As long as it is in the [ PHP ] or [ CODE ] tags it's fine.

Also you should add some screen shots.
Reply With Quote
  #8  
Old 09-01-2003, 09:10 AM
Till Till is offline
 
Join Date: May 2002
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 07:40 AM SmEdD said this in Post #7
They cannot see it any ways A mod will also tell you that. As long as it is in the [ PHP ] or [ CODE ] tags it's fine.

Also you should add some screen shots.
I added one, if you scroll up two posts.
Reply With Quote
  #9  
Old 09-01-2003, 09:15 AM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Yesterday at 08:48 PM colicab-d said this in Post #2
plz put your hack as txt or php file so that un-licensed users cant use it...

or so one of the mods will tell you
As mentioned above, you don't have to document it since unlicenced/guests cant view the code in them

Though its nice to put it in a txt file to make it more organized.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04492 seconds
  • Memory Usage 2,299KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (3)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete