Template talk:Registration required

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Inline Templates
This template is within the scope of WikiProject Inline Templates, a collaborative effort to improve and manage Wikipedia's inline footnote, cleanup and dispute templates. If you would like to participate, you can visit the project page, where you can join the project and see a list of open tasks.
Some discussion of this template may take place at the project's talk page, rather than here.


This template and the similar {{Subscription}} should probably have the same style. See the comment on that template's talk page. —Mrwojo (talk) 01:24, 8 November 2009 (UTC)

Instructions and examples[edit]

If anyone is having trouble understanding the instructions and examples I've tried to clarify a bit more here: Wikipedia talk:WikiProject Inline Templates#Template:Registration required/doc. -- œ 09:36, 14 February 2011 (UTC)

Uses within a paragraph or a bulleted list entry[edit]

(quoting the current template documentation) "Append this template directly after the external link or citation template, leaving the original link intact."

Does this mean "external link template or citation template"? More likely to me, this tag is intended for use with external links that are formed manually, either "within a paragraph" (mentioned earlier in the documentation) or within a bulleted list entry (not mentioned).

The documentation should mention bulleted list entries, perhaps specifically mention the standard External links section. It should illustrate such use of the template (as in documentation of {{subscription required}}) and also some commendable use "within a paragraph".

--P64 (talk) 19:57, 13 February 2013 (UTC)

It means to do it like this in references:
<ref>[http://www.example.com/ Example]{{registration required}}</ref>
<ref>{{cite web |url=http://www.example.com/ |title=Example }}{{registration required}}</ref>
or like this in a bulleted list:
*[http://www.example.com/ Example]{{registration required}}
*{{cite web |url=http://www.example.com/ |title=Example }}{{registration required}}
--Redrose64 (talk) 22:31, 13 February 2013 (UTC)

Can a parameter be added?[edit]

Would it be possible to add a "via" parameter to this template, comparable to the via parameter in the subscription template? We who have recently been given JSTOR accounts (see WP:JSTOR for more) would like to be able to indicate that articles can be accessed via that repository, and that it requires users to register before giving access. Currently, we're using the subscription template, but (since articles are available for free to those who register), it's not really the correct one to be using! Thanks, MeegsC (talk) 19:34, 18 September 2014 (UTC)

I heartily second this request. (Perhaps the via parameter code might be copied or adapted from the {{subscription required}} template?)
The Wikipedia Library is a big deal and a special consideration is needed for JSTOR, and all other content aggregators that require registration - and request attribution. See the project's Talk page, via JSTOR section (including supportive comment of Wikipedia Library project manager Ocaasi). It is important to properly credit Wikimedia Library partner JSTOR in an automatically verifiable fashion (for donating hundreds of free accounts). Without hard numbers - that only an automated citation parsing tool can provide - I see no reason for JSTOR to continue this program long-term; even a non-profit has stakeholders and must justify all expenditures. Additional benefits to Wikipedia alone, would include: 2) easing editor compliance with WP:SAYWHEREYOUGOTIT content guideline and WP:V; & 3) encouraging all article readers to freely verify cited reference themselves. Thank you for helping ensure this crucial partnership yields good results to all concerned for some time to come. Paulscrawl (talk) 23:44, 18 September 2014 (UTC)

Per above requests. It's been years since I installed and was sysadmin of a Wikimedia instance at work, but this is something easy.

I was unable to view, let alone edit, the registration required template code as it is unaccountably in full template protection mode, so I hope this edit request template gets attention to this long-outstanding issue. (The first request on this Talk page, for a change to exactly match the subscription required template's styling - or sensible lack thereof, was made in 2009.)

To fulfill two reasonable requests at once, it would be simplest and surest to literally copy the subscription required code and: 1) replace 2 words in the 10 short lines of code; 2) add 1 needed tracking category; and 3) substitute 2 tracking categories. Takes longer to explain than to actually do and I would if I had the power to do so. Took me just a few minutes to work out. Then just save as a much improved registration required template, with no loss of past functionality and no untested transclusion headaches. All pre-tested by robust subscription required code in use on over 100,000 pages.

I made all of 4 obvious text substitutions: 2 each of "Registration" for "Subscription" (lines 3 & 7) and "registration" for "subscription" (lines 4 & 8).

The 2 lines (5 & 10) including a page in one of two subscription-specific tracking categories require the substitution of 2 registration-specific tracking categories: 1) for use without via parameter (that category already exists) and 2) for use with via, a new (old? borrowed?;) tracking category.

I suggest:

  1. ADD, or REUSE, a without via category. EITHER: A) ADD Category:Pages containing links to registration-only content, as an exact analogue of its subscription counterpart (Category:Pages_containing_links_to_subscription-only_content). OR B) REUSE Category:Pages_with_login_required_references_or_sources, the one currently used by registration required template. Perhaps more meaningful. Ensures backwards compatibility with existing functionality. For latter reason alone, preferred.
  2. ADD with via category. EITHER: A) ADD Category:Registration required using via, for the same reason as 1A option, as an exact analogue of its subscription counterpart (Category:Subscription_required_using_via). Might be a convenience for editors moving miscategorized pages from the latter to the former category. OR B) ADD Category:Pages containing links to registration-only content using via: more meaningful, matches existing category in 1B above; allows drop-dead easy subcategorization, e.g., ...via JSTOR; ...via whatever content aggregator/future WikiPedia Library partner follows the same model.

(Note to anyone trying to follow this, but not seeing the tracking categories: they are "hidden" from normal page view and can be viewed by checking "Show hidden categories" on your Special:Preferences#mw-prefsection-rendering page. Then visit Wikipedia:JSTOR#Citation to see all three that are currently in use, 2 for subscription required (with via and without) and 1 for registration required. Don't delete them! They are placed there by these two templates, either in standalone mode or when called on ("transcluded") from use within the cite or citation templates.)

To make the above crystal clear, I've copied the subscription required template code below, minus some curly brackets, etc. (to avoid code execution; nowiki doesn't work on template code well) and showing only my 6 short text substitutions here, to make the simplicity of my respectfully repeated request obvious to all.

1. if: via  – via  via link note|note={{#switch: 1|not-sentence
2.  | s
3.  | sentence = Registration required.
4.  | registration required
5.  (Category:Pages containing links to registration-only content using via)|{{link note|note={{#switch: {{{1|not-sentence}}}
6.  | s
7.  | sentence = Registration required.
8.  | registration required
9.  (closing brackets)
10. includeonly (Category:Pages containing links to registration-only content) includeonly noinclude documentation noinclude

View (click Edit, but don't try to change (sensibly) semi-protected template code) original source here: {{subscription required}}

Admin(s)/Maintainer(s): Can this be done? If not, can you please explain why not? If it can be done, will you please do it? ;)

As an added courtesy, please make the fully-protected code page semi-protected, for code review purposes and alignment with subscription required template. Thank you for your attention. -- Paulscrawl (talk) 23:26, 5 October 2014 (UTC)

(edit conflict) Padlock-bronze-open.svg Not done: The page's protection level and/or your user rights have changed since this request was placed. You should now be able to edit the page yourself. If you still seem to be unable to, please reopen the request with further details. @Paulscrawl: I've reduced the protection to semi-protection as there were only 800 transclusions. It seems that there were many more transclusions in the past, before similar code was incorporated into Module:Citation/CS1, hence the full protection. I have to run out, so I don't have time to look through the code just at this moment, but feel free to ping me if you need any help with the code. — Mr. Stradivarius ♪ talk ♪ 23:46, 5 October 2014 (UTC)
Thanks for quick protection-level change. Looks like a two-liner in need of work, already done by subscription required. I'll have dinner and look it over again. All input welcome. -- Paulscrawl (talk) 00:10, 6 October 2014 (UTC)
@Paulscrawl: Proposed changes to templates are often best proposed by copying the template's source code to its sandbox subpage (in this case Template:Registration required/sandbox) page, amending that copy as required, then demonstrating in the template's /testcases subpage (in this case Template:Registration required/testcases). There is more on this at WP:TESTCASES.
It is always possible to copy the source code of a non-deleted page, even if you have the most basic rights and the page is fully-protected. Instead of an "Edit" tab, there will be a "View source" tab. Click that, and it opens what appears to be a normal edit window, except that you can't change anything inside it. But you can still mark text, and use the "copy" feature of the browser (but not "cut"); the copied text may be pasted elsewhere. On a Windows system, you can mark and copy all of the text by clicking anywhere inside that edit window, then press Ctrl+A and then Ctrl+C. --Redrose64 (talk) 06:54, 6 October 2014 (UTC)

────────────────────────────────────────────────────────────────────────────────────────────────────@Redrose64:Thank you for those pointers. It's been a long time since I edited Wikimedia templates and this will be my first for Wikipedia. Been meaning to learn this process. Testcases doc makes sense.

BTW, I did click "View source" when this template was in fully-protected mode and all I saw above the fold was the whitespace surrounding the full screen description of protection level, not the requested view of code (below fold). Can't replicate now - no matter, but a navlink (template page URL plus &action=edit, with link text "You may view or copy this code.") would be good to see top and center. Best right after text, "This page is currently protected so that only template editors and administrators can edit it." in box containing lock icon. Better UI, tone, and good fallback mode for lost users.

I'll sandbox this template later today, adding test cases and revised documentation as I go. Thanks again. -- Paulscrawl (talk) 09:31, 6 October 2014 (UTC)

The verbose description of protection level doesn't appear any more because the protection level was reduced. To see what I meant above, go to a page with high protection, such as Template:Citation needed, and try the "view source" tab there. You should see the verbose description of protection level (something like this although not necessarily exactly the same), and below that, the message "You can view and copy the source of this page:". Below that message is the edit box. When an edit box is below the fold, you can get there without scrolling by using the appropriate keyboard shortcut - the access key is a comma, so in Firefox under Windows you would use Alt+ Shift+, before using Ctrl+A and then Ctrl+C. --Redrose64 (talk) 10:04, 6 October 2014 (UTC)
Paulscrawl, with respect to categories, you have indicated (if I understand correctly) an "either/or" scenario, with the page being assigned to one category if |via= is supplied, and a different one if not. I just want to point out that this differs from the behavior of the {{Subscription required}} template. That template always assigns the category Category:Pages containing links to subscription-only content. If |via= is supplied, then the page is additionally assigned to Category:Subscription required using via.
I would recommend that we mimic that template's behavior closely, both from the perspective of maintainability, and also from the perspective of ease of expanding any existing automated reports and graphs. I would therefore suggest that this template continue to use the hidden category Category:Pages with login required references or sources. Additionally, if |via= is supplied, the new category Category:Registration required using via should also be included.
I've coded templates before, and am comfortable with making this change, if you'd like. I concur with the "best practice" methodology described by Redrose64, and I'm familiar with the "sandbox" and "test cases" techniques he described. Let me know if you want me to do this.  Grollτech (talk) 02:52, 12 October 2014 (UTC)
@Paulscrawl:, where do we stand with this? MeegsC (talk) 23:10, 21 November 2014 (UTC)


Via parameter added and tested - need review and advice on revised docs[edit]

@MeegsC:, I think it's done, including tests. Template:Registration required/sandbox Template:Registration required/testcases Need to copy & edit doc from Template:Subscription_required (as the whole point of this exercise is absolutely identical functionality for Template:Registration required) and edit to fit, retaining only redirects and other pertinent stuff from current doc for registration required. I'll get to that shortly, once I know where to put it without trampling on current doc or creating more work than need be when time to switchover to new and improved and tested template.

I wasn't clear if draft for doc goes in subpage for sandbox or testcases or where. @Grolltech:, could you please take a look and advise? I followed your suggestion on Category:Registration required using via - thank you for that. Paulscrawl (talk) 06:27, 10 December 2014 (UTC)

@Paulscrawl:, that's outstanding news! Thanks so much for taking this on. Let me know when the documentation is complete, and I'll post a note on the JSTOR project page. MeegsC (talk) 15:08, 10 December 2014 (UTC)
Aligning doc pages for consistency. Both should be almost identical. Better examples needed for Subscription required. Still asking for help.Paulscrawl (talk) 07:41, 14 December 2014 (UTC)
@Paulscrawl: I've looked over the code and the test cases, and I'd say it looks good. To be perfectly honest: staying true to the stereotypical "developers are terrible documenters" paradigm, I don't think I've ever created a sandbox documentation page, nor do I recall seeing that anyone else has either. You'll notice that when your code gets moved into the "live" template, the following code at the end of {{Registration required/sandbox}}:
<noinclude>{{template sandbox notice}}</noinclude>
would get replaced in the "live" {{Registration required}} template with this code:
Now, from a "purist" developer's standpoint, therefore, you should be able to create a {{Registration required/sandbox/doc}} subpage by clicking that red link. You can then display your new and improved documentation at the bottom of the sandbox, by instead coding:
<noinclude>{{template sandbox notice}}{{documentation}}</noinclude>
Hope that helps? On another tack, I've gone ahead and created Category:Registration required using via, and you'll notice that the {{Registration required/testcases}} page appears in the list, as expected. Because that is a hidden category, you'll only see it on the testcases page itself if your user preference 'Show hidden categories' is checked under "Advanced options". Good work! grolltech(talk) 13:04, 20 December 2014 (UTC)
Thanks, Grolltech. Makes sense. I'll try it when I return to civilization mid-January. Phone internet is killing me now. No reliable connection till then.
I'll document my attempts at a "purist" or literate programming approach to test-driven wikicode template/documentation. Or just learn Lua and be done with this horrible PHP hack forever! Paulscrawl (talk) 22:13, 25 December 2014 (UTC)