Skip to content

Commit c9c1086

Browse files
xh3n1michield
authored andcommitted
0019187: Add draft campaign for use with invite plugin available in new installations (#306)
* insert draft message to db Signed-off-by: Xheni Myrtaj <[email protected]> * insert the draft message to older versions Signed-off-by: Xheni Myrtaj <[email protected]> * create addInviteCampaign function Signed-off-by: Xheni Myrtaj <[email protected]> * remove lib link, and fix spaces * use html code and also fallback work for first name placeholder Signed-off-by: Xheni Myrtaj <[email protected]> * compare dbversion with 3.3.3 Signed-off-by: Xheni Myrtaj <[email protected]> * Removed space before vars causing SQL error * Improved default invite campaign text * Added todo notes
1 parent b1c8da7 commit c9c1086

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

public_html/lists/admin/initialise.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,10 @@ function output($message)
203203
} else {
204204
SaveConfig('organisation_name', strip_tags($_REQUEST['adminemail']), 1);
205205
}
206-
206+
// add a draft campaign for invite plugin
207+
addInviteCampaign();
207208
// add a testlist
208-
$info = $GLOBALS['I18N']->get('List for testing');
209+
$info = s('List for testing');
209210
$result = Sql_query("insert into {$tables['list']} (name,description,entered,active,owner) values(\"test\",\"$info\",now(),0,1)");
210211
$info = s('Sign up to our newsletter');
211212
$result = Sql_query("insert into {$tables['list']} (name,description,entered,active,owner) values(\"newsletter\",\"$info\",now(),1,1)");

public_html/lists/admin/lib.php

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,37 @@ function addSubscriberStatistics($item, $amount, $list = 0)
14791479
}
14801480
}
14811481

1482+
/**
1483+
* Insert a draft campaign for use with the Invite plugin
1484+
* @todo Make the campaign content translatable
1485+
* @todo Add Campaign Meta Title to clarify purpose of this draft
1486+
*/
1487+
function addInviteCampaign() {
1488+
1489+
$message =
1490+
'<p>Hi [FIRST NAME%%there], remember us? You first signed up for our email newsletter on&nbsp;[ENTERED] &ndash; please click here to confirm you&#39;re happy to continue receiving our messages:</p>
1491+
1492+
<p><strong><a href="[CONFIRMATIONURL]" title="Confirm subscription">Continue receiving messages</a></strong>&nbsp; <u>(If you do not confirm using this link, then you won&#39;t hear from us again</u>)</p>
1493+
1494+
<p>While you&#39;re at it, you can also update your preferences, including your email address or other details, by clicking here:</p>
1495+
1496+
<p><strong><a href="[PREFERENCESURL]">Update preferences</a></strong></p>
1497+
1498+
<p>By confirming your membership and keeping your details up to date, you&#39;re helping us to manage and protect your data in accordance with best practices.</p>
1499+
1500+
<p>Thank you!</p>';
1501+
1502+
$inviteMessage = addslashes($message);
1503+
$inviteMessageSubject = "Do you want to continue receiving our messages?";
1504+
$uuid = uuid::generate(4);
1505+
$ownerid = $_SESSION['logindetails']['id'];
1506+
$footer = sql_escape(getConfig('messagefooter'));
1507+
$result = Sql_query("insert into {$GLOBALS['tables']['message']} (uuid,subject,message,entered, status, owner, footer, sendformat) values(\"$uuid\",\"$inviteMessageSubject\",\"$inviteMessage\",now(),\"draft\",\"$ownerid\",\"$footer\",\"invite\" )");
1508+
1509+
return $result;
1510+
1511+
}
1512+
14821513
function deleteMessage($id = 0)
14831514
{
14841515
if (isSuperUser()) {
@@ -2215,7 +2246,6 @@ function asyncLoadContent($url)
22152246
/**
22162247
* load content in a div after loading
22172248
*/
2218-
22192249
function asyncLoadContentDiv($url,$divname)
22202250
{
22212251

public_html/lists/admin/upgrade.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,12 @@ function output($message)
303303
createTable('user_message_view');
304304
}
305305

306+
if (version_compare($dbversion, '3.3.3','<')) {
307+
// add a draft campaign for invite plugin
308+
addInviteCampaign();
309+
310+
}
311+
306312
//# longblobs are better at mixing character encoding. We don't know the encoding of anything we may want to store in cache
307313
//# before converting, it's quickest to clear the cache
308314
clearPageCache();

0 commit comments

Comments
 (0)