WSN Knowledge Base https://scripts.webmastersite.net/wsnkb/manual en-us Redirects Sometimes you want to control where the user will be sent after their interaction with the page. https://scripts.webmastersite.net/wsnkb/manual/other/redirects-657.html Tue, 05 Sep 2017 08:33:15 GMT https://scripts.webmastersite.net/wsnkb/manual/other/redirects-657.html
For links, just add a 'returnto' parameter specifying the relative in-site URL. For example, index.php?action=userlogin&returnto=index.php?TID=somecustomtemplate will prompt for login and then go to index.php?TID=somecustomtemplate after they log in. Note that this won't work if there's an & in the URL you want to redirect too, because it'll be interpreted as an & in the link URL separating parameters -- for such a case, your best bet is to set up a friendlier URL for that page in your Admin -> Settings -> SEO.

In a form, you can embed a hidden field <input type="hidden" name="returnto" value="index.php?TID=somecustomtemplate">

To redirect back to the current page, use {CURRENTRELATIVEURL}. For example, <a href="index.php?action=userlogin&returnto={CURRENTRELATIVEURL}">click here to login and then redirect</a>. Note that this *will* work with &s in link form because it encodes them.]]>
Open Hours At Admin Panel -> Settings -> Switches, you have an 'Open hours' option. https://scripts.webmastersite.net/wsnkb/manual/administrative-tasks/switches/open-hours-656.html Wed, 17 May 2017 23:10:48 GMT https://scripts.webmastersite.net/wsnkb/manual/administrative-tasks/switches/open-hours-656.html
Note that up to two sets of hours are supported for each day (this allows a place to have split hours with a break for lunch, like 8 AM - 12 PM and 1 PM - 5 PM). Using 3 or more sets for the same day may not sort correctly if entered non-chronologically, but very few businesses have 3 sets.

If you'd like to display the hours somewhere outside of the default location, you can use {LINKSHOWFIELD[hours]} or for a customized version you can copy and modify the custom display html from the Link Fields page into any other template where you're within the scope of a article.

In the open hours display, today's hours are automatically bolded. This styling is from the application of the css class todayhours to all sets of hours that are for today. You can re-style as desired by adding .todayhours { } to your stylesheet.

There are a few useful template variables related to the hours:
{LINKHASHOURS} - Tests if the article has any hours entered (for use in conditioanls).
{LINKISOPEN} - Tests if the business is currently open, for use in conditionals. Returns false if it's closed or has no hours entered.
{LINKCLOSINGSOON} - Tests if the business is currently open but is going to close within the next 60 minutes. For use in conditionals. Returns false if closed or if open for more than another hour. You can pass a parameter for a different number of minutes, like {LINKCLOSINGSOON[30]).
{LINKOPENSTATUS} - Displays "open", "closing soon" or "closed" (in English, so best used in conditionals)... or blank if there are no hours entered.
{LINKSHOWDAYHOURS[today]} - Displays the open hours (e.g. 8 AM - 5 PM) for the specified day parameter. The parameter can be 'today' or it can be a day of the week like Monday (which can be written out as Monday or as just Mon).

Note: these variables make the assumption that the viewer is in the same timezone as the business.

People can search by hours with either the simple or advanced search. For advanced searching, four radio options appear: "Any Time" (does not filter by hours), "Now" (filters to businesses currently open), "On __ at __" (filters to a particular time) and "On __ from __ until at least __" (filters to businesses open for the entirity of that length of time).

For any search form you may be using, whether it's simple or advanced search, you can include this simple checkbox to allow people to filter to businesses currently open: <input type="checkbox" name="openhoursquerytype" value="now">

Because the filtering by hours happens mostly on the php side rather than in the database query (which only filters by day open), you will notice that searches with large numbers of results have a different number of articles per page than normal. To account for the probability that the majority of the articles may be currently closed, WSN queries several times more articles than usual on the first page and then dynamically alters the number of articles per page for the subsequent pages to a value that seems appropriate to the results, in hopes of giving you something similar to the number of displayed results you want.]]>
Combination Simple and Advanced Search Sometimes you may wish to blend the simple search box and advanced field filter searches. As of version 10.1.6 Beta 4 and later, this is now possible. https://scripts.webmastersite.net/wsnkb/manual/configuration/searching/combination-simple-and-advanced-search-655.html Tue, 21 Mar 2017 20:51:09 GMT https://scripts.webmastersite.net/wsnkb/manual/configuration/searching/combination-simple-and-advanced-search-655.html
Start with your advanced search form. To construct a custom advanced search form, one easy approach is to use your browser's "view source" option when viewing the advanced search page on your site. Then use ctrl+f to locate "Find Articles". Copy that whole box and then remove whichever article fields you don't want searched in your custom form.

To incorporate the simple search box into the custom advanced search box you've made, let's make it the first row of the table just below <table> like this:
<tr><td>Any searchable field</td><td><select name="condition">{FUNC_SIMPLESEARCHCONDITIONOPS}</select></td><td><input type="text" name="search" class="standardinput" placeholder="type your simple search term here"></td></tr>


If you prefer not to allow a choice of condition for the simple search, replace the condition selector with <input type="hidden" name="condition" value="{DEFAULTSEARCHTYPE}"> to use the default simple search type automatically.]]>
Playing MP3 Audio Files For some websites, simply linking an MP3 file for download when it's uploaded to a article isn't good enough -- you may want a built-in audio player i https://scripts.webmastersite.net/wsnkb/manual/extending/adding-fields/file-attachments/playing-mp-audio-files-654.html Thu, 16 Feb 2017 22:59:46 GMT https://scripts.webmastersite.net/wsnkb/manual/extending/adding-fields/file-attachments/playing-mp-audio-files-654.html
To put the audio player in the attached files section of the details page, go to Admin Panel -> Articles -> Article Fields and edit the "Attach Files" field. Find the "Custom Display HTML" section near the bottom, and add this at the top of that box:
<!-- BEGIN TOPLIST -->
<CONFIG>attachments,sortorder;time,50,ascending;ascending,type='link' AND objectid={LINKEFFECTIVEID} AND (filetitle LIKE '%.mp3'),,,0,0,0,0,0,0,,0</CONFIG>
<div class="audio"><audio controls="controls" src="{DIRURL}/download.php?attachid={ATTACHID}&id={ATTACHID}&action=stream" preload="none"></audio></div>
<!-- END TOPLIST -->


If you wish to forbid downloads and only allow listening via the player, find this section near the bottom:
<ul>
<!-- BEGIN LINK ATTACHMENTS -->
<IF not {ATTACHISIMAGE}>
<li><a href="{ATTACHDOWNLOADURL}" title="{ATTACHLABEL}">{ATTACHFILETITLE}</a> ({ATTACHKB} {LANG_GENERAL_KB}, {ATTACHDOWNLOADS} {LANG_DETAILS_DOWNLOADS})</li>
</IF>
<!-- END LINK ATTACHMENTS -->
</ul>
and replace it with
<ul>
<!-- BEGIN LINK ATTACHMENTS -->
<IF not {ATTACHISIMAGE}>
<IF {ATTACHEXTENSION} is not mp3>
<li><a href="{ATTACHDOWNLOADURL}" title="{ATTACHLABEL}">{ATTACHFILETITLE}</a> ({ATTACHKB} {LANG_GENERAL_KB}, {ATTACHDOWNLOADS} {LANG_DETAILS_DOWNLOADS})</li>
</IF>
</IF>
<!-- END LINK ATTACHMENTS -->
</ul>


That's it! You'll now automatically see an audio player on the details pages of articles that have mp3 files.]]>
System Cron to Ensure Timed Tasks and Helper Completion On a low traffic site, or a site where most traffic is guests and guest page caching is turned on, you may find that things aren't getting done. https://scripts.webmastersite.net/wsnkb/manual/other/system-cron-to-ensure-timed-tasks-and-helper-completion-653.html Thu, 12 Jan 2017 03:54:34 GMT https://scripts.webmastersite.net/wsnkb/manual/other/system-cron-to-ensure-timed-tasks-and-helper-completion-653.html
The solution to this problem is to set up a system cron to make sure all pending tasks get run reasonably often. You can do this through your web hosting control panel -- search it for "cron" and you'll find a cron jobs page in every popular hosting control panel. Using that interface, set up a cron to run every 30 minutes (that should be sufficient for most situations) which will run the following command:

curl --silent http://yoursitepath/helper.php?action=helpercron >/dev/null 2>&1

Be sure to replace yoursitepath with your installation URL. If your server doesn't have curl, you may need to use wget instead:

wget -O -q 'http://yoursitepath/helper.php?action=helpercron']]>