7

From time to time I stumble about code snippets in plugins, themes or even in questions on this site where people copy/pasted code from some question or answer here on WordPress.StackExchange without attribution. Every code here on the page is CC-BY-SA 3.0 licensed. Part of that license is the following:

Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

I know that not everyone has my view on that topic, but that does not make it right to simply leave out any attribution and let the result look like someones own work.

Goal of this question:

What I would like to see is an answer where we can point people at, that quickly explains the topic and offers a copy/paste template for a phpDocBlock, a README or whatever idea you could come up that makes it as painless as possible to give proper attribution and clearly state how the snippet is licensed.

Please only write one template, one explanation, one whatöver per answer. This makes linking to it much easier. Thanks.

2
  • Hate to be 'That Simpleton', but what does this mean for the everyday user? Should we be putting Copyright templates at the top of all our code (in the outside world) or does this only apply to people publishing plugins?
    – Howdy_McGee Mod
    Commented Apr 7, 2014 at 23:08
  • 1
    @Howdy_McGee In fact the license really means that you need to give attribution when using that code. It does not have to be as extensive as Chip has shown in his answer, but you need at least to mention the original author and a link to the original source as well as the license. The phpDocBlock standard even has @link for that.
    – kaiser Mod
    Commented Apr 7, 2014 at 23:32

2 Answers 2

4

The elephant in the room is that CC is grossly incompatible with WP's GPL-and-stuff shebang. Same issue exists in larger PHP world with the fact that PHP docs (and tons of heavily reused user submitted snippets in them) are CC as well.

I vaguely remember there is CC code straight lifted from PHP docs even in WP core.

I would say de-facto most code reuse from our stack happens under fair use rather than CC. Forcing strict hundred percent CC ruling on all code severely compromises the usefulness of answers for WP development.

1
  • 3
    I agree, for related reasons. Most code posted to WPSE is likely not copyrightable, as much of the code is simply API usage. Some code is copyrightable to some extent, obviously. But the purpose of the OP is to provide a template to follow for those who choose to provide attribution when required (or perhaps even if not required). Commented Apr 7, 2014 at 19:13
4

Whether licensed under the SE-standard CC-By, or as many of us state, licensed under GPL, attribution is required when distributing that code.

For both CC-By and GPL, that required attribution must be appropriate for the medium of the work, and must include the copyright and license declaration of the original work.

For PHP code, the attribution method generally accepted as appropriate is a comment in the file header phpDoc block or function phpDoc block.

In either case (though I'll use the function docBloc as an example), the minimum-acceptable amount of information is a declaration that the code is - or is derived from - another work, along with the copyright and license declaration from the original, and a link to the full-text license terms.

It is also generally appropriate, though not necessarily required, to include a link to the source.

For example:

/**
 * Some function that does something
 * 
 * This function is derived from code posted on the
 * WordPress Development StackExchange site. The 
 * original code is copyright (c) 2014 Chip Bennett, and
 * is distributed under the terms of the Creative Commons
 * CC-By-SA 3.0, and under the terms of the GPL, version 2.0 or later.
 * 
 * @link http://wordpress.stackexchange.com/a/654321
 * 
 * @link http://creativecommons.org/licenses/by-sa/3.0/
 * @link http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */
function wpse123456_some_function_name() {
    // function code here
}

One concern I have, though, is that, unless a user clicks through to my WPSE profile, that user will likely never know that I dual-license my WPSE code, to ensure that it is distributable under GPL as well as the SE-standard CC-By-SA.

It would be nice if we could formally declare all WPSE code as dual-licensed under the SE-standard CC-By-SA, and GPL.

Edit: CC-By Attribution Requirements

To be clear, the CC-By terms for attribution are quite specific:

If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Ssection 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.

Broken down:

(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing:

  1. the name of the Original Author
  2. the title of the Work if supplied
  3. the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work;
  4. consistent with Ssection 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation

The relevant clause is (3):

  • the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work

The attribution-required URI must be specific to the copyright notice or licensing information for the work. Otherwise, any specified URL falls outside the scope of the attribution clause of the license.

4
  • Thanks for that answer. I'd suggest that you raise the dual license question as separate question here on Meta.
    – kaiser Mod
    Commented Apr 7, 2014 at 18:53
  • Perfectly agree, +1, Just a note, actually, link to original content is required.
    – gmazzap
    Commented Apr 7, 2014 at 18:54
  • Also "For example, code from Stack Overflow could be directly incorporated into open-source software, and GPL code could be used as examples on those sites." citation from here
    – gmazzap
    Commented Apr 7, 2014 at 18:58
  • "Just a note, actually, link to original content is required" - no, not true. All that is required under the CC-By term is a link to the license terms. I've had this argument several times with unscrupulous Theme distributors. Commented Apr 7, 2014 at 19:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .