Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Session Auto-Refresh (if user has not close the browser: show as online!) Details »»
Session Auto-Refresh (if user has not close the browser: show as online!)
Version: 1.0, by Scandal Scandal is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.x.x Rating:
Released: 10-25-2014 Last Update: Never Installs: 17
Template Edits
 
No support by the author.

A template modification for session auto-refresh! :up:
What does this mod do?
By default, vbulletin refreshes the session only on a page refresh - move to new page by the user. With this, when a user has not close the browser, it continuous display as ONLINE, on the page the browser is.

Copy and paste the following code at the end of your headinclude template and you're ready!

On the *zip package below you can find also the code for vB3 version.

Credits: to madness85 for him idea and the donation for creating this hack.
HTML Code:
<vb:if condition="$show[member]">
    <script type="text/javascript">
      var sc_sessionrefresh_handleSuccess = function(o)
      {
      	if(o.responseText !== undefined)
      	{
      		if (sc_sessionrefresh_callback.object_name[o.tId] !== undefined)
      		{
      			fetch_object(sc_sessionrefresh_callback.object_name[o.tId]).innerHTML = o.responseText;
      		}
      	}
      }
      var sc_sessionrefresh_handleFailure = function(o)
      {
      	if(o.responseText !== undefined)
      	{
      		alert(o.responseText);
      	}
      }
      var sc_sessionrefresh_callback =
      {
      	success: sc_sessionrefresh_handleSuccess,
      	failure: sc_sessionrefresh_handleFailure,
      	timeout: vB_Default_Timeout,
      	cache: false,
      	object_name: new Array()
      } 
      
      function sc_sessionrefresh_fetch()
      {	
      	var sUrl = document.URL;                    
      	var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, sc_sessionrefresh_callback);
      	return true;
      }
      
      setInterval(function () {
        sc_sessionrefresh_fetch(); 
      }, {vb:raw vboptions.cookietimeout} * 1000);
    </script>
</vb:if>

Download Now

File Type: zip sc_session_autorefresh_vB3_vB4.zip (2.0 KB, 60 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
2 благодарности(ей) от:
madness85, zorcocuq

Comments
  #2  
Old 10-26-2014, 12:56 PM
Justinphx Justinphx is offline
 
Join Date: Jan 2012
Posts: 92
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looks good. I just added the script. Thanks.
Reply With Quote
  #3  
Old 11-01-2014, 08:49 PM
KHALIK KHALIK is offline
 
Join Date: May 2005
Posts: 211
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed.


EDIT.

It doesn't seem to be working


Reply With Quote
  #4  
Old 11-16-2014, 12:29 PM
ahobilam's Avatar
ahobilam ahobilam is offline
 
Join Date: Aug 2011
Location: Chennai, India
Posts: 128
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How to conform as it is working?!
Reply With Quote
  #5  
Old 11-27-2014, 08:50 PM
tme_power tme_power is offline
 
Join Date: Sep 2006
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It still stay the same for me.
Reply With Quote
  #6  
Old 11-27-2014, 09:07 PM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would use this instead and just wrap it around the same conditional:

Change the minutes and seconds highlighted in red to your choice....

Code:
<vb:if condition="$show[member]">
<script type="text/javascript">// <![CDATA[
/*
Auto Refresh Page with Time script
By JavaScript Kit (javascriptkit.com)
Over 200+ free scripts here!
*/

//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit="00:10"

if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{ 
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
else
curtime=cursec+" seconds left until page refresh!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}
function makeDoubleDelegate(function1, function2) {
    return function() {
        if (function1)
            function1();
        if (function2)
            function2();
    }
}

window.onload = makeDoubleDelegate(window.onload, beginrefresh );
// ]]></script>
</vb:if>
Reply With Quote
  #7  
Old 12-29-2014, 09:06 PM
zorcocuq zorcocuq is offline
 
Join Date: Apr 2011
Location: Izmir,Turkey
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Scandal. Looks good.
Reply With Quote
  #8  
Old 01-09-2015, 07:43 PM
thetechgenius's Avatar
thetechgenius thetechgenius is offline
 
Join Date: Jun 2014
Posts: 258
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CAG CheechDogg View Post
I would use this instead and just wrap it around the same conditional:

Change the minutes and seconds highlighted in red to your choice....

Code:
<vb:if condition="$show[member]">
<script type="text/javascript">// <![CDATA[
/*
Auto Refresh Page with Time script
By JavaScript Kit (javascriptkit.com)
Over 200+ free scripts here!
*/

//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit="00:10"

if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{ 
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
else
curtime=cursec+" seconds left until page refresh!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}
function makeDoubleDelegate(function1, function2) {
    return function() {
        if (function1)
            function1();
        if (function2)
            function2();
    }
}

window.onload = makeDoubleDelegate(window.onload, beginrefresh );
// ]]></script>
</vb:if>
This works very well. However the refresh time should be a little high, I have mine set to 15 minutes. This is because if someone is posting a reply or starting a new thread, if the refresh time is very low, the page will be refreshing when the user is trying post, and if the page is refreshed before the post is finished, the user's post will be cleared. Now i have my vB settings to save a draft of the user post before the refresh, so the user just has to click "Restore Auto-Saved Content" at the bottom of the Input Area. I don't know if that is a default setting or not, im not sure. But if its not, you could see how that could become a problem if the refresh time was really low.
Reply With Quote
  #9  
Old 01-13-2015, 05:08 PM
madness85 madness85 is offline
 
Join Date: Jun 2012
Posts: 175
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you must have your Session Timeout higher than in the code above for it to work {vb:raw vboptions.cookietimeout} * 1000); mine is set to 1800

@CAG CheechDogg nice script but that actually refreshes the page
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:02 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05497 seconds
  • Memory Usage 2,316KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (2)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (1)postbit_attachment
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete