I have been plugging away at duplicating the Book module and have been surprised with the progress (I am not a coder).
The current conundrum has to do with the 'Outline' functionality. I'll explain what I have done so far and then describe the issue that I am hoping a coder out there can shine some light on for me.
this is all gleaned from the How to make a duplicate Book module for version 4.7. And with some clarity help from VeryMisunderstood at node/185709

  1. Take site offline and backup database (/admin/settings/site-maintenance)
  2. Disable the book module (/admin/build/modules)
  3. Copy the \drupal\modules\book directory to \drupal\sites\all\modules\book (or to \drupal\sites\modules\book if you are not working with a multi-site set up)
  4. Edit the \drupal\sites\all\modules\book\book.module file
    • Find: if ($type == 'node' && isset($node->parent)) {
    • Replace with: if ($type == 'node' && isset($node->parent) && $node->type == 'book') {
    • Delete line 2, it looks like this: // $Id: book.module,v 1.406.2.1 2007/02/14 04:30:33 drumm Exp $
    • Save the file and you can now re-enable the book module (/admin/settings/site-maintenance)
    • Now make a copy of \drupal\sites\all\modules\book in the same directory and give it a new name, I am calling it wikibook
    • Go to \drupal\sites\all\modules\wikibook and rename every file:
      • book.css to wikibook.css, book.info to wikibook.info, book.install to wikibook.install, and book.module to wikibook.install
    • Open each file and rename each instance of 'book' with 'wikibook', each instance of 'Book' with 'wikiBook', each instance of 'book_' with 'wikibook_', each instance of 'book navigation' with 'wikibook navigation', etc. I counted a total of 269 edits on the book.module.
    • Save all files
    • Enable wikiBook
    • This should leave you with both a working Book and wikiBook content type. Next step for me was to go to configure the wikiBook content type to create revisions and then enable all users to have access to create wikiBook pages, to edit wikiBook pages, etc, and to ensure that on the Book content type that only certain roles be able to edit all book pages and everyone else can only 'edit own' book pages.
      The problem I am now grappling with is that on both Book and wikiBook pages, if I select the 'outline' tab, the first two lines on the page are:

      The outline feature allows you to include posts in the book hierarchy.
      The outline feature allows you to include posts in the wikibook hierarchy.

      there should be one or the other. Also, the 'parent' hierarchy dropdown defaults to the new wikiBook hierarchy for both the wikibook and book, regardless of whether it is a book you are actually using.

      (Note: I also have the BookExpand module to use with Organic Groups, so basically did the same thing with it. I have the Book Expand module to filter the book hierarchy so that when a member of a group selects to create a book page they would be limited to creating books within their group. Also, when a new group is created, the Book Expand module automatically creates a new book for that group, and now the wikiBookExpand module does the same function for groups, creating a wikiBook as well as a default 'handbook'.)

      Hopefully someone can help me reconcile this, otherwise its back to the drawing board, disabling Organic Groups and going back to using the Taxonomy Access Control with lots of roles to manage.

      Thanks

    Comments

    ronliskey’s picture

    Another way to avoid the parent/child conflict with the book module is to change all occurrences of 'parent' in your copied module. The key here is to be sure this also changes the name of that field in your module's database table (set in the install file). A nice advantage to doing it this way is you won't have to hack the book module.

    Let's say you change 'parent' to 'adult' in your module's files. Then your module will look for adults and the book module will continue looking for parents. Each will happily find what it seeks, but similar to real life, no 'parent' will ever be an 'adult'. Thus the twain shall never meet.

    I also found a similar conflict with the outline function. I just commented out the code that produces the 'Outline' button in the copied module. Look for the following near line 130:

    if (arg(0) == 'node' && is_numeric(arg(1)) && user_access('outline posts in NAME_OF_YOUR_MODULE)) {