marikitORG random thoughts, some nuts and bolts

20Oct/090

Integrating phpBB and phpList

I've been procrastinating on a project because I was waiting for someone to finally make a modification for phpBB that would automatically subscribe a user to a phpList newsletter. I couldn't wait anymore so I just went ahead and did some tinkering around. Please be warned that this is a rough hack and isn't validated by the phpBB mod team.

This hack works for phpList 2.10.10 and phpBB 3.0.5.

Download this file and rename it to functions_phplist.php. If you edit the file with notepad or any text editor, you would find this part:

	$database_host = "localhost";
	$database_name = "database";
	$database_user = "username";
	$database_password = "password";
	$table_prefix = "phplist_";
	$usertable_prefix = "phplist_user_";

Fill those in with your phpList credentials which you could get from your phpList config.php file. I didn't want to include the phpList file as there might be global variables that could be overwritten. That's the only thing you have to alter in that file. After editing it, upload it to the /includes folder inside your phpBB folder.

Now to integrate that function into phpBB core, you have to edit the /includes/ucp/ucp_register.php file in your phpBB folder. Look for these lines:

	$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
	trigger_error($message);

and insert the following lines before it:

	//Include phplist functions
	include($phpbb_root_path . 'includes/functions_phplist.' . $phpEx);
	//Subscribe user to phplist
	$phplist_user_id = phplist_subscribeuser($data['email'], 1);

Notice the "1" in that last line? Change that to the id of the newsletter you want your users to be subscribed to. You could get that from your phpList admin page. After editing, upload it to your server overwriting the original ucp_register.php file. And that's it!

Once a user registers in your forums, they will be automatically subscribed to your newsletter as well. But take note that this is very limited. For one, it won't send a welcome message to the user's email. Also, the subscribing process happens during registration. If you have validation of email addresses in your boards and you want the subscribing process to occur once a user validates his/her email address, you will have to tinker with a different file instead of ucp_register.php. Maybe ucp_activate.php, I'm not sure since I didn't tinker with anything else. Also, since I didn't provide the user with an unsubscribe option in their profile, they can only unsubscribe to the newsletter via phpList's unsubscribe page.

Now, if you already have users in your boards and want to import them to your phpList newsletter, save this file as a php file and edit these lines to reflect the paths to your phpBB and phpList config files.

require("/path/to/phplist/config/config.php");

and

require("/path/to/phpbb/config.php");

Then find this line

phplist_subscribeuser($row['user_email'], 1);

and replace "1" with the id of the newsletter you want your users to be subscribed to. Upload the file to your server and access it via your browser and wait for the script to finish running. When I imported 16,000 users it roughly took me less than 5 minutes to finish.

That's it. Feel free to tinker it to your heart's content. I just wanted to share this because making this work gave me a headache.

25Feb/070

on Enth3.1 Joined Page customizations

I saw a couple of people asking at the TFL and Codegrrl forums about customizing Enth 3.1 to show the number of listings joined per category. Something similar to what I have here.

show_joined.php )

Mood: awakeawake
Filed under: Geek Scripts No Comments
29Oct/050

on kyouNIUE version 10

new layout @ kyouNIUE. featuring zack from final fantasy vii: advent children. zack is one hot sexy guy. *rawr* re-used several elements from the last layout. so it looks way too similar. but since it's zack, i just have to place it up. XD there are several advent children around and comparing this to those, this one's waaay too crappy. anyway, like the air gear layout, created a wallpaper from this one too. available in three different sizes. so i hope you enjoy them! ^_^


800 | 1024 | 1280

oh and yeah, buttonup version 2.0 finally up now.

and now, i'm off to sleep then on to go on a one-week vacation! wheeeeeeeeeeee! XDDD will be back on monday next next week. that's a november 7, i think. *is too lazy to check the calendar* ja ne!