News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Poner color a los links de los usuarios

Started by Nazarenop, October 08, 2017, 06:23:48 PM

Previous topic - Next topic

Nazarenop

Tengo la versión 2.1 beta 3 y quería saber cómo hacer que el nombre de los usuarios tenga siempre el color de su rango.


Nazarenop


d3vcho

Se podría hacer a través de una modificación, y hasta donde yo sé, no hay ninguna disponible de ese tipo para SMF 2.1 Beta 3.
"Greeting Death as an old friend, they departed this life as equals"

Suki

2.1 agrega por defecto el color del grupo primario de un usuario si el grupo contiene un color definido:  https://github.com/SimpleMachines/SMF2.1/commit/7544f5148e2539bc2781cd0b9ee30c6655892245

Dependiendo de donde quieres agregarlo es la variable a usar, $memberContext, $context['user'], $context['member'], etc. Las llaves siempre van a ser las mismas:


'username_color'
'name_color
'link_color'
 


Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Nazarenop

Quote from: Suki on October 09, 2017, 11:13:50 AM
2.1 agrega por defecto el color del grupo primario de un usuario si el grupo contiene un color definido:  https://github.com/SimpleMachines/SMF2.1/commit/7544f5148e2539bc2781cd0b9ee30c6655892245

Dependiendo de donde quieres agregarlo es la variable a usar, $memberContext, $context['user'], $context['member'], etc. Las llaves siempre van a ser las mismas:


'username_color'
'name_color
'link_color'
 

Muchas gracias, pude colocarlo en algunos sectores, en otros como por ejemplo los recent post, no me fue posible.
Este es el código, te lo adjunto para que veas si hay forma de ponerlo(cambié link por cualquiera de los 3 y no funcionó):
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table id="ic_recentposts">
<tr class="windowbg">
<th class="recentpost">', $txt['message'], '</th>
<th class="recentposter">', $txt['author'], '</th>
<th class="recentboard">', $txt['board'], '</th>
<th class="recenttime">', $txt['date'], '</th>
</tr>';

/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
<tr class="windowbg">
<td class="recentpost"><strong>', $post['link'], '</strong></td>
<td class="recentposter">', $post['poster']['link'], '</td>
<td class="recentboard">', $post['board']['link'], '</td>
<td class="recenttime">', $post['time'], '</td>
</tr>';
echo '
</table>';
}
echo '
</div>';

Suki

No recuerdo bien pero me parece que los mensaje recientes no contienen info del usuario por razones de rendimiento. Haz un var_dump()  sobre la variable $context['latest_posts']  var_dump($context['latest_posts']);die;  para ver bien si contiene esa info o no.

El mod que dejaron anteriormente debería de funcionar sin problemas en 2.1, sólo tienes que emular la versión. Hay un tutorial sobre como hacerlo en el subforo correspondiente.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

anitawebcamer

Yo utilizo siempre 'username_color'  y no he tenido problemas

Advertisement: