Does not work combined with Node Teaser

smitty - February 14, 2007 - 13:19
Project:Read More link (Drupal 6 and earlier)
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:won't fix
Description

The "Read More Tweak" does noting if the module "Node Teaser" is active.
After switching off the "Node Teaser" (Menu Modules) and a reset of the "Read More Tweak" (Menu Settings - Read more Tweak) it works fine.

It would be a nice feature to have the functionality of both modules in combination.

#1

grateful_drupal_user - February 14, 2007 - 16:41

Have you tried modifying the modules' weights? I suspect this is due to module hook invocation order.

See: http://drupal.org/node/110238

Try making the "read more" module's weight higher than the node teaser module in the system table. You'll have to make the change manually, using a sql query. If this problem is resolved by doing that, I'll modify the module to allow admins to tweak the module weight in the settings page.

Try this query:

UPDATE system SET weight = 99 WHERE name='ed_readmore';

if you are using db_query():

UPDATE {system} SET weight = 99 WHERE name='ed_readmore';

Both of the queries above assume that the node teaser module's weight is the default value of 0 or less than 99. Adjust the queries accordingly - the ed_readmore module weight should be higher than any other module.

#2

grateful_drupal_user - February 14, 2007 - 16:43

Have you tried modifying the modules' weights? I suspect this is due to module hook invocation order.

See: http://drupal.org/node/110238

Try making the "read more" module's weight higher than the node teaser module in the system table. You'll have to make the change manually, using a sql query. If this problem is resolved by doing that, I'll modify the module to allow admins to tweak the module weight in the settings page.

Try this query:

UPDATE system SET weight = 99 WHERE name='ed_readmore';

if you are using db_query():

UPDATE {system} SET weight = 99 WHERE name='ed_readmore';

You need to use the proper table prefix if you are using prefixes in your drupal installation.

Both of the queries above assume that the node teaser module's weight is the default value of 0 or less than 99. Adjust the queries accordingly - the ed_readmore module weight should be higher than any other module for purposes of this test.

#3

grateful_drupal_user - February 14, 2007 - 16:44
Component:User interface» Code

Double post, sorry. The second one contains more accurate info.

#4

grateful_drupal_user - February 16, 2007 - 16:07
Category:feature request» support request

#5

New Oceans - February 20, 2007 - 08:42

Hi,

The same problem here. Therefore I posted this issue at the Node Teaser list:
- http://drupal.org/node/120835

In the system table I've checked the weight of nodeteaser (which is 0) and updated the weight of ed_readmore (set to 99). However this doesn't make any difference: the read more link won't be shown until the Node Teaser module has been turned off.

Cheers,
Marc

#6

New Oceans - February 20, 2007 - 09:04

Thought some additional info might be helpfull :)

Status report

  • Drupal: 5.1
  • Configuration file: Protected
  • Cron maintenance tasks: Last run 2 days 23 hours ago
  • Database schema: Up to date
  • File system: Writable (public download method)
  • GD library: bundled (2.0.28 compatible)
  • MySQL database: 4.1.15
  • PHP: 4.4.4-0.dotdeb.3
  • Unicode library: PHP Mbstring Extension
  • Web server: Apache/1.3.33 (Debian GNU/Linux) mod_layout/3.2 PHP/4.4.4-0.dotdeb.3 with Suhosin-Patch mod_ssl/2.8.22 OpenSSL/0.9.7e

Read More Tweak settings

  • Relocate read more link from links section: turned on
  • Put read more inline in teaser: turned off
  • The "read more" text to display in the teaser: read more »

Node Teaser settings

  • If node teaser is empty: Drupal default
  • Collapse node teaser: turned off
  • Show Teaser on specific pages: Show on every page except the listed pages
  • Pages (listed): Empty

#7

grateful_drupal_user - February 20, 2007 - 16:00

Oh, yes, that's very helpful :)

I will install the node teaser module and try to reproduce the problem... might be a few days at least, but I will add it to my list.

#8

ideaoforder - February 27, 2007 - 18:10

Is this with the latest version of both modules? If you're using anything other than the newest Node Teaser (5.x.1.1), there will be a conflict. I just installed Read More Tweak *after* Node Teaser and everything's working perfectly. Both modules have a weight of 0.

I maintain Node Teaser, and have been recommending folks use the Read More Tweak to replace similar functionality that used to be in NT 4.7...I think the Read More Tweak mod is really useful and would like to make sure that Node Teaser plays nice.

#9

grateful_drupal_user - February 27, 2007 - 18:53

I maintain Node Teaser, and have been recommending folks use the Read More Tweak to replace similar functionality that used to be in NT 4.7...I think the Read More Tweak mod is really useful and would like to make sure that Node Teaser plays nice.

Ideaoforder, thanks for helping out. I've not yet had time to investigate the NT module, so any assistance is greatly appreciated.

#10

jarea - October 1, 2007 - 03:28

I have node teaser 5.x.1.1 installed and readmore was not even showing up in my admin/build/modules page. I had both installed in the main modules page (I know, bad practice, and I am in the process of changing it).

Anyway, I moved both to sites/all/modules and now both show up in admin/build/modules.

What I discovered is that if a node has a teaser entered in the node teaser field, the tweaked read more does not show up at the end of the teaser (read more does not show up anywhere for that matter). When the node teaser field is empty, the read more properly shows up at the end of the teaser line.

Hope this helps.

#11

radscientist - October 7, 2007 - 20:56

I also have run into this issue - It seems the readmore link does not get inserted if I have customized my teaser with the node teaser module. After printing out the $node object to try and offer some debug help, It seems that the readmore link still gets correctly added to the $node->content['body']['#value'] - but somehow the phptemplate engine is not printing that out when running print $content in the tpl file. Very odd - instead it is printing out the $node->teaser on nodes that have a customized teaser.

I tried to look at the node teaser module to see what to modify, but I couldn't find anything relating to a view operation, so I am a little beyond myself...

Hope this info helps!

#12

op - April 28, 2008 - 18:14

The problem seems to come from the fact that RMT works via hook_nodeapi at the 'view' operation, and modifies $node->content['body']. However, at that point NT has updated $node->teaser already, and $node->content['body'] is not used anymore.

A solution is to invoke the nodeapi hook with $op = 'alter'. This guarantees that $node->teaser contains the proper teaser value, whether NT is enabled or not. Then RMT can update that property according to its own logic. At that point, RMT needs to update on $node->teaser, not $node->content['body']['#value'].

In addition, the weight of the RMT module must be set to be greater than the weight of the NT module.

In order to remove the 'read more' link from the node's links, we need to retain a 'view' op in hook_nodeapi. This only resets the node's 'readmore' property to false.

Note: hook_nodeapi/view is invoked at the start of node_view; hook_nodeapi/alter is invoked at the end of node_view.

See attached patch. It has NOT been tested extensively. Preliminary trials seem satisfactory.
The patch needs to be applied to ed_readmore, not nodeteaser. It should be run inside the ed_readmore module directory.

AttachmentSize
nodeteaser.patch 970 bytes

#13

op - May 3, 2008 - 10:03

I realise that while the patch works, my explanations were inaccurate.

Nodeteaser works by invoking hook_nodeapi('alter').
The original RMT code works by invoking hook_nodeapi('view').

This 'view' nodeapi hook is invoked before the 'alter' nodeapi hook, so whatever changes were made by RMT to the node are never displayed on the page: the NT logic replaces $node->teaser with the value read from the database( (if it exists) and completely ignores the node's body, and therefore also ignores the updates made by the RMT module.

The patch works by replacing RMT's 'view' nodeapi hook by a 'alter' nodeapi hook. Greater weight must be given to the RMT module than to the NT module to ensure that the RMT 'alter' nodeapi hook logic is invoked after NT's logic;

#14

grateful_drupal_user - June 28, 2008 - 18:33

Does that nodeteaser patch belong in this project?

#15

michaek - August 15, 2008 - 17:46

yes, that patch does belong here. it's a patch to ed_readmore.module - though somewhat confusingly named. this patch does apply the read more link consistently in the presence of the nodeteaser module, but the placement behavior of the link can change when working on the rendered teaser, rather than the body field value. (also, the patch uses tabs rather than spaces, which should be modified before acceptance.)

#16

jdotti - March 20, 2009 - 13:12

With both last module version still need this patch ... wich doesn't work as a patch, because code change since this patch...

Attached the ed_readmore.module which work for me with node teaser module

AttachmentSize
ed_readmore.zip 3.43 KB

#17

Todd Nienkerk - April 20, 2009 - 22:49

Thanks to everyone who has contributed to solving this bug so far. Your work is appreciated!

@jdotti: I'd like to see more evidence that your changes (#16) actually behave as intended and do not adversely affect existing use cases. By switching from $op == view to op$ == alter, you have significantly changed how this module could interact with other modules.

I will gladly commit these changes if someone else can verify that this is a good idea. I no longer support the 5.x branch, so I don't have the time or resources to test this myself. I'll leave this issue open for awhile to see if there are any takers.

#18

Todd Nienkerk - April 22, 2009 - 00:59
Status:active» postponed (maintainer needs more info)

Setting status to "postponed (maintainer needs more info)" until someone else can verify the change above is a good idea.

#19

plan9 - July 14, 2009 - 14:01

Thanks for adding support for node teaser -
I'm using op's patched module on a production without any problems so far.
Will report back if I find any problems.

G

#20

Todd Nienkerk - November 10, 2009 - 05:55
Status:postponed (maintainer needs more info)» won't fix

Marking this "won't fix" due to inactivity.

 
 

Drupal is a registered trademark of Dries Buytaert.