We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6350
    • 421 Posts
    おめでとうございます。(^_^)v

    blogContent に関しては、僕も modx を始めた頃は追記だと思ってました。
    他の CMS から移ってきたらそう思うのが当たり前ですよね。

    管理画面の編集で入力エリアが2つ並んでるんですから。 laugh
      • 6350
      • 421 Posts
      ちょっと考慮不足で「非公開」ボタンをクリックしても公開日の処理で無効になっていました。こんなんでいいんかな?非公開のドキュメントを編集後に保存する場合には別の条件が必要かも laugh

      fdm.db.class.inc.php に次のコードを追加してください
      if ($this->fields[’published’]==1) {
      }

       	/***************************************************
      	  Saving/Updating FdmDocument (escape fields added)
      	****************************************************/
      	function Save(){ //escape added
      		global $modx;
      		$this->fields['editedon']=time();
      		if ($this->fields['published']==1) {	// ここに追加
      			list($d, $m, $Y, $H, $M, $S) = sscanf($this->fields['pub_date'], "%2d-%2d-%4d %2d:%2d:%2d");
      			$this->fields['pub_date'] = strtotime("$m/$d/$Y $H:$M:$S");
      			if($this->fields['pub_date'] <= $this->fields['editedon']) {
      				$this->fields['published'] = 1;
      			} else {
      				$this->fields['published'] = 0; 
      			}
      		}					// ここも追加
      

      fdm.db.class.inc.php の 399行目くらいに $this->Set(’pub_date’,0); を追加
      	function UnPublish($user=''){
      		global $modx;
      		$this->Set('published',0);
      		$this->Set('pub_date',0);	// ここに追加
      		$this->Save();
      		$pid=$this->Get('parent');
      		$id=$this->Get('id');
      
      		return ($pid);
      	}