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.]]>
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']]>
Hybrid Field References Calling the field manager's output HTML for a field from anywhere in a template. https://scripts.webmastersite.net/wsnkb/manual/other/hybrid-field-references-645.html Mon, 04 Jan 2016 16:04:10 GMT https://scripts.webmastersite.net/wsnkb/manual/other/hybrid-field-references-645.html The article details page may be the most important page on your site, so you probably spend a lot of time customizing it.

The grid-based display of field info on the article details page in the last few series of WSN makes things simple for you. You can manage everything via the field manager, set the order automatically, and not have to mess with the template at all. But sometimes you want more control to make a unique and beautiful layout. So far, the way to do that has been to do things the old pre-field-manager way by putting the template variables directly in the details template. But then your field manager becomes nearly useless and you have to re-write/copy the field display HTML each time you use it. There must be a better way.

In WSN 9.2.39 I'm adding a new, hybrid approach. Instead of rebuilding all your display HTML for each field to take it out of the table, you can now call the field label and the field output HTML separately anywhere in a template. Just use {LINKFIELDLABEL[fieldname]} and {LINKFIELDOUTPUT[fieldname]}. For example, for the tags field:

<div><b>{LINKFIELDLABEL[tags]}</b></div>
<div>{LINKFIELDOUTPUT[tags]}</div>

This way the field manager remains a useful way to manage the output HTML and the label text, although of course the display orders set in the field manager can't affect your free-floating field references.

These LINKFIELDLABEL/LINKFIELDOUTPUT template variables will return content on the details page even when you have the field manager set to not display the field on the details page, so you can uncheck that display box to take it out of the tabular section if you want to have some of the page remain in the tablular format while moving certain fields out of it.

]]>
Google Sign-In For user convenience, maybe websites these days have a 'login with google' button that allows users to bypass the traditional registration/login forms https://scripts.webmastersite.net/wsnkb/manual/other/google-sign-in-642.html Mon, 30 Mar 2015 10:42:51 GMT https://scripts.webmastersite.net/wsnkb/manual/other/google-sign-in-642.html For user convenience, maybe websites these days have a "login with google" button that allows users to bypass the traditional registration/login forms and be logged in with just a click without having to remember a password. To enable google sign-in with your WSN 9.1.18 or later website:

  1. Go to https://code.google.com/apis/console/ then open the "APIs & auth" menu and choose "Credentials".
  2. Click the OAuth "Create new Client ID" button and select "Web Application" as the application type.
  3. Configure the consent screen as desired when prompted.
  4. When prompted for "Authorized Javascript Origins", enter your website URL(s). For "Authorized Redirect URIs" enter the URL of index.php?action=googlelogin on your site(s).
  5. Your credentials are now ready. Copy the Client ID and Client Secret it shows you to WSN's Admin Panel -> Members -> Member Settings -> Google Sign-In.

When a site visitor clicks the "sign in with google" image link on your site, they're taken to a google permissions page. If they approve, and their email address is already in your member database, then that preexisting account is automatically associated with the google login and becomes a one-click login. If their email isn't in the database but cookies indicate they do have an account already, a cookie is set with their google id so that once they sign into their account the regular way the account will be associated with the google login. If they're a new person not in the member database, then a new account it generated using their full name as username (with modifier numbers if needed). The new member is then told that they can change their name to something more anonymous by editing their profile, if they wish to. Google and Facebook registrations are automatically allowed at least one username change.

If the member is in your site's database and their account is already associated to their google account, then they're instantly logged in.

Important: Member system integration with non-WSN scripts may not be compatible with Google Sign-In.

]]>
Sales There are two ways to sell products on your WSN site: A shopping cart where people buy products from you Classifieds where submitters list their ow https://scripts.webmastersite.net/wsnkb/manual/other/sales-641.html Thu, 05 Mar 2015 12:37:24 GMT https://scripts.webmastersite.net/wsnkb/manual/other/sales-641.html
  1. A shopping cart where people buy products from you
  2. Classifieds where submitters list their own products and payment buttons and visitors buy from them

Once you switch on sales at Admin -> Settings -> Switches, there will be a settings page at Admin -> Revenue -> Sales Settings. On top of that page, your first choice is which of the two above types of sales you'd like to do. For more information on either type of sale, click the type above.]]>