Posted on: 09/18/08 12:02am
By: suprsidr
I'm developing a Newsletter plugin for GL 1.5.x
I'm having strange results with globals.
for instance mysql_install.php
Text Formatted Code
$_SQL[] = "CREATE TABLE {$_TABLES['newsletter']} (.....
the
{$_TABLES['newsletter']} gets totally ignored as if its blank. But that is exactly how every stock plugin does it.
if I replace {$_TABLES['newsletter']} with gl_newsletter install goes fine until other globals get ignored.
Throughout the entire plugin it seems $_CONF and $_USER and $_TABLES.... are all being ignored.
any ideas?
whitespaces???
-s
Re: Newsletter plugin
Posted on: 09/18/08 12:41am
By: jmucchiello
Where did you put the code to setup the table?
$_TABLES['yourtable'] = $_DB_table_prefix . 'yourtable';
It should be in your functions.inc near the top. (It use to go in the config.php but that's not really correct in 1.5 and up.) Don't model your plugin against the built-in plugins. The built-in plugins aren't really standalone plugins. Core Geeklog helps them with their initial install and upgrades.
I'm not really sure what is a good model as there aren't any popular plugins with config class support yet. I'm sure an update to the plugin how-to is somewhere on the todo list of one of the devs.
Oh, and, um, you do know about the "global" directive in PHP, right?
Re: Newsletter plugin
Posted on: 09/18/08 05:02am
By: eg0master
Quote by: suprsidrThroughout the entire plugin it seems $_CONF and $_USER and $_TABLES.... are all being ignored.
Is this in functions? I'm guessing yes. Do you have a global directive in the beginning of your function telling your function that $_CONF etc are globals?
take a look at the functions in lib-common.php if you don't know what i mean. otherwise, please post an example of usage that does not work for you.
Re: Newsletter plugin
Posted on: 09/18/08 07:22am
By: suprsidr
$_TABLES['yourtable'] = $_DB_table_prefix . 'yourtable';
Yup that fixed it.
Strangely I have this in my other plugins but somehow forgot it here
Thankfully I asked for help before I spent days on it.
Thanks guys
newsletter plugin coming soon.
-s
Re: Newsletter plugin
Posted on: 09/18/08 07:51am
By: ::Ben
newsletter plugin coming soon.
-s[/p]
Hi Wayne,
Waiting for it
Thanks.
::Ben
P.S I'm also working on a "newsletter" plugin but I will call it ML (mailing liste) plugin.
Re: Newsletter plugin
Posted on: 09/21/08 09:23pm
By: suprsidr
Well, let me start off by saying ... my Newsletter plugin is a total rip-off of the staticpages plugin. Matter of fact its a total clone plus some added functionality.
I started off creating everything from scratch, then saying... hmm.. I could use that functionality, then... oh yeah that too.... ultimately I copied the entire staticpages plugin and added my needed functionality.
Thanks to Blaine, Dirk and Tony and any others who have contributed to this plugin
In retrospect it would have been easier to simply modify the SP plugin directly.
So with that said... I have a
release[*1] .
It creates an extra table to hold simple email addresses - as GL's email functionality won't let you email someone if they have never logged-in as they don't technically exist until they do.
It creates a block phpblock_newsletter which holds the form (ajax, so no page refresh). There is also another block phpblock_newsletter_small which I added a variable to the header {newsletter_sm} in case you want to call it in the header maybe around the search???
Admin has all the abilities as the SP plugin along with the ability to "Send now", and manage subscribers.
I've added the proper "Having problems viewing this page? View it on our site....." and Unsubscribe links in the mailing.
I moved the templates to the theme as to allow per theme layouts.
Also an "Archive" link in the form.
I have a working
demo[*2] .
But I need testers and constructive criticism.
-s
Re: Newsletter plugin
Posted on: 09/21/08 11:28pm
By: samstone
Wayne,
That's very cool. Being not a PHP geek, I have considered many easy solutions, but never thought of using the Staticpages.
Thanks for your creativity!
Sam
Re: Newsletter plugin
Posted on: 09/22/08 05:05am
By: ::Ben
Hi Wayne,
I'm testing your alpha release.
Here are some points I noticed :
1 - When you submit twice an email the message is still "Thanks for signing up!".
2 - In the editor I can choose newsletter as a centerblock but I can't see this centerblock.
3 - Maybe will you add a link to unsubscribe in the block.
Thanks.
::Ben
Re: Newsletter plugin
Posted on: 09/22/08 07:15am
By: suprsidr
When you submit twice an email the message is still "Thanks for signing up!".
KISS (Keep It Simple Silly) - we just say thanks instead of saying "you already signed up silly"
In the editor I can choose newsletter as a centerblock but I can't see this centerblock.
Hmmm.. Never actually tried this functionality just assumed it would work, but will check into it.
Maybe will you add a link to unsubscribe in the block
Not my intention to put a point of negativity in plain sight. They technically only need to see this if they are in fact receiving the newsletter.
@samstone
I actually think SP would also be a perfect template to make a "Home Pages" plugin allowing each site member to have his/her own single page.
-s
Re: Newsletter plugin
Posted on: 09/22/08 07:24am
By: ::Ben
I actually think SP would also be a perfect template to make a "Home Pages" plugin allowing each site member to have his/her own single page.
+1
::Ben
Re: Newsletter plugin
Posted on: 09/22/08 07:26am
By: ::Ben
Wayne,
I receved your last newsletter about Catalog Demo.
Thanks
Nice pictures.
::Ben
Re: Newsletter plugin
Posted on: 09/25/08 10:45pm
By: samstone
It works with GLFusion too, except you need to modify the advanced editor codes.
Peace!
Sam