Help with mailinglist subscription plugin.

17 years 10 months ago #15212 by jlanders
Plugin Purpose Subscription addon for mailing list. Based on code originally created by * (c) Morten Holdflod Møller with significat modification.


My test php script runs perfectly with the desired results. However, when I put this into the plugin, I am having difficultly getting it to work. I do not get any errors. Checking the Vars with the die() command shows me everything is loading up correctly. I do not seem to be getting any false returns. I just cannot tell if I am getting out to the URL and that the desired email address is entered into the mailing list.


Test Script
[code:1]
<?php
global $login_cookies_instance;
include "./Snoopy.class.php";
$snoopy = new Snoopy;

echo "Subscribe mail testing";

$submit_vars["myuser"] = "bagpipe";
$submit_vars["mypass"] = "pipeplayer";
$submit_url = "cp.s434.sureserver.com/login.php";


$snoopy->submit($submit_url,$submit_vars);
print $snoopy->results;
/*$url = $params->get('admin_url', '').'/login.php';*/
$url = ('cp.s434.sureserver.com' . '/maillist/subscribers.php?list=cspd');
$postdata = "james@webwraith.com"."\n";

$snoopy->submittext($url, $postdata);
print $snoopy->results;


?>
[/code:1]

Here is the plugin code. Does anyone see any problems or items missing in here?

Plugin Code
[code:1]
<?
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
/*
*
*/

$_PLUGINS->registerFunction('onAfterUserApproval', 'afterApproveUser', 'subscribeMailman');
$_PLUGINS->registerFunction('onAfterNewUser', 'afterNewUser', 'subscribeMailman');

$_PLUGINS->registerFunction('onAfterDeleteUser', 'afterDeleteUser', 'subscribeMailman');

$_PLUGINS->registerFunction('onBeforeUserUpdate', 'beforeUpdateUser', 'subscribeMailman');
$_PLUGINS->registerFunction('onBeforeUpdateUser', 'beforeUpdateUser', 'subscribeMailman');

if(file_exists("Snoopy.class.php"«»)) {
include("Snoopy.class.php"«»);
}

class subscribeMailman extends cbEventHandler {

var $snoopy_instance;
var $login_cookies_instance;

function afterApproveUser($user, $approved, $succes) {
if ($approved) {

global $login_cookies_instance;
$return="";
$snoopy = new Snoopy;


$submit_vars["myuser"] = "login";
$submit_vars["mypass"] = "password";
$submit_url = "cp.s434.sureserver.com/login.php";

$snoopy->submit($submit_url,$submit_vars);
/*die($submit_url);*/
/*die($snoopy->error);*/
/*die($snoopy->results);*/

$url = ('cp.s434.sureserver.com' . '/maillist/subscribers.php?list=cspd');
$postdata = "test@test.com"."\n";

$snoopy->submittext($url, $postdata);



/*$this->Subscribe($user->email);*/
} else {
/*$this->unSubscribe($user->email);*/
}
return true;
}
}
?>

[/code:1]

Any assistance is appreciated. Thank you

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.168 seconds

Facebook Twitter LinkedIn