How can I modify the Book Copy module in Drupal 6 to change the name of the copy to a different name? -


By default, the book copy module will create a new book with the same exact name that it is copying, it can be confusing. And in fact, one of the site developers is accidentally removed from the original book, which was a reference in the menu and left the site in such a way and in a strange situation.

In addition to the original name, this problem has never happened again. I dug through the code but just could not understand it. Any help will be greatly appreciated. Thanks!

You can use the hook_book_copy_alter () Book_copy_copy_book ( ) :

  ... // is the function signature: hook_book_copy_alter (& amp; $ node, $ oldbid, $ newbid); Drupal_alter ("book_copy", $ node, $ bid, $ newbid); ...  

Therefore, in a custom module, you can apply the following to get a changed title on the new node:

  function Your module_book_copy_alter (& amp;; $ node, $ oldbid $ newbid) {// Adjust the title ... $ node- & gt; Title = 'Copy'. $ Node- & gt; Title; // TODO: Change the difference you want // ... and then save the node to node_save ($ node); }  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -