Gossamer Forum
Home : Products : Others : Gossamer Community :

[NEW PLUGIN] BirthdayEmail

Quote Reply
[NEW PLUGIN] BirthdayEmail
BirthdayEmail v1
Author: Ultranerds.com
More Details: http://ultranerds.com/...bin/details/155.html

Description:

This little plugin adds a little more interaction between your users, giving more sense of "community".

Very simple to install and setup, and fully template based emails.

Requirements

Gossamer Community 1.0.2+
MySQL Database

Features
  • Ease of use.
  • Very little customization required (just edit the email template)
  • Template based.

  • If you have any questions, please don't hesitate to ask.

    Cheers

    Andy (mod)
    andy@ultranerds.co.uk
    Want to give me something back for my help? Please see my Amazon Wish List
    GLinks ULTRA Package | GLinks ULTRA Package PRO
    Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
    Quote Reply
    Re: [Andy] [NEW PLUGIN] BirthdayEmail In reply to
    Well a sentence on what this plugin does wouldn't hurt too much... Tongue
    It's supposed to send an email the day of a user's birthday?
    Max
    The one with Mac OS X Server 10.4 :)
    Quote Reply
    Re: [maxpico] [NEW PLUGIN] BirthdayEmail In reply to
    Hi,

    Quote:
    Well a sentence on what this plugin does wouldn't hurt too much... Tongue
    It's supposed to send an email the day of a user's birthday?

    Exactly =) It sends out an email on their birthday (at 12.00am - or whenever the cronjob is set to run), and gives them a feeling of community (as well as promoting your site when the email is sent out, and potentially making them remember you site, and revisiting <G>)

    Cheers

    Andy (mod)
    andy@ultranerds.co.uk
    Want to give me something back for my help? Please see my Amazon Wish List
    GLinks ULTRA Package | GLinks ULTRA Package PRO
    Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
    Quote Reply
    Re: [Andy] [NEW PLUGIN] BirthdayEmail In reply to
    Hi,

    I've been made aware of a bug in a later version of this plugin. Its all fixed up now, but anyone who installed from the beginning of this month, will need to re-download the plugin, and update the copy on their site.
    Sorry for any inconvenience.

    Cheers

    Andy (mod)
    andy@ultranerds.co.uk
    Want to give me something back for my help? Please see my Amazon Wish List
    GLinks ULTRA Package | GLinks ULTRA Package PRO
    Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
    Quote Reply
    Re: [Andy] [NEW PLUGIN] BirthdayEmail In reply to
    Hello Andy!

    You didn't answer on my E-mail, so I'll try here: The plugin work only if I change my birthday date to today, including day, month and year - e.g. 2007-11-02 but not 1997-11-02.

    Regards ..
    Quote Reply
    Re: [katakombe] [NEW PLUGIN] BirthdayEmail In reply to
    Hi Andy,
    I don't know if it's easy or difficult,
    but it would be nice to name the actual age of the person.

    Somthing like:
    Gratulation to your X. birthday (actual date - birth date)

    Thanks
    Matthias

    Matthias
    gpaed.de
    Quote Reply
    Re: [Matthias70] [NEW PLUGIN] BirthdayEmail In reply to
    Hi,

    I don't see why not.

    After this (in birthdays.cgi):

    Code:
    while (my $hit = $sth->fetchrow_hashref) {

    ..add:

    Code:
    my @foo = $hit->{prof_birthday};

    my $age = $tmp[0] - $foo[0];

    $hit->{age} = $age;

    Then, use <%age%> in the email - and it should show their age :)

    Hope that helps.

    Cheers

    Andy (mod)
    andy@ultranerds.co.uk
    Want to give me something back for my help? Please see my Amazon Wish List
    GLinks ULTRA Package | GLinks ULTRA Package PRO
    Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
    Quote Reply
    Re: [Andy] [NEW PLUGIN] BirthdayEmail In reply to
    Hi Andy,
    works perfect.
    Thanks a lot
    Matthias

    Matthias
    gpaed.de
    Quote Reply
    Re: [Matthias70] [NEW PLUGIN] BirthdayEmail In reply to
    Or simply...

    Quote:
    $hit->{age} = $tmp[0] - $hit->{prof_birthday};

    The use of an array is redundant and does nothing.

    Last edited by:

    Wychwood: Dec 25, 2007, 3:35 AM
    Quote Reply
    Re: [Wychwood] [NEW PLUGIN] BirthdayEmail In reply to
    Hi Wychwood,
    thanks for your suggestion

    Matthias

    Matthias
    gpaed.de
    Quote Reply
    Re: [Matthias70] [NEW PLUGIN] BirthdayEmail In reply to
    Hi,

    Actually it should make a difference. The code I gave above is wrong. It should be:

    Code:
    my @foo = spliy /-/, $hit->{prof_birthday};

    ..NOT

    Code:
    my @foo = $hit->{prof_birthday};

    Not sure how it would have worked before - as it would be doing something like:

    2007 - 1984-01-16

    ..which shouldn't make a valid sum.

    Cheers

    Andy (mod)
    andy@ultranerds.co.uk
    Want to give me something back for my help? Please see my Amazon Wish List
    GLinks ULTRA Package | GLinks ULTRA Package PRO
    Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
    Quote Reply
    Re: [Andy] [NEW PLUGIN] BirthdayEmail In reply to
    Hi Andy,
    your first code
    Code:
    my @foo = $hit->{prof_birthday};

    works fine for me.

    Your second code
    Code:
    my @foo = spliy /-/, $hit->{prof_birthday};

    gets this error
    Code:
    Search pattern not terminated at birthdays.cgi line 39.


    Matthias

    Matthias
    gpaed.de
    Quote Reply
    Re: [Matthias70] [NEW PLUGIN] BirthdayEmail In reply to
    Sorry, should be:

    split

    ..not "spliy"

    i.e


    Code:
    my @foo = split /-/, $hit->{prof_birthday};

    Serves me right posting a reply when I'd have a few beers yesterday =)

    Cheers

    Andy (mod)
    andy@ultranerds.co.uk
    Want to give me something back for my help? Please see my Amazon Wish List
    GLinks ULTRA Package | GLinks ULTRA Package PRO
    Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
    Quote Reply
    Re: [Andy] [NEW PLUGIN] BirthdayEmail In reply to
    Hi Andy,
    I realized, that this birthday plugin sents out Emails to disabled users in gcommunity and even users who set ReceiveMail to NO in glinks.

    Is there a way to prevent sending birthday mails to disabled users?

    Thanks
    Matthias


    Matthias
    gpaed.de
    Quote Reply
    Re: [Matthias70] [NEW PLUGIN] BirthdayEmail In reply to
    Hi,

    Sure thing - didn't realise it did that =)

    Try changing (in birthdays.cgi)

    Code:
    my $sth = $DB->table('comm_users')->select( GT::SQL::Condition->new('prof_birthday','LIKE',"%-mm-$dd") ) || die $GT::SQL::error;

    ..to

    Code:
    my $sth = $DB->table('comm_users')->select( GT::SQL::Condition->new('prof_birthday','LIKE',"%-mm-$dd",'comm_enabled','=','1') ) || die $GT::SQL::error;

    Hope that helps.

    Cheers

    Andy (mod)
    andy@ultranerds.co.uk
    Want to give me something back for my help? Please see my Amazon Wish List
    GLinks ULTRA Package | GLinks ULTRA Package PRO
    Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
    Quote Reply
    Re: [Andy] [NEW PLUGIN] BirthdayEmail In reply to
    Thanks Andy,
    I'll give it a try.
    By the way. Do you know how to set the birthday profile field right.

    My settings are
    Not Null: "Yes"
    Default: 0000-00-00

    But when a new user registers the birthday field shows
    1 / Jan / 1970
    and the new users is not forced to change this date. So I have a lot of users who do not change this birth date at all...

    Do you have an idea how to change this?
    Matthias

    Matthias
    gpaed.de
    Quote Reply
    Re: [Matthias70] [NEW PLUGIN] BirthdayEmail In reply to
    Hi,

    The only way I can think of really - is having a Javascript snippet to check that the date doesn't = 1970-01-01

    The problem is - GT have used a - in the SELECT fields :/


    Code:
    <script>

    function testthis() {
    alert(document.myform.document.prof_birthday-day);
    return false;

    // prof_birthday-day
    // prof_birthday-mon
    // prof_birthday-year
    }

    </script>


    <form name="myform" action="community.cgi" method="post" onsubmit="return testthis();">

    As far as I know, you can't use a - in the field name :(

    i.e this would be fine:


    Code:
    document.myform.document.prof_birthday_day

    ..but this isn't :

    Code:
    document.myform.document.prof_birthday-day

    IF you don't mind changing the core scripts in GComm, then it would be possible to edit it - so these fields are called with a _ instead of -.

    Cheers

    Andy (mod)
    andy@ultranerds.co.uk
    Want to give me something back for my help? Please see my Amazon Wish List
    GLinks ULTRA Package | GLinks ULTRA Package PRO
    Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
    Quote Reply
    Re: [Andy] [NEW PLUGIN] BirthdayEmail In reply to
    Hi Andy,
    that's to much workaround for a little change :-(
    Thanks
    Matthias

    Matthias
    gpaed.de
    Quote Reply
    Re: [Matthias70] [NEW PLUGIN] BirthdayEmail In reply to
    Hi,

    You could try editing /lib/Community/Web/SSI.pm,

    and changing the
    Code:
    sub ssi_form_control {

    ....

    }

    ..function to:

    Code:
    sub ssi_form_control {
    # -------------------------------------------------------------------
    require GT::SQL::Display::HTML;
    require GT::SQL::Display::HTML::Table;
    require GT::Template;

    my $opts = ref $_[0] eq 'HASH' ? shift : {@_};

    my $user_tb = $DB->table('comm_users');
    my $tags = GT::Template->tags || {};
    my $disp = $DB->html($user_tb, $tags);

    my $form_type = lc( $opts->{form_type} || $opts->{def}{form_type} );

    exists $opts->{blank} or $opts->{blank} = $form_type eq 'select' ? 1 : 0;

    my $input_html = 'radio' eq $form_type ? $disp->radio( $opts ) :
    'checkbox' eq $form_type ? $disp->checkbox( $opts ) :
    'select' eq $form_type ? do {
    $opts->{form_size} ||= $opts->{def}{form_size};
    $disp->select( $opts );
    } :
    'hidden' eq $form_type ? $disp->hidden( $opts ) :
    'multiple' eq $form_type ? do {
    $opts->{form_size} ||= $opts->{def}{form_size};
    $opts->{multiple} = $opts->{form_size};
    $disp->multiple( $opts )
    }:
    'textarea' eq $form_type ? $disp->textarea( $opts ) :
    'file' eq $form_type ? "File type not supported." :
    'date' eq $form_type ? do {
    require GT::Date;
    my ($sel_year, $sel_mon, $sel_day) = split /\-/, GT::CGI::html_escape($opts->{value});
    $sel_year ||= 1970;
    $sel_mon ||= 1;
    $sel_day ||= 1;
    my $month_sel = $disp->select({
    name => "$opts->{name}-mon",
    value => $sel_mon,
    values => { map { sprintf("%02d", $_) => $GT::Date::LANGUAGE->{short_month_names}->[$_ - 1] } (1 .. 12) },
    sort => [ map { sprintf("%02d", $_) } (1 .. 12) ],
    blank => 1
    });
    my $day_sel = $disp->select({
    name => "$opts->{name}-day",
    value => $sel_day,
    values => { map { sprintf("%02d", $_) => $_ } (1 .. 31) },
    sort => [ map { sprintf("%02d", $_) } (1 .. 31) ],
    blank => 1
    });
    qq~
    $day_sel /
    $month_sel /
    <input type="text" name="$opts->{name}-year" value="" size="4" maxlength="4">
    ~;
    } :
    $disp->text($opts);

    return \$input_html;
    }

    This will make the birthday stuff show with --- (blank) for the pre-selected option. Then, when they submit it with the default - it will give them an error about the birthday field not being set :)

    Hope that helps.

    Cheers

    Andy (mod)
    andy@ultranerds.co.uk
    Want to give me something back for my help? Please see my Amazon Wish List
    GLinks ULTRA Package | GLinks ULTRA Package PRO
    Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
    Quote Reply
    Re: [Andy] [NEW PLUGIN] BirthdayEmail In reply to
    Hi Andy,
    it's not that easy.
    It shows --- (blank) in the registration form, but no error message when the users does'nt change anything?
    I think it's because, the default 0000-00-00 can not changed.
    I can delete the default, but after a resync of the database it's still there...

    Matthias

    Matthias
    gpaed.de
    Quote Reply
    Re: [Matthias70] [NEW PLUGIN] BirthdayEmail In reply to
    Hi,

    Mmm.. not sure what else to try, sorry :(

    (it would make it a lot easier if GT changed the birthday fields so they didn't have the - in, as that just messes up the ability to use Javascript - which would make this issue a simple fix Frown)

    Cheers

    Andy (mod)
    andy@ultranerds.co.uk
    Want to give me something back for my help? Please see my Amazon Wish List
    GLinks ULTRA Package | GLinks ULTRA Package PRO
    Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!