Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# phplist-plugin-invite
# phplist-plugin-repermission

Invite people to join your phpList system.

v0.2 2013-08-28
Send repermission campaigns which require subscribers to re-confirm their list membership.

requires phpList version 3.0.3 or newer

This plugin will use the campaign system to send a one-off invite to your subscribers. After that, phpList will ensure
further campaigns will only go out to subscribers who responded to the invite.
This plugin will use the campaign system to send a one-off repermission campaign to your subscribers. After that, phpList will ensure
further campaigns will only go out to subscribers who responded to the request.

It does this as follows:

- in the Send-campaign page, on the Format tab, there will be an option (radio button) called "Invite". Choose this option to send the campaign as an Invite.
- in the Send-campaign page, on the Format tab, there will be an option (radio button) called "Repermission". Choose this option to send the campaign as a repermission campaign.
- When you do so, you need to add [CONFIRMATIONURL] to the content. The confirmation URL will be the place where the recipients can confirm that they want to be in your system.
- After sending the campaign, the subscriber will be marked "Blacklisted" in the phpList system, which means no further mails will be sent. HOWEVER:
- The recipients who clicked the Confirmation URL will be removed from the blacklist and turn into normal subscribers.
Expand Down
39 changes: 20 additions & 19 deletions plugins/inviteplugin.php → plugins/RepermissionPlugin.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
<?php

/**
* v0.5 - 2019-08-06 - rename to repermission plugin
* v0.4 - 2018-02-01 - bug fixes.
* v0.3 - 2013-08-29 - add config for target list, where subscribers who confirm are added to.
* v0.2 - 2013-08-28 - set invite via the "sendformat" instead of adding it's own tab.
* v0.1 - initial.
*/
class inviteplugin extends phplistPlugin
class RepermissionPlugin extends phplistPlugin
{
public $name = 'Invite plugin for phpList';
public $name = 'Repermission plugin for phpList';
public $coderoot = '';
public $version = '0.4';
public $authors = 'Michiel Dethmers';
public $authors = 'Michiel Dethmers, Sam Tuke';
public $enabled = 1;
public $description = 'Send an invite to subscribe to the phpList mailing system';
public $description = 'Send repermission campaigns requesting subscribers opt-in again to retain list membership';
public $documentationUrl = 'https://resources.phplist.com/plugin/invite';
public $settings = array(
'inviteplugin_subscribepage' => array(
'repermissionplugin_subscribepage' => array(
'value' => 0,
'description' => 'Subscribe page for invitation responses',
'description' => 'Subscribe page for repermission campaign responses',
'type' => 'integer',
'allowempty' => 0,
'min' => 0,
'max' => 999999,
'category' => 'Invite plugin',
'category' => 'Repermission plugin',
),
'inviteplugin_targetlist' => array(
'repermissionplugin_targetlist' => array(
'value' => 0,
'description' => 'Add subscribers confirming an invitation to this list',
'description' => 'Add subscribers confirming a repermission campaign to this list',
'type' => 'integer',
'allowempty' => 0,
'min' => 0,
'max' => 999999,
'category' => 'Invite plugin',
'category' => 'Repermission plugin',
),
);

Expand All @@ -43,21 +44,21 @@ public function adminmenu()

public function sendFormats()
{
return array('invite' => s('Invite'));
return array('repermission' => s('Repermission'));
}

public function allowMessageToBeQueued($messagedata = array())
{
// we only need to check if this is sent as an invite
if ($messagedata['sendformat'] == 'invite') {
// we only need to check if this is sent as a repermission campaign
if ($messagedata['sendformat'] == 'repermission') {
$hasConfirmationLink = false;
foreach ($messagedata as $key => $val) {
if (is_string($val)) {
$hasConfirmationLink = $hasConfirmationLink || (strpos($val, '[CONFIRMATIONURL]') !== false);
}
}
if (!$hasConfirmationLink) {
return $GLOBALS['I18N']->get('Your campaign does not contain a the confirmation URL placeholder, which is necessary for an invite mailing. Please add [CONFIRMATIONURL] to the footer or content of the campaign.');
return $GLOBALS['I18N']->get('Your campaign does not contain a the confirmation URL placeholder, which is necessary for a repermission campaign. Please add [CONFIRMATIONURL] to the footer or content of the campaign.');
}
}

Expand All @@ -67,9 +68,9 @@ public function allowMessageToBeQueued($messagedata = array())
public function processSendSuccess($messageid, $userdata, $isTestMail = false)
{
$messagedata = loadMessageData($messageid);
if (!$isTestMail && $messagedata['sendformat'] == 'invite') {
if (!$isTestMail && $messagedata['sendformat'] == 'repermission') {
if (!isBlackListed($userdata['email'])) {
addUserToBlackList($userdata['email'], s('Blacklisted by the invitation plugin'));
addUserToBlackList($userdata['email'], s('Blacklisted by the repermission plugin'));
}
Sql_Query(sprintf(
'update %s
Expand All @@ -79,7 +80,7 @@ public function processSendSuccess($messageid, $userdata, $isTestMail = false)
$userdata['id']
));
// if subscribe page is set, mark this subscriber for that page
$sPage = getConfig('inviteplugin_subscribepage');
$sPage = getConfig('repermissionplugin_subscribepage');
if (!empty($sPage)) {
Sql_Query(sprintf(
'update %s set subscribepage = %d where id = %d',
Expand All @@ -93,8 +94,8 @@ public function processSendSuccess($messageid, $userdata, $isTestMail = false)

public function subscriberConfirmation($subscribepageID, $userdata = array())
{
$sPage = getConfig('inviteplugin_subscribepage');
$newList = getConfig('inviteplugin_targetlist');
$sPage = getConfig('repermissionplugin_subscribepage');
$newList = getConfig('repermissionplugin_targetlist');
if (!empty($sPage) && !empty($newList) && $sPage == $subscribepageID) {
if ($userdata['blacklisted']) {
// the subscriber has not been unblacklisted yet at this stage
Expand Down