By brianmercer on
I've spent hours searching here and on the web for the correct format to put the $signature variable in my nodes for Drupal 6.1. My understanding is that I must place something like the following in my template.php file:
function phptemplate_preprocess_node(&$variables) {
$variables['signature'] = [function or variable];
}but I don't know the correct function or variable to put in there. Is it some use of theme_user_signature or some part of $user?
Thanks.
Comments
like so..
⎋ joon park
–the devil in the details–
Why do you need that?
I'm looking at http://drupal.org/node/132442#signature and it looks like the variable already exists.
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
I believe that's only for
I believe that's only for comments. Nodes do not output sigs by default. I could be wrong, haven't looked. :)
⎋ joon park
–the devil in the details–
Seriously?
All that work to fix signatures in 6.x and it didn't get put on nodes? LOL!
I guess the signature_forum module is still needed in 6.x. I'll have to have a look at helping Liam port that.
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
Yeah, I know. It should have
Yeah, I know. It should have gone in there. We do have forum node types and all..
⎋ joon park
–www.dvessel.com–
Hmph.
OK, that doesn't work. That inserts the signature of the currently logged in user. It must be some part of the $node variable?
Yeah. $signature is only in comments, by default.
heh, whoops
Right, that's the wrong object.. use this instead. You must load based on the uid (user id) of the author of the node.
⎋ joon park
–www.dvessel.com–
excellent, but...
That does work to insert the signature. However it does not apply filters to the signature. I'm looking at a forum node created by a user and then the same user posted a comment. The signature uses BBCode. The comment signature is correct, but the node signature does not apply the BBCode filter and comes out with the bare codes.
Sorry, joon. I thought this would be an easy one. I appreciate your effort.
One thing you can do is to
One thing you can do is to place a debug_backtrace within the overridden function for the signature. http://api.drupal.org/api/function/theme_user_signature/6
From there, look at the trace, and follow it to push your node sig through the same steps.
Make sure you remove the code you placed for the node so it doesn't interfere with your debugging.
Good luck.
⎋ joon park
–www.dvessel.com–
It's definitely formatting
It's definitely formatting them differently. Oddly it's adding a
as a separator above the node signatures now, but not above the comment signature, as well as applying filters differently.
Thanks to you I have a temporary solution to show signatures. I will start tracking down the cause of the different formatting and post back here if I find a solution. Thanks again.
OK, apparently comment
OK, apparently comment signatures don't use theme_user_signature because that's the function that's causing the separator.
The quest for perfect signatures continues...
filtering
So on comments, it's correctly processing the bbcode? I'm looking at the text area for the signature and it doesn't have any input formats listed, which implies it only does plain text. I don't have bbcode installed to check.
Thanks for this thread, by the way, I didn't even notice the signature variable wasn't on nodes when I committed my change to advanced forum earlier. I'm looking into this to see how hard it would be to add it or if I should focus on porting signature_forum to D6.
[Edit] Nevermind. Just found the code. Looks like it runs it through the input format of the comment.
$comment->signature = check_markup($comment->signature, $comment->format);Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
My code
Ok, this is the code I just added to advforum:
Seems to work ok from my limited testing.
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
Thank you very much Joon and
Thank you very much Joon and Michelle.
OK, I have the following in my template.php theme file:
and the following in my node.tpl.php (or node-forum.tpl.php) file:
and it's showing exactly what I want, which is filtered signatures on nodes and not on node lists.
However, the check for an empty signature isn't working. If a person has no signature, I still get
Visually not a problem atm, but can anyone suggest a way to improve it to not show an empty div?
div
Your div isn't empty. It has a
<p/>in it, which is not in your markup, and therefore must be in the signature variable. So you need to find out what's putting that in there. Probably your input filters.Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
Right on. Thanks again for
Right on. Thanks again for the help, Michelle.
So do these theme edits take
So do these theme edits take care of the Signatures in Forum nodes, or is the
Signature for forums module still needed. I am currently using 5.x w/signatures module.
I see the Signatures For Forums module is in alpha release for 6.x
I am not currently using Adv Forum.