I would like to copy the book module and rename it 'wikibook'. Is this a major effort or a simple find and replace?
The reason for this is that we need a content type like the book module that everyone can freely add to and edit. We also need a content type like the book module that only certain roles can write to and only certain roles can read or comment on.
We are using Drupal permissions to restrict or allow for content type creating, editing, etc, but this limits access control between groups for certain content that should be shared among groups but protected from creating pages, editing, etc by non group members. Roles are not unique to groups, they span groups - ie, 'bookeditor' is a role that spans all groups, but only those with the 'bookeditor' role can edit books within their specific group - they can't access other groups books unless the other groups 'bookeditor' publishes a book with their specific group selected as an 'Audience' enabling that groups 'bookeditor' role members to have equal control over the book. It would be optimal if there was a way to only allow non-group members who also belonged to the 'bookeditor' role to only view or comment on another groups book, but this does not seem possible. So the next best thing that I can think of is to have a whole new content type editable by the all user's role and keep the book content type restricted.
Thanks

Comments

vm’s picture

http://drupal.org/search/node/duplicate+book+module

check out the first result using search!
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

kpm’s picture

I did see that how to and should have mentioned that in my original post. It has a couple of steps which leave me a bit confused as to which file I should be editing. I was hoping to find another how to, or hopefully a generic method or steps required to copy any module. I left a comment on that post about how to copy the book module seeking clarification.

Thanks

vm’s picture

your clarification:

STEP 1:


A) if the book.module is enabled, disable it.
B) download from your site modules/book/book.module to your desktop
C) open the book.module file

FIND (every instance of):
if ($type == 'node' && isset($node->parent)) {

CHANGE TO:
if ($type == 'node' && isset($node->parent) && $node->type == 'book') {

C) remove // $Id: book.module
D) reupload the book.module file
E) reenable the book.module

OK, the above prepared the orginal book.module for another instance of the same "type" of module and will allow it to not be confused by the new dupbook.module we are about to create.

STEP 2:


A) copy the entire modules/book folder from your server to your desktop (YES! the entire folder including the file you just altered)
B) rename the folder dupbook
C) rename all files (dupbook.module, dupbook.install, dupbook.css, dupbook.info)
D) open each file and replace every instance of book with dupbook
E) save files
F) upload dupbook folder to sites/all/modules
G) enable new dupbook module

I HIGHLY suggest trying this on a local install or on a test site on your server and not just throwing it in your production site until you are sure it is working as expected. The handbook page was written for the 4.7.x version of book. As such, we may be missing a step or two. Once the dupbook module is uploaded and enabled a new table will be created in the DB, and a new content type for it in create content, along with all the other bells and whistles the original book module offers.

kpm’s picture

I did, before reading your response attempt to recreate the book module by simply copying it and renaming directory, all files, and all instances of 'book' with 'wikibook', all instances of 'Book' with 'wikiBook', all instances of 'book_' with 'wikibook_', all instances of 'book navigation' with 'wikibook navigation', etc. A total of 269 edits on the book.module. I did this because of how the 4.7 book copy how to was written, and I assumed it was simply trying to avoid all those edits... Anyway, it somewhat worked, but the navigation didn't appear, so after getting the clarity here, tried again with the same wikiBook directory I had created. I then edited the book.module as mentioned in step one and got myself a bit closer to the goal. Now, the only thing I can see that is not working properly is that the 'add child page' and 'printer friendly version' links on the bottom of book pages have been duplicated and they appear normally on the bottom of 'wikiBook' posts.
Thanks for all the help.

kpm’s picture

I have managed to get almost everything working and am going to repost for some help with my current conundrum (dealing with the 'Outline' component of the Book Module). And just in case anyone else follows these instructions, I'm sure you meant, In step 1-D, to instruct the reuploading of the book.module to the /sites/all/modules/ directory rather than the core modules directory.

I reposted another forum topic on this that consolidates all the steps and gets to my current conundrum... which I am sure has to do with me taking a mile when given an inch... I tried to do the same thing with the Book Expand module.... see node/186742.