Skip to content

Commit d1d6ce3

Browse files
xh3n1michield
authored andcommitted
Set ownerid of invite campaign to 1 for fresh new installations (#380)
* Set ownerid to 1 for fresh new installations Signed-off-by: Xheni Myrtaj <[email protected]> * backwards compatibility, better variable name and PHPdoc Signed-off-by: Xheni Myrtaj <[email protected]>
1 parent 6f795f6 commit d1d6ce3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

public_html/lists/admin/initialise.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function output($message)
204204
SaveConfig('organisation_name', strip_tags($_REQUEST['adminemail']), 1);
205205
}
206206
// add a draft campaign for invite plugin
207-
addInviteCampaign();
207+
addInviteCampaign(1);
208208
// add a testlist
209209
$info = s('List for testing');
210210
$result = Sql_query("insert into {$tables['list']} (name,description,entered,active,owner) values(\"test\",\"$info\",now(),0,1)");

public_html/lists/admin/lib.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,12 +1479,16 @@ function addSubscriberStatistics($item, $amount, $list = 0)
14791479
}
14801480
}
14811481

1482+
14821483
/**
14831484
* Insert a draft campaign for use with the Invite plugin
1485+
* @param null|int $forcedOwnerId
1486+
* @return bool|mysqli_result
1487+
* @throws Exception
14841488
* @todo Make the campaign content translatable
14851489
* @todo Add Campaign Meta Title to clarify purpose of this draft
14861490
*/
1487-
function addInviteCampaign() {
1491+
function addInviteCampaign($forcedOwnerId = null) {
14881492

14891493
$message =
14901494
'<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>
@@ -1502,7 +1506,11 @@ function addInviteCampaign() {
15021506
$inviteMessage = addslashes($message);
15031507
$inviteMessageSubject = "Do you want to continue receiving our messages?";
15041508
$uuid = uuid::generate(4);
1505-
$ownerid = $_SESSION['logindetails']['id'];
1509+
if ( $forcedOwnerId !== null) {
1510+
$ownerid = $forcedOwnerId;
1511+
} else {
1512+
$ownerid = $_SESSION['logindetails']['id'];
1513+
}
15061514
$footer = sql_escape(getConfig('messagefooter'));
15071515
$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\" )");
15081516

0 commit comments

Comments
 (0)