We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22935
    • 23 Posts
    Is it possible to set it to unbublish, say 6 months after publication, rather than based on a TV
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Certainly. Basically the same plugin, except instead of using a TV value just calculate six months from the publish date and set the unpublish date to that.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 16545
        • 358 Posts
        I’m testing the other thing based on this plugin, but can be consolidated and very useful.

        For example, if we need change some TV value on unpublished date.
        I have a TV like - membership (guest==0||user==1||vip==3) and on some date VIP membershipping must go down from vip to the guest.

        One problem is something wrong with my piece of code, which must this TV changing:
        1) Can’t handle with document id detection???
        2) This value update is not almost correct, cause it makes replacement of wrong id from this table and then I’m having duplicated TV in one document.


        $table = $modx->getFullTableName("site_tmplvar_contentvalues");
        $fields = array(
        "tmplvarid" => "36",
        "contentid" => "464", //must be detected automatically
        "value" => 0
        );
        $modx->db->update($fields, $table);

        The second thing is how to make TV changing after document will be unpublished.
        Maybe it must be an another plugin with another System Event (OnDocUnPublished)???
        --

        Any advices are welcome, thx!!!