Skip to content

Commit 99639bb

Browse files
committed
Merge pull request #2357 from xisi/dev-active-news-option
Adds 'active' field to news submission to simplify workflow
2 parents 751f247 + 3068155 commit 99639bb

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

include/classes/news.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public function addNews($account_id, $aData, $active=false) {
8888
if (empty($aData['header'])) return false;
8989
if (empty($aData['content'])) return false;
9090
if (!is_int($account_id)) return false;
91+
if (@$aData['active']) $active = true;
9192
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, header, content, active) VALUES (?,?,?,?)");
9293
if ($stmt && $stmt->bind_param('issi', $account_id, $aData['header'], $aData['content'], $active) && $stmt->execute())
9394
return true;

templates/bootstrap/admin/news/default.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
<input type="hidden" name="action" value="{$smarty.request.action|escape}">
1919
<input type="hidden" name="do" value="add">
2020
<input type="hidden" name="ctoken" value="{$CTOKEN|escape|default:""}" />
21+
<div class="form-group">
22+
<label>Active</label>
23+
<input type="checkbox" class="switch" data-size="mini" name="data[active]" value="1" checked>
24+
</div>
2125
<div class="form-group">
2226
<label>Header</label>
2327
<input class="form-control" size="30" type="text" name="data[header]" required />

0 commit comments

Comments
 (0)