Topic: Newsletter

Hi all,

I have PunBB installed and being used from within a CMS Made simple installation. All works fine until i try to install the newslstter plug-in.

At first the install script couldn't alter my database tables so i had to do it manually.

But now i have it installed it doesn't send any newsletters. Here is the error i get:

Fatal error: Call to a member function on a non-object in /home/slwincou/public_html/fayestevenson-co-uk/modules/PunBB/plugins/AP_Newsletter.php on line 88

Line 88 =
$result = $db->query("SELECT DISTINCT email FROM ".$db->prefix."users WHERE newsletter='true'") or die(mysql_error());

any ideas what this could be?

Kind regards
Simon W

Re: Newsletter

Yes, your database connection isn't loaded wink

Re: Newsletter

thanks for the reply.

but why is that?

what can i do?

the forums are working fine....

Re: Newsletter

include common.php, it should load the database connection.

Re: Newsletter

Hi,

this is already at the top of the newsletter.php file:

define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

and i still get:

Fatal error: Call to a member function on a non-object in /home/slwincou/public_html/fayestevenson-co-uk/modules/PunBB/Newsletter.php on line 30

Line 30=
$email = $db->escape($_POST['email']);

any ideas to why this could be happening?

thanks very much for your time

Re: Newsletter

i just had a thought...the database connection settings are being read from the CMS script.

So there are no db settings changed within config.php

i went con config.php and as i though no settings..

$db_type = $config['dbms'];
$db_host = $config['localhost'];
$db_name = $config['slwincou_fayecms'];
$db_username = $config['*********'];
$db_password = $config['**********'];
$db_prefix = $config['cms_'].'module_punbb_';
$p_connect = $config['persistent_db_conn'];

now the errors i get is:

Error: Unable to connect to MySQL server. MySQL reported: Access denied for user 'slwincou'@'localhost' (using password: NO).

any idea to what is wrong with these settings?

regards
simon w

Re: Newsletter

Well, when I go here: http://fayestevenson.co.uk/modules/PunB … etter.php, I get an error tongue

site wrote:

An error was encountered
Error: Unable to connect to MySQL server. MySQL reported: Access denied for user 'slwincou'@'localhost' (using password: NO).

So I suppose that's the problem =/

Re: Newsletter

yes that error happens when i modify the config.php

the error has gone now as i have restored the file....

to be honest i think it is an issue with the fact i have the forum working in conjunction with CMSMS.

9 (edited by sydefx 2006-07-05 17:16)

Re: Newsletter

i will go back to the instructions i used to get the forum within CMSMS and see exactly what was changed and see if i can figure it out from there...

config.php has the follwing

$db_type = $config['dbms'];
$db_host = $config['db_hostname'];
$db_name = $config['db_name'];
$db_username = $config['db_username'];
$db_password = $config['db_password'];
$db_prefix = $config['db_prefix'].'module_punbb_';
$p_connect = $config['persistent_db_conn'];

and this works fine...apart from the newsletter!

Re: Newsletter

Seems to be working fine now =/

11

Re: Newsletter

after entering a email i still get the : Fatal error: Call to a member function on a non-object in /home/slwincou/public_html/fayestevenson-co-uk/modules/PunBB/Newsletter.php on line 30

i used test@test.com

hmmm

Re: Newsletter

Have you modified the code in any way?

13

Re: Newsletter

only from instructions from the newsletter readme:

++++++++++++++++++++++++++++++++++++++++++
#-------[ 1. OPEN ]---------------
#
    include/email.php
#
#-------[ 2. FIND ]---------------
#
    function pun_mail($to, $subject, $message, $from = '')
#
#-------[ 3. REPLACE WITH ]-------
#
    function pun_mail($to, $subject, $message, $from = '', $html = false)
#
#-------[ 4. FIND ]---------------
#
    $headers = 'From: '.$from."\r\n".'Date: '.date('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset='.$lang_common['lang_encoding']."\r\n".'X-Mailer: PunBB Mailer';
#
#-------[ 5. REPLACE WITH ]-------
#
    if($html)
    {
        // HTML headers (thank you php.net documentation)
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers .= 'From: '.$from."\r\n".'Date: '.date('r')."\r\n".'X-Mailer: PunBB Mailer';
    }
    else
    {
        $headers = 'From: '.$from."\r\n".'Date: '.date('r')."\r\n".'MIME-Version: 1.0'."\r\n".'Content-transfer-encoding: 8bit'."\r\n".'Content-type: text/plain; charset='.$lang_common['lang_encoding']."\r\n".'X-Mailer: PunBB Mailer';
    }
#
#-------[ 6. EXTRACT ]------------
#
    "Newsletter mod 1.0.zip" to PunBB's base dir
#
#-------[ 7. RUN ]----------------
#
    install_mod_newsletter.php
+++++++++++++++++++++++++++++++++++++++++++++++++++

Re: Newsletter

Odd, really odd =/
It worked fine when I wrote it (and for other people too) =/
Only thing I can think of is that the $db variable gets overwritten somewhere =/

15

Re: Newsletter

as i mentioned it was installed as a module for CMS Made Simple.

Download : http://dev.cmsmadesimple.org/projects/punbb/

Maybe the module is based on an older version of PunBB, or something like that???

Thanks for your help

Re: Newsletter

I see... it changed a variable =/
Change every occurence of $db to $pun_db and it should work wink

17

Re: Newsletter

aha

have changed all those within newsletter.php

but now :
Fatal error: Call to undefined function: redirect() in /home/slwincou/public_html/fayestevenson-co-uk/modules/PunBB/Newsletter.php on line 32

Line 32=
    redirect($_SERVER['PHP_SELF'], "Subscribed");

seems to have done something

would the variable need to be changed in all the newsletter files?

thanks very much

Re: Newsletter

I suppose that becomes pun_redirect or something =/

19

Re: Newsletter

well look at that!!!

ha ha smile

thanks very much...just gonna test the rest of it and will let you know in a moment

20 (edited by sydefx 2006-07-05 18:59)

Re: Newsletter

arr all seems to be working except the newsletter emails are coming through empty...just a blank email

21

Re: Newsletter

very strange...hmmm must be doing something wrong

Re: Newsletter

I have no idea what could be wrong now tongue

Re: Newsletter

Moved to modifications.

Looking for a certain modification for your forum? Please take a look here before posting.