Syndicate

Feed

Theming comments by the node's author

You want the comment style to be different for comments added by the author of a node — who's commenting on his own node. For example, you may want to highlight the node's author's comments, so that any visitor skimming through the comments will easily differentiate them from other comments.

Solution

  1. Edit comment.tpl.php to add a new class (let's say 'comment-by-author-of-post') that...

  2. you can style in your theme's style.css.

Your file comment.tpl.php may look like this before the edit (I am only providing a snippet of the template here):

<div class="comment<?php print ($comment->new) ? ' comment-new' : ''; print ' '. $status ?> clear-block">

If it does, then you will change the above snippet to that:

<div class="comment<?php print ($comment->new) ? ' comment-new' : ''; print ($comment->uid == $node->uid) ? ' comment-by-author-of-post' : ''; print ' '. $status ?> clear-block">

You could now add these two rules to your style.css file, for example:

/**
 * Comment styling rules
 */
.comment-by-author-of-post {
  border: 1px solid #ccc;
  background-color: #eee; 
}
/* reset to default values when previewing */
.preview .comment-by-author-of-post {
  border: none;
  background-color: transparent;
}

This will work in Drupal 5 as well. No, it won't. The $node object is not passed to the comment.tpl.php template. Read the comments below for the Drupal 5 recipe. This solution works only for PHPTemplate-powered themes. If your theme does not provide a template file for comments, copy the one from modules/comment/ to your theme folder, and edit it. And yes, the $node object is available in comment.tpl.php. It is the node the comment is attached to. Possible variations: special-style all comments authored by those who have the 'admin' role; special-style anonymously-submitted comments; etc.

[]

We used a Ternary Comparison Operator in our solution.

($a == 11) ? 'eleven' : 'not eleven'

The above code snippet returns a value. If $a equals 11, the return value is 'eleven'; otherwise, the return value is 'not eleven'. You can print the return value of a ternary comparison operator like so:

print ($a == 11) ? 'eleven' : 'not eleven';

Notice that I added both 'print' and a semicolon in the above snippet.

From php.net: “The expression (expr1) ? (expr2) : (expr3) evaluates to expr2 if expr1 evaluates to TRUE, and expr3 if expr1 evaluates to FALSE.” The ternary comparison operator is used a lot in Drupal templates. In our solution we printed ' comment-by-author-of-post' — in the class attribute of the comment div — if and only if the comment author was the same guy/girl as the author of the node the comment was attached to. And we printed nothing otherwise, ie: ''. (These '' are two SINGLE quotes.) We added this:

<?php print ($comment->uid == $node->uid) ? ' comment-by-author-of-post' : ''; ?>
Last edited by Caroline Schnapp about 8 years ago.

Comments

Drupal is very powerful, but

Drupal is very powerful, but it has some modules that are very slow. I think the coding style used to develop them is saying it's word here. php isn't that slow, it should be faster than asp.net

Excellent post and wonderful

Excellent post and wonderful blog, I really like this type of interesting articles keep it u. I am really loving the theme/design of your web site. editing service

I am making a code with the

I am making a code with the new extension. Here is the real node and fixer for all updates. Using a drupal code without the planning and without using the extension is so tough. I don't think only this code will not work for me if you make a video and upload it in the page or make a youtube link.

thanks for the tips. I think

thanks for the tips. I think this will also work in wordpress and joomla, right? because it's still PHP property mallorca

Thanks for the good info. I

Thanks for the good info. I saw this happening on some websites, but didn't know how to implement it

Good idea and detailed instructions!

It would be prudent to synchronize and back-up all your hard work with a service that provides online backup.

Thank you.

I was stuck in the middle

I was stuck in the middle while trying it in my Joomla 1.5 site. The border is solid here but by default I have a nice border from the template maker though the solid code didn't worked as I applied that.

The combined water/amusement

The combined water/amusement park retreat on the periphery of Naples, Italy, offers great. the act of removing floating material from the surface of a liquid. I like to visit this post once again thanks for sharing the informative post.
Regards,
Robert - www.paperwisdom.co.uk

DreamBoard theming tweak

DreamBoard theming tweak goes free for iPhone and iPod touch. Dreamboard is a fantastic Cydia jailbreak Tweak for the folks. Tweak My Theme is currently being re-structured to create a much more seamless process for getting your WordPress theme tweaked. We'll be matching you up with a pool of talented WordPress developers, allowing you to get your site customized to your exact specs...and quickly. Thanks for sharing.
Regards,
Robert - Kitchen Design Bath

There should be no crying

There should be no crying allowed at Magic World. The place is too much fun. The combined water/amusement park retreat on the periphery of Naples, I like to visit blog ones again thanks for sharing the informative post.
Regards,
Robert - Access Intelligence Media and Communications Ltd

Skim links uses Google

Skim links uses Google Analytics, a web analytics service provided by Google, Inc. Google Analytics sets a cookie in order to evaluate your use of the website. I like to discuss more about this thanks for sharing the informative post.
Regards,
Robert - ENT doctor surrey uk

kamagrea rezeptfrei kaufen

It is just what I was looking for and quite thorough as well. Thanks for posting this, I saw a couple other similar posts but yours was the best so far. The ideas are strongly pointed out and clearly emphasized. Thanks for sharing your thoughts and ideas on this one. Please keep posting about such articles as they really spread useful information. Thanks for this particular sharing. I hope it stays updated, take care.

Description and explanation

Description and explanation of the major themes of The Power of One. Adaptivetheme is a powerful theme framework designed from the ground up to power modern, cross browser/cross device. Thanks for sharing the informative post.
Regards,
Robert - Salmon Recipes UK 

Social Networking to Get You

Social Networking to Get You the Best Deals The economy is so unstable at the moment that most of us are continually looking for methods to cut financial corners, even if it only adds up to a couple of cents.

Medical Billing and Coding

Theme Tweaks is Philippines

Theme Tweaks is Philippines based firm committed to help businesses get online! We create websites using dynamically designed templates which you owner can easily. I like to discuss more about this thanks for sharing the informative post.
Regards,
Robert - Zeno

Skimlinks uses Google

Skimlinks uses Google Analytics, a web analytics service provided by Google, Inc. Google Analytics sets a cookie in order to evaluate your use of the website. thanks for sharing the informative post.
Regards,
Robert - property management Yonkers ny

Theme Tweaks is Philippines

Theme Tweaks is Philippines based firm committed to help businesses get online. we can create websites using dynamically designed templates. Theme customizes WordPress themes to your exact specifications, whether small tweaks or major updates. Thanks for sharing.
Regards,
Robert - new york disability attorney

Brisbane web designer

Thanks for the tips. I think this will also work in wordpress and joomla, right? because it's still PHP.
Brisbane web designer

nice post.

Will try to use this today and see how it goes..

To write an interesting and

To write an interesting and highlight comment was a very difficult problem. And I'm trying to do that.
karting

This became truly very

This became truly very helpful site. I truly enjoyed what sort of written content had been published. I will be content to help save this web site in to our folder. Many thanks! The way you express yourself is awesome.
Regards,
Sam - Janine Edwards St James’s Place

That was new blog i never

That was new blog i never thought of that. Many interesting blog that you brought to us is about the a centering point of component parts of the author which bring me for applying it i needed. So for now i say it is good and all i wanted to know from your blog the answer of my question.

Nikeskono Norge online

billige nike sko i norge ved nikeskono.eu,tilbyr merke sko til konkurransedyktige priser,nike free 3.0 Sko Salg i norge,converse sko norge av nye mainstream i Norge selges Norge maksimal converse sko store online billig salg! Hoy kvalitet og 100% tillit lofte.

The way you express yourself

The way you express yourself is awesome. superuser apk

amazing!

this is a great thing to know "You want the comment style to be different for comments added by the author of a node — who's commenting on his own node. For example, you may want to highlight the node's author's comments, so that any visitor skimming through the comments will easily differentiate them from other comments"..more power http://www.nuediamonds.com/man_made

Custom Directory We are a

Custom Directory
We are a bunch of volunteers and starting a brand new scheme in our community. Your web site provided us with valuable information to paintings on. You have done an impressive job and our entire community will be grateful to you.

Blog

Great technology is visible in this Online Poker Sport blog and the nice services in this blog. I am really like it very much for the nice services in this blog and the good info is visible in this blog.

The google has a published

The google has a published criteria for the web sites they accept to the Adsense program. A good rule of thumb is just construct an honest and forthright web site that has legitimate purpose other than attaining revenue from the Google Adsense program. Thanks.

I think google will have

I think google will have good adsense for sure and how this can be done with business and revenue about other ways.

This will work in Drupal 5

This will work in Drupal 5 as well. No, it won't. The $node object is not passed to the comment.tpl.php template. Read the comments below for http://e-papierossy.com.pl/en/e-papierosy/65-e-papierosy-gombit-543567.html the Drupal 5 recipe. This solution works only http://e-papierossy.com.pl/en/e-papierosy/61-e-papierosy-gombit-5353h.html for PHPTemplate-powered themes. If your theme does not provide a template file for comments, copy the one from modules/comment/ to your theme folder, and edit it. And yes, the $node object is available in comment.tpl.php. It is the node the comment is attached to. Possible variations: special-style all comments authored by those who have the 'admin' role; special-style anonymously-submitted comments; etc.

Most university, college and

Most university, college and high school students cheap essay writing service have benefited from having a coach at some point in their lives, either as a member of sports team, or as a participant in an individual sport.

e107

I read your article, and this is very good. I have a question, if it not a problem. Can I use this code with e107 cms? I really hope:$

http://www.buyuniquegifts.net/

Many things can cause a problem occurs. Therefore, I always plan and predict the problems that will occur when I do something that does not become a barrier to prolonged. Birthday Gifts are not always about cake and flowers.

Great post!

Nice post. I've been using Pinterest more and more to showcase my own work but also as a way to help brides gather ideas.

twin fountains http://twinfountains-woodlands.com

awesome threads. hope to read more Hedges Park Condo, Topiary EC , Twin Fountains Woodlands

Several buses are available

Several buses are available near J Gateway along with shopping centers and restaurants. J Gateway is also near to Jurong Lake Park and The Japanese Garden. Entertainment for your loved ones and friends is therefore at your fingertips with the full condo facilities as well as the amenities near J Gateway.
Thx
J Gateway

Several buses are available

Several buses are available near Forestville EC along with shopping centers and restaurants. Forestville EC is also near Causeway Point as well as Woodlands Waterfront. Entertainment for your loved ones and friends are therefore at your fingertips with the full condo facilities as well as the amenities near Forestville EC.
Forestville EC will be accessible with Woodlands MRT station & Admiralty MRT station. It is also near to Vista Point Shopping Mall, Causeway Point Shopping Mall, Cold Storage, Shop N Save, and many more.
Woodlands EC

good

this is a really good article that teaches us well. well, thank you writer for writing such a great post.! lush acres

Simply wish to say thanks.

Simply wish to say your article is as astonishing. The clarity in your post is just cool and i could assume you are an expert on this subject. Well with your permission allow me to grab your feed to keep up to date with forthcoming post. Thanks a million and please keep up the gratifying work.

Sea Horizon EC will be

Sea Horizon EC will be accessible via Pasir Ris MRT Station. Commuting to Changi Airport as well as Expo is therefore very convenient. It is also near to White Sands and Pasir Park.
Sea Horizon Floor Plans

It was certainly interesting

It was certainly interesting for me to read article. Thanks for it. I like such topics and anything that is connected to this matter. I definitely want to Read more on that blog soon.Thanks
i love this site

For vehicle owners, it takes

For vehicle owners, it takes less than 20 minutes to drive to the business hub and vibrant Orchard Road shopping district, via Central Expressway (CTE). A wonderful and unique lifestyle awaits you. Please see The Panorama project details and floor plans for more information. The Panorama

mechanical safe

awesome blog. keep writng . creative content
mechanical safe

Sky Vue Condo is a new and

Sky Vue Condo is a new and upcoming new launch located in the Bishn area, nested right beside Bishan MRT. Sky Vue is within a short drive to Little India, Orchard and city area. With expected completion in mid 2017, it comprises of 694 units in total with 2 Blocks and 17 storeys. Bishan Sky Vue

plumbing services

I have to admit that I tried to find this information for a long time and I am so happy now finding it in your website. As I see this site looks really respectful so I will definitely bookmark it.

plumbing services

The Hillford Condo will be

The Hillford Condo will be accessible via the upcoming Beauty World MRT station on the Downtown Line. Commuting to the Bukit Timah Area as well as the city area is therefore very convenient. It is also near to Ten Mile Junction, Rail Mall, Beauty World, King Albert's Park, West Mall, Bukit Panjang, Cold Storage, and many more. jurong kechil Hillford condo

Jurong West new Condo Launch by MCL And

With expected completion in mid 2017, New Condo in Jurong comprises of TBA towers with TBA units and stands TBA storeys tall. It is just a stone throw away from Lakeside MRT Station. New Condo in Jurong west

That comment style tip is

That comment style tip is very helpful penile pearly papules

I like to visit this post

I like to visit this post once again thanks for sharing the informative post.
click here

It is situated right beside

It is situated right beside Layar LRT Station. Future residents will be able to access the nearby Compass Point and Greenwich V which is a short drive away for some family fun and gatherings. A truly unique lifestyle awaits you. Rivertrees condo

Pet Grooming Centres in Singapore

Different dogs require different forms of dog grooming singapore. Also, the length of each grooming is different across different breeds. Also, across different breeds, the instruments needed to groom the dog will be different. Pet Grooming Singapore

If you need some tips to

If you need some tips to choice cosmetic, I think you should read. earn free facebook credits

It would be prudent to

It would be prudent to synchronize and back-up all your hard work with a service that provides. new dvds

I am really loving the

I am really loving the theme/design of your web site. free cod dlc

A wonderful and unique

A wonderful and unique lifestyle awaits you. Please see Commonwealth Towers project details and floor plans for more information. floorplan commonwealth towers

Commonwealth Towers is a new

Commonwealth Towers is a new and upcoming condominium located in the Queentowns area, along Commonwealth Ave right beside Queenstown MRT. commonwealth towers queenstown mrt

This is very nice post! I

This is very nice post! I will bookmark your blog. I really love this article. Build Biceps without Weights

Worth reading

I'm a blogger and this is definitely something to look for when searching the internet. Now I can enhance my blog to give it a better taste. Really, thanks a lot!

Domain Name

Question?

Do these themed comments really work? Wanna ask because I want to try them.

Megaton Pte Ltd

Comment Theming?

So I'm very new at this but can you teach me more about comment theming? or even other coding skills. Will try to do this hopefully it'll be successful.

www.waikayphotography.com

Need help

Mine doesn't look like this and I don't know what to do after, please help?

"

new) ? ' comment-new' : ''; print ' '. $status ?> clear-block">"

Active-Venture

Nicely done

Perfect! This info is what I've been looking for in the internet to finish my project in a better way. Kudos to you!

Malaysia Warehouse

Want to know more

Please post more related to comment theming, if there are more techniques on how to do this. Better if there are shortcuts or strategies to succesfully create this one. Anyway, keep up the good work!

dyslexiakitset.com

informative

nice post. just the information i need thanks!

www.emas.com

quite confused

is your post the perfect way of doing the script?

www.burlinsondental.com

cool

this theming stuff is cool. maybe this is my way of making my site cooler. great post

secom.com.sg

калькулятор растаможки

I am going to subscribe, so I can learn more. I can't wait to receive updates through e-mail. Thanks! калькулятор растаможки

drupal is so good and useful

drupal is so good and useful i like it bus tour guide

iso certification service

it's very nice blog Check Out our site for detail information.@Iso certification cost

sewa mobil surabaya

the new extension. Here is the real node and fixer for all updates. Using a drupal code without the planning and withou

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <css> <html> <javascript> <mysql> <php> <span> <a> <b> <i> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <sup> <sub> <dd> <del> <blockquote> <img> <q> <p> <div>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <css>, <html>, <javascript>, <mysql>, <php>, <rails>, <ruby>.

More information about formatting options

CAPTCHA
I have to wonder if you're a human spammer or a machine, or less likely someone who cares to leave his or her thoughts behind.