- Patch #67229 by dww and chx: cleaned up book_load().
parent
811b313340
commit
fc50f96c96
|
@ -173,23 +173,7 @@ function book_block($op = 'list', $delta = 0) {
|
|||
* Implementation of hook_load().
|
||||
*/
|
||||
function book_load($node) {
|
||||
global $user;
|
||||
|
||||
$book = db_fetch_object(db_query('SELECT * FROM {book} WHERE vid = %d', $node->vid));
|
||||
|
||||
if (arg(2) == 'edit' && !user_access('administer nodes')) {
|
||||
// If a user is about to update a book page, we overload some
|
||||
// fields to reflect the changes.
|
||||
if ($user->uid) {
|
||||
$book->uid = $user->uid;
|
||||
$book->name = $user->name;
|
||||
}
|
||||
else {
|
||||
$book->uid = 0;
|
||||
$book->name = '';
|
||||
}
|
||||
}
|
||||
|
||||
return $book;
|
||||
}
|
||||
|
||||
|
@ -223,10 +207,13 @@ function book_delete(&$node) {
|
|||
* Implementation of hook_submit().
|
||||
*/
|
||||
function book_submit(&$node) {
|
||||
global $user;
|
||||
// Set default values for non-administrators.
|
||||
if (!user_access('administer nodes')) {
|
||||
$node->weight = 0;
|
||||
$node->revision = 1;
|
||||
$book->uid = $user->uid;
|
||||
$book->name = $user->uid ? $user->name : '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue