I would like to change the display of the feedback list for one of my clients sites and display not just the node title, but also the node body - or at the very least, a teaser.
One way that I can see to do this would be to alter the INNER JOIN to accommodate a third table, namely my "node_content_feedback" table but my SQL skills are not, unfortunately, up to this.
The query at present looks like this:
$result2 = db_query_range('SELECT n.nid, n.title, n.changed, u.name, u.uid
FROM {node} n
INNER JOIN {users} u ON n.uid = u.uid
WHERE n.moderate = 1
ORDER BY n.changed DESC', 0, $nlimit);
and I would need to join in the table based on it's association via n.nid.
Any help with this would be greatly appreciated - OR, if there is another simpler way of getting the node body into the adminblock output, that too would be fantastic!
Regards
Patrick
Comments
Comment #1
frjo commentedI must say I can't see the point in this feature. Have you submitted this to the right module?
Comment #2
Patrick Nelson commentedSorry, a fuller explanation would probably help. I'm creating a site for a client (http://petitparis.underdesign.co.uk) which allows anonymous visitors to post comments - I have these set up as a content type called feedback. They are nothing more than a sentence or two.
Obviously the client doesn't want these comments to just "appear" on the website, so they go straight into the moderation queue.
I use the adminblock module to allow the client to view these 'feedback' items but, by default, the admin block shows only the title of the content type and nothing from the body. He wants to be able to see a teaser of the feedback so that time can be saved approving them rather than having to click on each one to see what it says.
I can see no way to pull a teaser into adminblock other than how I described. Which is why I want to do it. Hope that helps explain my unusual request!
Regards
Patrick
Comment #3
frjo commentedNow it makes perfect sense. What do you think of putting the first part of the body in to to the "view" link title so when you hover over the link you will see the text?
By user [view]|[edit]|[delete]I have attached a development version with this feature included. Please test it and report back here.
Comment #4
Patrick Nelson commentedThanks for this, frjo.
Unfortunately, I'm running 4.7.2 and the dev module you've created is incompatible as it throws out an 'array' error. I will try and work out how to backdate it for 4.7.2, but if it's quicker, I would be grateful if you could post a compatible version.
As soon as I've figured it out / received a suitable version, I'll let you know how I get on.
Regards
Patrick
Comment #5
frjo commentedI'm using 4.7.2 myself. I see that the file got renamed to adminblock_0.module. Maybe you missed that? Try to rename it back to adminblock.module and make sure you have only one version of the module.
Comment #6
Patrick Nelson commentedNo, it's not that - I can see why part of it doesn't work. The code tries to include the user name. There is no user name because these are anonymous users who are leaving the feedback.
I don't know why the array doesn't work though and doesn't display the teaser but, just to clarify, I'm using a CCK content type with only two fields called "Name" (which is also the node title) and "Feedback" which should contain exactly what they say, the idea being that the visitor will leave their name and the adminblock module will display both the persons name (node title) which it does as standard but also the contents of the Feedback field. Which it doesn't.
Comment #7
frjo commentedHmm, CCK nodes doesn't seem to get any teaser and body, the content is saved in a separate table for each CCK content type. You need to replace
with some thing like
The "field_feedback[0][value]" depends on what the name of your field is and maybe on some other inner working of CCK.
The user name problem comes from me not using theme_username(), it was late ;-).
Comment #8
Patrick Nelson commentedOK, this is the only bit that I cannot get to work - the drupal_substr function. If anyone else wants to jump in and say what I should use for a CCK node here, your help would be appreciated.
@frjo - Everything else seems fine. I can see what the new code is supposed to do and I think the only thing stopping it is the way to use drupal_substr with CCK.
Regards
Patrick
Comment #9
Patrick Nelson commentedActually, I lie... like a flatfish.
The code works fine. I just didn't read it properly. For clarification, I'm now using this code:
Which produces this:
Feedback
From: Patrick - July 19, 2006 - 1:21pm
A wonderful place to dine...
view | edit | delete
Comment #10
frjo commentedComment #11
(not verified) commented