HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Can a 'News' post be made 'Sticky'?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#26841 (In Topic #6194)
Avatar

Community saint

Is there a way to 'Stick' a News post?

I want to resurrect an old post so that it displays as a 'new' post in my 'News' block.

I've tried changing the 'date/time', but all that does is queue the post for validation. When validated it still gives a warning message in red, saying the post is still awaiting validation. The date and time chosen is always a few minutes in the future, but it appears that there is a mis-match somewhere that isn't allowing the system to recognise that the 'input' date has been changed.

Can anybody throw some light on this matter? Or am I completely on the wrong track?

 :dry:

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#26843
Avatar

The time field is for scheduling, rather than the recorded time for which the news was considered to be created. Only upon a schedule time being reached would the recorded time be updated, in order to fool the visitor into thinking the news had been posted at the schedule point.
So I believe what you are trying to do would work, but you'd have to hit the schedule time just right, so that it would occur just a minute or so after your edit. During that minute the news would be unvalidated, and then would become validated and date-updated upon publish.

This isn't really what the scheduler was designed for (or indeed a design consideration we made for the news system), hence the confusion. A more direct way to do this would be to open up OcCLE and type:

Code

:$GLOBALS['SITE_DB']->query_update('news',array('date_and_time'=>time()),array('id'=>INSERT_ID_OF_NEWS_HERE));
and then flush the caches on the front page via ctrl+alt+shift+refresh.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#26852
Avatar

Community saint

Ouch!

I've avoided OcCLE simply because it is cmd_line stuff that I've never mastered and have only experienced in the dim, distant past with DOS. And, for me, it is another reason to avoid Linux!

However, I'm game to give it a 'GO', because it is a built-in feature of OCP and you guys haven't disappointed so far with the built-in stuff - there's always a reason!

I'd need a bit more in the way of explanation, though:
1. 'date_and_time'=time()) and INSERT_ID_OF_NEWS_HERE are clues, but this information isn't easy to decrypt, even using phpMyAdmin, because dates and times and id's are virtually undecipherable as they don't have any titles against them, and one has to take a wild guess.
2. Activating OcCLE appears to be easy enough, but how do I 'connect' to another user, or, in this case does it automatically interrogate the database when opened and the 'code snippet' is typed into the box?

Any help would be gratefully received . . .

 ;)

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#26853
Avatar

Community saint

I do not like command line either but love linux.
I am using centos on my laptop.
One main reason I use linux is I have problems with windows and ftp.
Any way I will see if I can find a way to do this.

I run http://otakuplayground.com and am hopping to make themes and other things for ocportal even though I no longer use it for otakuplayground.com I still love it and feel it could go far with the right help. It needs themes and needs people to advertise for it.
Back to the top
 
Posted
Rating:
#26855
Avatar

I'd need a bit more in the way of explanation, though:
1. 'date_and_time'=time()) and INSERT_ID_OF_NEWS_HERE are clues, but this information isn't easy to decrypt, even using phpMyAdmin, because dates and times and id's are virtually undecipherable as they don't have any titles against them, and one has to take a wild guess.

The time() bit is itself code – you don't need to touch it. Substitute INSERT_ID_OF_NEWS_HERE with the number that appears in the URL when you view the news item.

2. Activating OcCLE appears to be easy enough, but how do I 'connect' to another user, or, in this case does it automatically interrogate the database when opened and the 'code snippet' is typed into the box?

Just type it into the box :). You don't need to do any kind of logging-in/authentication — you are already logged in to ocPortal, and this is just an extension-of/window-into-the-guts-of–ocPortal.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#26856
Avatar

Community saint





Explanation(s) - excellent.

Implementation - limited success (see attachments).

To reassure you, I've Ctrl+Alt+Shft+Refreshed, so what did I do wrong, or rather, what didn't I do?

Edit: I could change the ID via phpMyAdmin, BUT, what happens to the attached 'comments' is not clear to me, and I'd hate for them not to go along with the post and hang around somewhere as 'orphaned' entries!


Last edit: by Fletch

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#26857
Avatar

Please try the attached zipped sources/blocks/main_news.php.

Attachment
» Download: main_news.zip (3 Kb, 419 downloads so far)


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#26858
Avatar

Community saint

That's a "Gotcha!"

The "ORDER BY p.date_and_time DESC" did the trick.

If that is going to be changed for future releases, OK. If not, please say so here so that I can make a note that "sources/blocks/main_news.php" needs to be watched carefully for future changes.

Thanks

 :thumbs:

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#26875
Avatar

Yes, we'll change it in future releases and try and use this as a coding convention in the future.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: