You are here

function course_book_node_insert in Course 7

Same name and namespace in other branches
  1. 8.3 modules/course_book/course_book.module \course_book_node_insert()
  2. 8.2 modules/course_book/course_book.module \course_book_node_insert()
  3. 7.2 modules/course_book/course_book.module \course_book_node_insert()
  4. 3.x modules/course_book/course_book.module \course_book_node_insert()

Implements hook_node_insert().

Resave the book course object associated with this book page.

We need to do this so that proper hooks get run to set content access.

File

modules/course_book/course_book.module, line 252

Code

function course_book_node_insert($node) {
  global $user;
  if (!empty($node->book['bid'])) {
    if ($courseObject = course_get_course_object('course_book', 'book', $node->book['bid'], $user)) {
      $courseObject
        ->save();
    }
  }
}