default copyright per each user

ksoonson - April 29, 2007 - 02:27
Project:Copyright
Version:5.x-1.1
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

it would be great if the user can set his/her default copyright for his/her content so that he/she does not have to set copyright every time he/she posts a new node.

thanks very much for nice module!

#1

75th Trombone - May 25, 2007 - 19:48
Status:active» needs review

Patch attached.

All the new functions are at the bottom of the file for easy reference. I don't know if this is bad etiquette or not; correct me if it is.

I may not have abstracted out the database-writing functions enough; I know for a fact it's not consistent with the current private DB-writing functions, but I wasn't sure it needed to be in this case.

I eagerly await input and correction on anything I've done wrong.

DISCLAIMER

This is my first Drupal patch, as well as my first real contribution to any stable base of code in any language.

This patch may not work. This patch may melt your hard drive. This patch may rape your wife and enslave your children.

I'm a newbie. You have been warned.

#2

75th Trombone - May 25, 2007 - 19:49

Patch actually attached this time. >.<

AttachmentSize
copyright.module_0.patch 4.24 KB

#3

75th Trombone - May 25, 2007 - 19:54

And I forgot, this requires a new database table called {copyright_user} with two columns: uid (int(10), primary key) and cpyid (int(10)).

Will work on patching copyright.install.

#4

Robrecht Jacques - May 26, 2007 - 11:00
Status:needs review» needs work

I will test the patch later today. Some observations:

  • implement the $op = 'delete' for hook_user(): remove the row for that user,
  • Instead of
    <?php
    +          if ($notices) {
    +           
    $license .= ' (';
    +             
    +              foreach(
    $notices as $key => $notice) { // Iterate through the accumulated notices and add the text
    +                $license .= $notice;
    +                if (
    $key < (count($notices) - 1)) {
    +                 
    $license .= ', ';
    +                }
    +              }
    +           
    $license .= ')';
    +          }
    ?>

    use
    <?php
    if (count($notices)) {
     
    $license .= '('. implode(',', $notices) .')';
    }
    ?>
  • rename $default to $site_default so it is clearly different from $user_default. At one point someone may add $type_default. Renaming the variable $default may make it more clear what default we are talking about later on,
  • use if ($user_default > 0) instead of if ($user_default). Or use if (isset($user_default),
  • as of the place of the code: at the bottom is fine. Just add a
    /******************************************************************
    * Support for user default copyright.
    ******************************************************************/

    thingy above your set of functions.

The rest looks fine (but I haven't tested it). Implement a patch for copyright.install, which should implement copyright_update_5() which creates the new table (next to creating the table in copyright_install().

Thanks a lot!

#5

75th Trombone - May 26, 2007 - 17:16

hehh, I feel stupid about that implode() thing. I knew the function existed, but couldn't think of the name. <.<;;

Thanks for the help. I should get to this tonight or tomorrow. Should I submit a patch to my patch, or a patch to the original file pre-patch?

#6

Robrecht Jacques - May 26, 2007 - 18:14

No problem.

The patch should be against the original file, not to an already patched file.

Oh, by the way: is this for Drupal 4.7.x or 5.x ? Please indicate it when you follow up on this issue with your new patch.

#7

toemaz - May 27, 2007 - 17:42

For what it's worth: I'm in favour of this feature.

#8

ksoonson - May 28, 2007 - 07:02

hehe... I also love this feature very much... :-)

#9

Robrecht Jacques - May 31, 2007 - 14:00

75th trombone: any update on this? Basically the patch was ok, just some minor cleanups. Attach a new patch so I can easiliy commit it.

Thanks!

#10

Robrecht Jacques - June 4, 2007 - 10:31
Version:HEAD» 5.x-1.x-dev
Status:needs work» fixed

Fiex in 5.x-1.x-dev. Will be included in the next release of copyright module (5.x-1.1).

#11

ksoonson - June 7, 2007 - 10:42

Yeah! Great news~

#12

ksoonson - June 12, 2007 - 07:08

when will the new version be released so that people can try / use?

will it be okay for using CVS version?

I am anxious to see the new version with this feature~~

#13

Robrecht Jacques - June 12, 2007 - 12:06
Version:5.x-1.x-dev» 5.x-1.1

New version has been released: 5.x-1.1. If there are any problems with it, create an new issue with some bug report. Thanks!

#14

Anonymous - June 26, 2007 - 12:18
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.