|
|
Posted: Jul 1st, 2007 at 04:23 pm
|
|
|
Place this module in your global footer.
Notes
- A user must visit your forum then close their browser and revisit before the code will work.
- This code uses session cookies and therefore users must close their browser and revisit to have it count as a new visit. (Also the reason for the above.)
If you have any questions, please post in this thread.
Code:
<form name="vpslv" action="?action=search#results" method="post" style="display: none">
<input type="hidden" name="submit_val" value="1" />
<input type="hidden" name="filter_member_ids" value="" />
<select name="search_type">
<option value="posts" selected="selected">posts</option>
</select>
<input type="text" name="search_string" value="%%%" size="25" />
<select name="matching">
<option value="any_words" selected="selected">any words</option>
</select>
<select name="search_area">
<option value="all" selected="selected">entire post</option>
</select>
<select name="scope[]">
<option value="all" selected="selected">» Entire Site «</option>
</select>
<input type="text" name="filter_usernames" value="" />
<select name="filter">
<option value="">Select Member(s)</option>
</select>
<select name="date_filter_type">
<option value="within_the_past" selected="selected">within the past</option>
</select>
<input type="text" name="specific_date_month" value="" /><input type="text" name="specific_date_day" value="" /><input type="text" name="specific_date_year" value="" />
<input type="text" name="between_month1" value="" /><input type="text" name="between_day1" value="" /><input type="text" name="between_year1" value="" /><input type="text" name="between_month2" value="" /><input type="text" name="between_day2" value="" /><input type="text" name="between_year2" value="" />
<input type="text" name="within_the_past_time" value="1" />
<select name="within_the_past_type">
<option value="minutes" selected="selected">minute(s)</option>
</select>
<select name="max_results">
<option value="all" selected="selected">no limit</option>
</select>
<select name="results_per_page">
<option value="25" selected="selected">25</option>
</select>
<select name="display_as">
<option value="posts" selected="selected">posts</option>
</select>
<select name="sort_by">
<option value="date" selected="selected">date</option>
</select>
<select name="order">
<option value="desc" selected="selected">descending</option>
</select>
<input type="submit" value="Search" />
</form>
<script type="text/Javascript">
// View Posts Since Last Visit by Chris
// Do not redistribute outside of HyperBoards Support or Studio Zero
var hb_userid = (document.getElementById("personal_bar_table").getElementsByTagName("a")[0].href.match(/member_id=(\d+)/i)?RegExp.$1:0);
if(document.getElementById("toolbar_table") && document.quick_search && !document.quick_search.topic && hb_userid != 0){
if(document.all){
var i = document.createElement("button");
} else {
var i = document.createElement("input");
i.type = "button";
}
i.value = "Posts Since Last Visit";
document.quick_search.appendChild(i);
i.onclick = function(){
var f = document.forms.vpslv;
var x = (new Date()).getTime()-vpslvLastTime;
x = Math.ceil((x/1000)/60); // Milliseconds to seconds to minutes
f.within_the_past_time.value = x;
f.submit();
}
var _vc = {
get: function(n){
if(document.cookie.match(new RegExp("pslv_"+n+"=(.+?)(;|$)", "gi"))){
return RegExp.$1;
}
return 0;
},
set: function(n, v, e){
document.cookie = "pslv_"+n+"="+v+";"+(e?"expires="+(new Date( )).toGMTString().replace(/\d{4}/, "2050"):"");
}
}
var vpslvLastTime = _vc.get("session_visit") || _vc.get("last_visit") || 1;
_vc.set("session_visit", vpslvLastTime);
_vc.set("last_visit", (new Date()).getTime(), true);
}
</script>
« Last Edited by
Chris
Jul 26th, 2007 at 03:14 pm »
|
|
Logged |
|
|
|
Schuler
New Member  Member is offline
Posts: 22
|
Posted: Jul 19th, 2007 at 09:31 pm
|
|
|
Hey, that's pretty neat. Consider it stolen!
--Schuler!
|
|
Logged |
|
|
|
Schuler
New Member  Member is offline
Posts: 22
|
Posted: Jul 20th, 2007 at 10:22 am
|
|
|
Okay, one thing. It shows the search-page, but the field for "Max Results" is the default value, prompting the user to enter a value. Did I copy/paste the code incorectly, or is this how it's supposed to work?
--Schuler!
« Last Edited by
Schuler
Jul 20th, 2007 at 11:11 am »
|
|
Logged |
|
|
|
|
|
Posted: Jul 24th, 2007 at 05:15 pm
|
|
|
Was a typo on my part. I've fixed that bug.
|
|
Logged |
|
|
|
macrs2k
New Member  Member is offline
Posts: 1
|
Posted: Sep 7th, 2009 at 02:11 pm
|
|
|
hey chris,
tried adding this module to our site... highlandoldskoolfords
prob something i have done wrong as im pretty new to all this but when you click on the icon it opens up the search box and nothing happens.
any advice/help would be fantastic
cheers fae macrs2k
|
|
Logged |
|
|
|
|
|
Posted: Sep 7th, 2009 at 11:53 pm
|
|
|
macrs2k,
It appears that you have the code in your global header. Try moving it to your footers and see if that fixes it
|
|
Logged |
|
|
|
ennui
New Member  Member is offline
Posts: 2
|
Posted: Oct 20th, 2009 at 12:26 am
|
|
|
I have also tried to include this post on my 3alegions forums
It is posted in the Global Footer, but gives me the Search function displaying all posts from the last 20933611 minutes.
Any help appreciated! And thanks, Chris, for working on this code for us.
|
|
Logged |
|
|
|
|
|
Posted: Oct 20th, 2009 at 09:48 pm
|
|
|
Oct 20th, 2009 at 12:26 am, ennui wrote:
I have also tried to include this post on my 3alegions forums
It is posted in the Global Footer, but gives me the Search function displaying all posts from the last 20933611 minutes.
Any help appreciated! And thanks, Chris, for working on this code for us.
Make sure you log out and then back in to reset the "last visit" timer!
|
|
Logged |
|
|
|
ennui
New Member  Member is offline
Posts: 2
|
Posted: Oct 24th, 2009 at 10:19 pm
|
|
|
Thanks for the prompt response, Benjamin.
Yeah, I did that a few times and also manually cleared the cookies before posting here.
|
|
Logged |
|
|
|
Schuler
New Member  Member is offline
Posts: 22
|
Posted: Oct 28th, 2009 at 07:53 pm
|
|
|
I've noticed that this function--though tremendously handy--also returns the full text of posts made in Groups nominally protected by password access. It appears that the basic, manual Search function does the same thing. As a result, I've temporarily made the password-protected Board accessible to staff only, and this seems to have stopped the problem but not solved it; I'd like to have a board available for private discussions not visible to anonymous guests.
Is there a way to exclude specific posting-groups from the Search function?
Thanks!
Schuler
http://bloks.hyperboards.com
« Last Edited by
Schuler
Oct 29th, 2009 at 01:10 am »
|
|
Logged |
|
|
|
|
|
Posted: Nov 4th, 2009 at 10:21 am
|
|
|
Oct 28th, 2009 at 07:53 pm, Schuler wrote:
I've noticed that this function--though tremendously handy--also returns the full text of posts made in Groups nominally protected by password access. It appears that the basic, manual Search function does the same thing. As a result, I've temporarily made the password-protected Board accessible to staff only, and this seems to have stopped the problem but not solved it; I'd like to have a board available for private discussions not visible to anonymous guests.
Is there a way to exclude specific posting-groups from the Search function?
Thanks!
Schuler
http://bloks.hyperboards.com
Your best bet to get this fixed is to post a bug report regarding this.
|
|
Logged |
|
|
|
Schuler
New Member  Member is offline
Posts: 22
|
Posted: Nov 6th, 2009 at 09:07 am
|
|
|
|
Thanks--will do!
|
|
Logged |
|
|
|