<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Modificare style commenti in base al livello autore]]></title><description><![CDATA[<p dir="auto">Cari amici Giorgiotaviani (o Giorgiotavesi?) <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=bb61372b9dc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /> <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=bb61372b9dc" class="not-responsive emoji emoji-android emoji--wink" style="height:1.4em;width:auto;vertical-align:middle" title=";)" alt="😉" /><br />
avrei bisogno di un vostro aiuto.<br />
Molti di voi sapranno che su Wordpress, dentro la cartella di quasi tutti i templates, esiste un file chiamato functions.php dentro il quale vengono dichiarate, appunto, determinate funzioni per il tema in uso.</p>
<p dir="auto">Vengo al punto: il mio tema non differenzia lo style css fra i commenti inviati dall'amministratore e quelli inviati da un utente guest.<br />
Per tale ragione ho inserito, dentro il succitato file functions.php, la seguente funzione:</p>
<pre><code class="language-php">&lt;?php 
function custom_comment($comment, $args, $depth) {       $GLOBALS['comment'] = $comment;  
?&gt;

&lt;li class="&lt;?php if ($comment-&gt;comment_author_email == "emailamministratore@mail.com") echo 'comment-author-admin'; else echo 'comment'; ?&gt;"&gt;

&lt;div id="comment-&lt;?php comment_ID( ); ?&gt;"&gt;
&lt;table border="0" cellpadding="6"&gt;&lt;tr&gt;&lt;td width="52" valign="top" align="left"&gt;
       &lt;div class="avatar_cont"&gt;&lt;?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?&gt;&lt;/div&gt;&lt;/td&gt;&lt;td width="100%" valign="top" align="left"&gt;&lt;div class="avatar_cont"&gt;
Comment by &lt;em&gt;&lt;?php comment_author_link() ?&gt;&lt;/em&gt;:
&lt;?php if ($comment-&gt;comment_approved == '0') : ?&gt;
&lt;em&gt;Your comment is awaiting moderation.&lt;/em&gt;
&lt;?php endif; ?&gt;
&lt;br /&gt; 
&lt;small class="commentmetadata"&gt;&lt;a href="#comment-&lt;?php comment_ID() ?&gt;" title=""&gt;
&lt;?php comment_date('l, F jS Y') ?&gt; at &lt;?php comment_time() ?&gt;&lt;/a&gt;&lt;br /&gt;&lt;?php edit_comment_link('Edit','',''); ?&gt;&lt;/small&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
    &lt;?php comment_text() ?&gt;
 
&lt;?php echo comment_reply_link(array('before' =&gt; '&lt;div class="reply"&gt;', 'after' =&gt; '&lt;/div&gt;', 'reply_text' =&gt; 'Reply to this comment', 'depth' =&gt; $depth, 'max_depth' =&gt; $args['max_depth'] ));  ?&gt;
&lt;/div&gt;
&lt;?php } ?&gt;
</code></pre>
<p dir="auto">Come potete notare, per come l'ho impostata io, assegna una classe css differente solo se l'email corrisponde a quella dell'amministratore.<br />
Il problema è che, ovviamente, se un guest inserisce nel campo relativo alla mail quella stessa dell'amministratore, anche il commento di quel guest apparirà con lo stesso aspetto dell'admin.</p>
<p dir="auto">Potete aiutarmi a modificare un pò questa funzione in modo tale da avere una classe differente se il commento è realmente in modalità "is_admin"?</p>
<p dir="auto">Spero di essermi spiegato bene <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/0541d916-a420-403e-bd97-1a1367eebdcf-hi-1.gif?v=bb61372b9dc" class="not-responsive emoji emoji-customizations emoji--gthi" style="height:1.4em;width:auto;vertical-align:middle" title=":gthi:" alt="" /><img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/9261f9a6-e9b6-41d1-af4b-51a58699760f-rotf.gif?v=bb61372b9dc" class="not-responsive emoji emoji-customizations emoji--lol" style="height:1.4em;width:auto;vertical-align:middle" title=":lol:" alt="" /><br />
Un salutino a tutti</p>
]]></description><link>https://dev.connect.gt/topic/91823/modificare-style-commenti-in-base-al-livello-autore</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 13:43:26 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/91823.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Jan 2009 10:06:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Modificare style commenti in base al livello autore on Fri, 09 Jan 2009 17:22:53 GMT]]></title><description><![CDATA[<p dir="auto">Ho risolto da solo:</p>
<pre><code class="language-php">&lt;?php 
function custom_comment($comment, $args, $depth) {       $GLOBALS['comment'] = $comment;  
?&gt;


&lt;?php
$comment_class = (1 == $comment-&gt;user_id) ? 'comment-author-admin' : 'comment';
?&gt;

&lt;li class="&lt;?php echo $comment_class; ?&gt;"&gt;

&lt;div id="comment-&lt;?php comment_ID( ); ?&gt;"&gt;
&lt;table border="0" cellpadding="6"&gt;&lt;tr&gt;&lt;td width="52" valign="top" align="left"&gt;
       &lt;div class="avatar_cont"&gt;&lt;?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?&gt;&lt;/div&gt;&lt;/td&gt;&lt;td width="100%" valign="top" align="left"&gt;&lt;div class="avatar_cont"&gt;
Comment by &lt;em&gt;&lt;?php comment_author_link() ?&gt;&lt;/em&gt;:
&lt;?php if ($comment-&gt;comment_approved == '0') : ?&gt;
&lt;em&gt;Your comment is awaiting moderation.&lt;/em&gt;
&lt;?php endif; ?&gt;
&lt;br /&gt; 
&lt;small class="commentmetadata"&gt;&lt;a href="#comment-&lt;?php comment_ID() ?&gt;" title=""&gt;
&lt;?php comment_date('l, F jS Y') ?&gt; at &lt;?php comment_time() ?&gt;&lt;/a&gt;&lt;br /&gt;&lt;?php edit_comment_link('Edit','',''); ?&gt;&lt;/small&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
    &lt;?php comment_text() ?&gt;
 
&lt;?php echo comment_reply_link(array('before' =&gt; '&lt;div class="reply"&gt;', 'after' =&gt; '&lt;/div&gt;', 'reply_text' =&gt; 'Reply to this comment', 'depth' =&gt; $depth, 'max_depth' =&gt; $args['max_depth'] ));  ?&gt;
&lt;/div&gt;
&lt;?php } ?&gt;
</code></pre>
<p dir="auto">spero possa essere d'aiuto a qualcuno. <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=bb61372b9dc" class="not-responsive emoji emoji-android emoji--wink" style="height:1.4em;width:auto;vertical-align:middle" title=";)" alt="😉" /></p>
]]></description><link>https://dev.connect.gt/post/798626</link><guid isPermaLink="true">https://dev.connect.gt/post/798626</guid><dc:creator><![CDATA[stimart]]></dc:creator><pubDate>Fri, 09 Jan 2009 17:22:53 GMT</pubDate></item></channel></rss>