Problem/Motivation
It seems all of the below issues suffer from the destructive way paging handles the content on "view" in the hook_nodeapi. In a nutshell on "load" in the nodeapi paging breaks the content up into pages, based on the users settings, and stores it in $node->pages[$page].
Then on "view" in nodeapi it executes this line.
// Put the current page contents into the node body.
$node->content['body']['#value'] = check_markup($node->pages[$page], $node->format, FALSE);
which replaced the body content with the paged portion.
Other modules nodeapi hooks don't expect this and modify the $node->content['body']['#value'] when they process the node. All the changes they make get wiped out by this replacement.
Proposed resolution
I think it's a combo of weighting the paging module so It's hook_nodeapi "view" call fires last and paging up the text in the view step and not on "load" so it can use the modified $node->content['body']['#value'] that other modules have created.
Remaining tasks
fiddle with module weight?
or rewrite paging.
Related Issues
Here are the other related issues I could find
#340717: Paging Breaks Page Links in Book Pages
#399314: Is it good to modify node body in 'alter' operations instead of 'load'?
#505736: Paging breaks Node Relativity links
#848500: Problem when using Paging module with AdSense module
#1203736: conflicts with the JW player for module drupal.
Comments
Comment #0.0
gstout commentedmore info
Comment #1
gstout commentedHoly smokes I solved it!!
I was right about the issue and the solution is amazingly simple once you fully understand the problem.
The core problem is paging is wiping out other modules hook_nodeapi "view" changes with this line.
$node->content['body']['#value'] = check_markup($node->pages[$page], $node->format, FALSE);
But fixing it would be a bear because you would need to rethink how paging works. All you really need if for the paging module to run first so that other module get the paged body to alter.
Currently the paging module has it's weight set to 0 which means it's hook_nodeapi call run in a mishmash with all others. (based on alphabetical order I think)
I added this update (below) to my paging.install file and then ran update.php on my site.
(fyi, I'm running dev and the latest update in my install files was for so I used _5 )
/**
* Implementation of hook_update_N().
*/
function paging_update_5() {
$ret = array();
$ret[] = update_sql("UPDATE {system} SET weight = -100 WHERE name = 'paging'");
return $ret;
}
Making this change basically makes paging run first and the problems disappear.
Good luck
Comment #2
jenlamptonIm not sure that setting the module weight to something really low is the right thing to do. This may prevent other modules from being able to alter pages 2 and later of any given node.
I think the correct thing to do would be to have paging alter the content that may have already been altered by other modules, rather than rebuilding from the original.
Comment #2.0
jenlamptonedits
Comment #3
jenlamptonincreasing priority :)
Comment #4
jenlamptonI just did a bunch of additional testing with paging and other modules, and I was unable to fix this problem. I believe the bug was resolved back in
#363396: Paginate only for normal node rendering.
Comment #4.0
jenlamptonissue summary initiative