Skip to content

Commit

Permalink
0019187: Add draft campaign for use with invite plugin available in n…
Browse files Browse the repository at this point in the history
…ew installations (#306)

* insert draft message to db

Signed-off-by: Xheni Myrtaj <myrtajxheni@gmail.com>

* insert the draft message to older versions

Signed-off-by: Xheni Myrtaj <myrtajxheni@gmail.com>

* create addInviteCampaign function

Signed-off-by: Xheni Myrtaj <myrtajxheni@gmail.com>

* remove lib link, and fix spaces

* use html code and also fallback work for first name placeholder

Signed-off-by: Xheni Myrtaj <myrtajxheni@gmail.com>

* compare dbversion with 3.3.3

Signed-off-by: Xheni Myrtaj <myrtajxheni@gmail.com>

* Removed space before vars causing SQL error

* Improved default invite campaign text

* Added todo notes
  • Loading branch information
xh3n1 authored and michield committed May 12, 2018
1 parent b1c8da7 commit c9c1086
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
5 changes: 3 additions & 2 deletions public_html/lists/admin/initialise.php
Expand Up @@ -203,9 +203,10 @@ function output($message)
} else {
SaveConfig('organisation_name', strip_tags($_REQUEST['adminemail']), 1);
}

// add a draft campaign for invite plugin
addInviteCampaign();
// add a testlist
$info = $GLOBALS['I18N']->get('List for testing');
$info = s('List for testing');
$result = Sql_query("insert into {$tables['list']} (name,description,entered,active,owner) values(\"test\",\"$info\",now(),0,1)");
$info = s('Sign up to our newsletter');
$result = Sql_query("insert into {$tables['list']} (name,description,entered,active,owner) values(\"newsletter\",\"$info\",now(),1,1)");
Expand Down
32 changes: 31 additions & 1 deletion public_html/lists/admin/lib.php
Expand Up @@ -1479,6 +1479,37 @@ function addSubscriberStatistics($item, $amount, $list = 0)
}
}

/**
* Insert a draft campaign for use with the Invite plugin
* @todo Make the campaign content translatable
* @todo Add Campaign Meta Title to clarify purpose of this draft
*/
function addInviteCampaign() {

$message =
'<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>
<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>
<p>While you&#39;re at it, you can also update your preferences, including your email address or other details, by clicking here:</p>
<p><strong><a href="[PREFERENCESURL]">Update preferences</a></strong></p>
<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>
<p>Thank you!</p>';

$inviteMessage = addslashes($message);
$inviteMessageSubject = "Do you want to continue receiving our messages?";
$uuid = uuid::generate(4);
$ownerid = $_SESSION['logindetails']['id'];
$footer = sql_escape(getConfig('messagefooter'));
$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\" )");

return $result;

}

function deleteMessage($id = 0)
{
if (isSuperUser()) {
Expand Down Expand Up @@ -2215,7 +2246,6 @@ function asyncLoadContent($url)
/**
* load content in a div after loading
*/

function asyncLoadContentDiv($url,$divname)
{

Expand Down
6 changes: 6 additions & 0 deletions public_html/lists/admin/upgrade.php
Expand Up @@ -303,6 +303,12 @@ function output($message)
createTable('user_message_view');
}

if (version_compare($dbversion, '3.3.3','<')) {
// add a draft campaign for invite plugin
addInviteCampaign();

}

//# longblobs are better at mixing character encoding. We don't know the encoding of anything we may want to store in cache
//# before converting, it's quickest to clear the cache
clearPageCache();
Expand Down

0 comments on commit c9c1086

Please sign in to comment.