We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Great News, Code to refresh newsfeed! | Forum

jeo
jeo Jan 6 '12
Iv been trying for a long time to auto refresh the page, but still havent got that far yet! BUT i have now found away so the newsfeed will auto refresh, just copy & past this code in admin panel/css (<meta http-equiv='refresh' content='(10seconds);file_name=/.ow_newsfeed">) and click save! Just to let you know it want auto refresh but it self in a way, it will only refresh when you comment back to a post or probs when posting a comment!

I rely do hope that this will help out a lot of you :)
Mark
Mark Feb 6 '12
the downside to the above is that it will refresh the whol,e page even if your half way through replying to something
jeo
jeo Feb 7 '12
i am not a programer so i am very poor with all this i was just going with my head sorry, it mite be better if placed on the newsfeed file it self!

Plus also Leo i need some help, i want to set all notifications mail, Admin compost mail and welcome mail to also receive in members mailbox on site to help me communicate with members much easier. I be very happy if you can help me do this i will pay for each one done.
Martin
Martin Nov 12 '13
Where do we have to put this?!  
MarkieMark67
MarkieMark67 Nov 12 '13
I have a solution But it still refreshes the page but with some binding commands. Any movement of the Mouse, Keyboard, and so on will reset the timer. 


Admin/Main Settings/Page Settings add this command to Custom head code.


<script>

     var time = new Date().getTime();

     $(document.body).bind("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error hover change", function(e) {

         time = new Date().getTime();

     });


     function refresh() {

         if(new Date().getTime() - time >= 600000) 

             window.location.reload(true);

         else 

             setTimeout(refresh, 600000);

     }

 setTimeout(refresh, 600000);

</script>


600000 = 10 mins.. Make changes as needed

The Forum post is edited by MarkieMark67 Nov 13 '13
aron
aron Nov 15 '13
A) go to: vvv.YOUR_URL.com/admin/settings/page 

B) paste abou code to: "Custom head code"

C) save

Mohammad
Mohammad Dec 17 '13
I didn't look at this yet but If someone can tell me what is the URL that newsfeed get info,I could make something better(better solution) ! 
Alia Team
Alia Dec 18 '13
Mohammad, not sure what you mean by "URL that newsfeed get info".
Each plugin, including system plugins sends out needed content to newsfeed and newsfeed plugin in turn just displays it.
Mohammad
Mohammad Dec 18 '13
Hi Aliia,

I saw database,the ow_newsfeed_action table,and find out that values of data column are in jason,So I guess newsfeed plugin send out data in a specified format and I think it possible that js get data(like ajax) and display it.

for example (I'm not sure about this) when some body click on "view more" button,newsfeed send more data to display.so there most be a URL to load and get data.

MarkieMark67
MarkieMark67 Dec 18 '13
Paul Cuffe you know when you are ready for a real live site to test it on. Just let me know.
MarkieMark67
MarkieMark67 Dec 19 '13
Paul Cuffe Sounding good so far. Can't wait to see the full version..
Mohammad
Mohammad Dec 19 '13
Yes,you are doing great Paul....
MarkieMark67
MarkieMark67 Dec 20 '13
Can't wait to see this :)
MarkieMark67
MarkieMark67 Jan 18 '14
Paul Cuffe Hows it coming???
Wolfy
Wolfy Jan 19 '14
Paul this sounds GREAT!!! :)
Jaco
Jaco May 17 '14
hi all, any new development regarding this matter, @MarkieMark67 I have tried your idea but it still refreshes whilst I'm busy typing, mouse movement nor key strokes stops it from refreshing. I hope this can be sorted quickly.
Pedro Machado
Pedro Machado Jun 10 '14
Hello All.


After a small change in the script, it is working for me.

Just delete the word "body" in  $(document.body).


<script>

    var time = new Date().getTime();

    var refreshTime = 6*1000;


    $(document).bind("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error hover change", function(e) {

    time = new Date().getTime(); });


    function refresh()

    {

       if(new Date().getTime() - time >= refreshTime)

           window.location.reload(true);

       else

    setTimeout(refresh, refreshTime);    

      }

  

     setTimeout(refresh, refreshTime);


</script>



Change the number 6 to value in seconds that you want that your site reload.

The Forum post is edited by Pedro Machado Jun 10 '14
MarkieMark67
MarkieMark67 Jun 11 '14
Jaco Sorry I have been out of pocket. 


Pedro Machado +1

tammy harris
tammy harris Jun 16 '14
cool but that refreshes the whole page need something that just refreshes newsfeeds 
MarkieMark67
MarkieMark67 Jun 16 '14
Tammy Very True. But at this point it is the best option....   
Pages: 1 2 3 »