0
Captura
En c.posts.php --> inc --> class --> c.posts.php
Al final antes de la última } agregar:
En posts.php --> inc --> php --> posts.php
Buscar:
Debajo agregar:
En m.posts_metadata.tpl --> themes --> default --> templates --> modules --> m.posts_metadata.tpl
Buscar:
Reemplazar por:
[img]Registrate o inicia tu sesión para ver este contenido[/img]
En c.posts.php --> inc --> class --> c.posts.php
Al final antes de la última } agregar:
Código PHP: ( Seleccionar Todo )
/**
* Verifica si el usuario actual ha votado este post
* @param int $post_id
* @return int|null Retorna los puntos dados o null si no ha votado
*/
public function getVoto(int $post_id): ?int
{
global $tsUser;
// Si no está logueado, no puede haber votado
if (empty($tsUser->uid)) {
return null;
}
$query = db_exec(
[__FILE__, __LINE__],
'query',
"SELECT cant FROM p_votos WHERE tid = $post_id AND tuser = {$tsUser->uid} AND type = '1' LIMIT 1"
);
$data = db_exec('fetch_assoc', $query);
// Retorna el entero de puntos o null si no existe el registro
return ($data && isset($data['cant'])) ? (int)$data['cant'] : null;
}
En posts.php --> inc --> php --> posts.php
Buscar:
Código PHP: ( Seleccionar Todo )
// DATOS DEL RANGO DEL PUTEADOR
$smarty->assign("tsPunteador",$tsPosts->getPunteador());
Debajo agregar:
Código PHP: ( Seleccionar Todo )
// VOTOS DEL POSTS
$smarty->assign("tsVoto", $tsPosts->getVoto((int)$tsPost['post_id']));
En m.posts_metadata.tpl --> themes --> default --> templates --> modules --> m.posts_metadata.tpl
Buscar:
Código PHP: ( Seleccionar Todo )
<span>Dar Puntos:</span>
{section name=puntos start=1 loop=$tsUser->info.user_puntosxdar+1 max=$tsPunteador.rango}
<a href="#" onclick="votar_post({$smarty.section.puntos.index}); return false;">{$smarty.section.puntos.index}</a> {if $smarty.section.puntos.index < $tsPunteador.rango}-{/if}
{/section}
{/if}
(de {$tsUser->info.user_puntosxdar} Disponibles)
Reemplazar por:
Código PHP: ( Seleccionar Todo )
{if $tsVoto !== null}
<div class="votod">Ya diste {$tsVoto} puntos en este post</div>
{else}
<span>Dar Puntos:</span>
{section name=puntos start=1 loop=$tsUser->info.user_puntosxdar+1 max=$tsPunteador.rango}
<a href="#" onclick="votar_post({$smarty.section.puntos.index}); return false;">
{$smarty.section.puntos.index}
</a>
{if !$smarty.section.puntos.last}-{/if}
{/section}
(de {$tsUser->info.user_puntosxdar} Disponibles)
{/if}


Facebook
Twitter
Reddit
Digg
del.icio.us
Tumblr
Pinterest
Blogger
Fark
LinkedIn
Mix
Google