Is there a way to preview "Draft" News articles?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Is there a way to preview "Draft" News articles?

Post by jmcgin51 »

Using CMSMS 1.9.3, is there a way to preview a News article that has been set to "Draft" status?

I searched the forum and found one of my own posts (http://forum.cmsmadesimple.org/viewtopi ... =2&t=47341) wherein I told someone it could be done, but I think I must have been mistaken. I think I was thinking of viewing expired articles, not drafts.

I know I can use the WYSIWYG News editor, but I want to actually view the article in context on the target page to ensure that it looks correct before setting it live/published. I'm having an issue with tables, where Tiny correctly displays the table border for a couple of seconds when it loads the article, but then the border disappears. I'm not sure if this is just a glitch in the editor pane, or whether it will actually render without the table border when the full page loads on the frontend.
Wishbone
Power Poster
Power Poster
Posts: 1369
Joined: Tue Dec 23, 2008 8:39 pm

Re: Is there a way to preview "Draft" News articles?

Post by Wishbone »

OK.. I have a procedure for you. Ignore the Status ('Published/Draft') and create a Custom Field (checkbox) called 'draft'. When you want it to be hidden, then click on it.

Have your summary template check for $entry->draft.. If it is set, then ignore that entry, unless {$smarty.session.cms_admin_username} is set, indicating that you are logged in ;)

Note that when you log out, {$smarty.session.cms_admin_username} is still set, but if you get a fresh browser, then it won't be set.

If it's a huge security issue, you can do the same with your detail template as well, so that no one can accidently find your detail URL.

One small side effect is that if you are using something like {news number=5} and two of them are 'drafts', you will only get three. ;)
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Is there a way to preview "Draft" News articles?

Post by jmcgin51 »

thanks Wishbone - that's a unique idea for a workaround!

I'm going to leave this open for little while longer, to see if anyone else has ideas. If not, I'll likely adopt your suggestion and also file a FR for News in the Forge, so that hopefully the ability to preview Draft articles can be incorporated into the module itself in the future.
Wishbone
Power Poster
Power Poster
Posts: 1369
Joined: Tue Dec 23, 2008 8:39 pm

Re: Is there a way to preview "Draft" News articles?

Post by Wishbone »

Even easier... Create a category called 'Draft'. Put all your drafts in it.

Code: Select all

{if $smarty.session.cms_admin_username}
  {news category="General,Draft"}
{else}
  {news category="General"}
{/if}
8)
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Is there a way to preview "Draft" News articles?

Post by jmcgin51 »

geez, wishbone - you're full of outside-the-box ideas today!! I'd give you karma if I could...
Wishbone
Power Poster
Power Poster
Posts: 1369
Joined: Tue Dec 23, 2008 8:39 pm

Re: Is there a way to preview "Draft" News articles?

Post by Wishbone »

jmcgin51 wrote:I'd give you karma if I could...
I miss the 'karma' button.. :( I was starting to rack them up. :)
muzil
New Member
New Member
Posts: 1
Joined: Mon Mar 18, 2024 12:44 am

Re: Is there a way to preview "Draft" News articles?

Post by muzil »

Wishbone wrote: Sat Feb 26, 2011 4:37 pm Even easier... Create a category called 'Draft'. Put all your drafts in it.

Code: Select all

{if $smarty.session.cms_admin_username}
  {news category="General,Draft"}
{else}
  {news category="General"}
{/if}
8)
Hi Wishbone,

Can you tell me where to enter this code please?

Regards
Post Reply

Return to “CMSMS Core”