after playing around with this great hint for filtering by date there came an idea to my mind of a plugin that ads this filter default to all visible pages - globaly.
Maybe it is possible to auto-add ->filterBy('date', '<=', time())
internaly/globaly/etc. instead of editing every template/plugin/etc. (e.g. search and feed-plugin, etc…) seperated?
You cannot override a method in a custom method. If you want to override an existing method, you have to use a page model, which then doesn’t work globally but only for the pages that use the corresponding template. I’m not so sure that adding this functionality to the visibility flag globally makes much sense, though. Filtering by date only makes sense for something like posts that do have a date field. This usually doesn’t apply to all pages in a site.
Using it globaly still makes sense, also when pages do not have date field. because scheduling is allways something that depends on dates, pages without dates seem not to rely on any date-specific feature. so it is not a problem, when those pages without dates are used beside a globaly schedule by date.
i totaly agree, that such a functionality should not be default. but in a plugin it would help on demand, regardless of other plugins and pre-coded templates.
As I said above, it is not possible to overwrite an existing method globally. Also, in my opinion it makes more sense to use a specific custom method for this purpose, as already mentioned by @flokosiol. Please also note that visibility is just a filter flag, it doesn’t make a page inaccessible. Additionally, you have to make sure that visitors can’t access those pages .