Skip to content

Commit

Permalink
Merge pull request #2 from dzhuryn/master
Browse files Browse the repository at this point in the history
fix user context and empty pagetitle when we editing resource
  • Loading branch information
Dmi3yy authored Apr 29, 2021
2 parents 59d4591 + 9937a18 commit a76c99c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Services/Documents/DocumentCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function prepareDocument()
}


if (trim($this->documentData['pagetitle']) == "") {
if (isset($this->documentData['pagetitle']) && trim($this->documentData['pagetitle']) == "") {
if ($this->documentData['type'] == "reference") {
$this->documentData['pagetitle'] = Lang::get('global.untitled_weblink');
} else {
Expand Down Expand Up @@ -290,8 +290,8 @@ public function prepareCreateDocument()

$this->documentData['menuindex'] = !empty($this->documentData['menuindex']) ? (int)$this->documentData['menuindex'] : 0;

$this->documentData['createdby'] = EvolutionCMS()->getLoginUserID('mgr');
$this->documentData['editedby'] = EvolutionCMS()->getLoginUserID('mgr');
$this->documentData['createdby'] = EvolutionCMS()->getLoginUserID();
$this->documentData['editedby'] = EvolutionCMS()->getLoginUserID();
$this->documentData['createdon'] = $this->currentDate;
$this->documentData['editedon'] = $this->currentDate;
// invoke OnBeforeDocFormSave event
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Documents/DocumentDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function process(): \Illuminate\Database\Eloquent\Model
SiteContent::query()
->whereIn('id', $documentDeleteIds)
->update(['deleted' => 1,
'deletedby' => EvolutionCMS()->getLoginUserID('mgr'),
'deletedby' => EvolutionCMS()->getLoginUserID(),
'deletedon' => time()]);


Expand Down
4 changes: 2 additions & 2 deletions src/Services/Documents/DocumentEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function validate(): bool
public function prepareEditDocument()
{
$existingDocument = SiteContent::query()->find($this->documentData['id'])->toArray();
$this->documentData['editedby'] = EvolutionCMS()->getLoginUserID('mgr');
$this->documentData['editedby'] = EvolutionCMS()->getLoginUserID();
$this->documentData['editedon'] = $this->currentDate;
$this->documentData['oldparent'] = $existingDocument['parent'];
if(!isset($this->documentData['parent'])){
Expand Down Expand Up @@ -211,7 +211,7 @@ public function prepareEditDocument()
$this->documentData['publishedby'] = EvolutionCMS()->getLoginUserID();
} elseif ((!empty($this->documentData['pub_date']) && $this->documentData['pub_date'] <= $this->currentDate && $this->documentData['published'])) {
$this->documentData['publishedon'] = $this->documentData['pub_date'];
$this->documentData['publishedby'] = EvolutionCMS()->getLoginUserID('mgr');
$this->documentData['publishedby'] = EvolutionCMS()->getLoginUserID();
} elseif ($was_published && !$this->documentData['published']) {
$this->documentData['publishedon'] = 0;
$this->documentData['publishedby'] = 0;
Expand Down

0 comments on commit a76c99c

Please sign in to comment.