Phpost

Versión completa: Votar positivo-negativo en post (Act 1.3)
Actualmente estas viendo una versión simplificada de nuestro contenido. Ver la versión completa con el formato correcto.
[img]Registrate o inicia tu sesión para ver este contenido[/img]

[img]Registrate o inicia tu sesión para ver este contenido[/img]

[img]Registrate o inicia tu sesión para ver este contenido[/img]



En c.posts.php --> inc --> class --> c.posts.php

Buscar:

Código PHP:
$puntos intval($_POST['puntos']); 


Reemplazar por:

Código PHP:
$puntos = ($_POST['puntos'] == 2) ? 1


Buscar:

Código PHP:
// SUMAR PUNTOS AL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE p_posts SET post_puntos = post_puntos + '.(int)$puntos.' WHERE post_id = \''.(int)$post_id.'\'');
// SUMAR PUNTOS AL DUEÑO DEL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntos = user_puntos + \''.(int)$puntos.'\' WHERE user_id = \''.(int)$data['post_user'].'\'');
// RESTAR PUNTOS AL VOTANTE
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntosxdar = user_puntosxdar - \''.(int)$puntos.'\' WHERE user_id = \''.$tsUser->uid.'\''); 


Reemplazar por:

Código PHP:
// SUMAR PUNTOS AL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE p_posts SET post_puntos = post_puntos '.(($puntos == 2) ? '- \'1\'' '+ \'1\'').' WHERE post_id = \''.(int)$post_id.'\'');
// SUMAR PUNTOS AL DUEÑO DEL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntos = user_puntos '.(($puntos == 2) ? '- \'1\'' '+ \'1\'').' WHERE user_id = \''.(int)$data['post_user'].'\'');
// RESTAR PUNTOS AL VOTANTE
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntosxdar = user_puntosxdar - \'1\' WHERE user_id = \''.$tsUser->uid.'\''); 


Buscar:

Código PHP:
//PUNTOS
        
if($postData['post_user'] == $tsUser->uid || $tsUser->is_admod){
        
$postData['puntos'] = result_array(db_exec(array(__FILE____LINE__), 'query''SELECT p.*, u.user_id, u.user_name FROM p_votos AS p LEFT JOIN u_miembros AS u ON p.tuser = u.user_id WHERE p.tid = \''.(int)$postData['post_id'].'\' && p.type = \'1\' ORDER BY p.cant DESC'));



Reemplazar por:

Código PHP:
//PUNTOS
        
if($postData['post_puntos']){
        
$postData['puntos'] = result_array(db_exec(array(__FILE____LINE__), 'query''SELECT p.*, u.user_id, u.user_name FROM p_votos AS p LEFT JOIN u_miembros AS u ON p.tuser = u.user_id WHERE p.tid = \''.(int)$postData['post_id'].'\' && p.type = \'1\' ORDER BY p.voto_id DESC'));



Buscar:

Código PHP:
// NUEVA VISITA : FUNCION SIMPLE 


Arriba agregar:

Código PHP:
// YA LO VOTE?
$vote db_exec('fetch_row'db_exec(array(__FILE____LINE__), 'query''SELECT COUNT(voto_id) AS v FROM p_votos WHERE tid = \''.(int)$postData['post_id'].'\' AND tuser = \''.$tsUser->uid.'\' LIMIT 1'));
$postData['vote'] = !empty($vote[0]) ? true false


En c.monitor.php --> inc --> class --> c.monitor.php

Buscar:

Código PHP:
=> array('text' => 'dejó _REP_ puntos en tu''ln_text' => 'post''css' => 'points'), 


Reemplazar por:

Código PHP:
=> array('text' => 'votó _REP_ tu''ln_text' => 'post''css' => 'voto_'), 


Buscar:

Código PHP:
if($no_type == 3$oracion['text'] = str_replace('_REP_''<b>'.$data['obj_dos'].'</b>'$oracion['text']); 


Reemplazar por:

Código PHP:
if($no_type == 3$oracion['text'] = str_replace('_REP_''<b>'.($data['obj_dos'] == 2) ? 'negativo' 'positivo' .'</b>'$oracion['text']);
                if(
$no_type == 3) {
$voto_type = ($data['obj_dos'] == 2) ? 'negativo' 'positivo';
$oracion['text'] = str_replace('_REP_''<b>'.$voto_type.'</b>'$oracion['text']);
$oracion['style'] = 'voto_'.$voto_type;



En c.actividad.php --> inc --> class --> c.actividad.php

Buscar:

Código PHP:
=> array('text' => array('Dej&oacute;''puntos en el post'), 'css' => 'points'), 


Reemplazar por:

Código PHP:
=> array('text' => array('Vot&oacute;''el post'), 'css' => 'voto_'), 


Buscar:

Código PHP:
if($ac_type == 3$extra_text $data['obj_dos']; 


Reemplazar por:

Código PHP:
if($ac_type == 3$extra_text = ($data['obj_dos'] == 2) ? 'negativo' 'positivo'


Buscar:

Código PHP:
$oracion['style'] = ($ac_type == 6) ? 'voto_'.$extra_text $oracion['style']; 


Reemplazar por:

Código PHP:
$oracion['style'] = ($ac_type == || $ac_type == 6) ? 'voto_'.$extra_text $oracion['style']; 


En m.posts_metadata.tpl --> themes --> default --> templates --> modules --> m.posts_metadata.tpl

Buscar y borrarlo:

Código PHP:
{if ($tsUser->is_admod || $tsUser->permisos.godp) && $tsUser->is_member == && $tsPost.post_user != $tsUser->uid && $tsUser->info.user_puntosxdar >= 1}
                            <
div class="dar-puntos">
 {if 
$tsPunteador.rango >= 50}
 <
center>
 <
div align="center" style="background: #F2F2F2;width: 58px;padding: 2px;border: 1px solid #DDD;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;">
 <
input type="number" id="points" style="width:50px;height:15px;" value="{$tsPunteador.rango}min="1" max="{$tsPunteador.rango}"/> 
 <
input type="submit" onclick="votar_post(document.getElementById('points').value); return false;" value="Votar" class="btn_g" style="width: 55px;">  
 </
div>
 </
center>
 {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.index $tsPunteador.rango}-{/if}
                                {/
section}
 {/if}
                                (
de {$tsUser->info.user_puntosxdarDisponibles)
                            </
div>
                            <
hr class="divider"/>
                            {/if} 


En m.posts_content.tpl --> themes --> default --> templates --> modules --> m.posts_content.tpl

Buscar:

Código PHP:
<div class="compartir-mov" style="text-align: right; color:#888; font-size: 14px;margin: 30px 0 10px"


Arriba agregar:


Código PHP:
<div class="floatR">
                                {if !
$tsPost.vote && $tsPost.post_user != $tsUser->uid}
                                <
a href="#" onclick="votar_post(1); return false;" id="vp_pos" title="Votar positivo"><img src="{$tsConfig.images}/v_pos.png" /></a>
                                <
a href="#" onclick="votar_post(2); return false;" id="vp_neg" title="Votar negativo"><img src="{$tsConfig.images}/v_neg.png" /></a>
                                {/if}
                                <
a href="#" onclick="$('#vp_toggle').toggle('fast'); return false;" id="vp_total" style="background:#{if $tsPost.post_puntos < 0}B92626{else}6f8f52{/if};color:#fff;font-size:10px;padding:0px 5px;font-weight: bold;border-radius:3px;display: inline-block;vertical-align: top;" title="Total votos">{$tsPost.post_puntos}</a>
                            </
div>
                            <
div id="vp_toggle" style="display:none;margin-top: 27px;">
                            {foreach 
from=$tsPost.puntos item=v key=i}
                                <
a href="{$tsConfig.url}/perfil/{$v.user_name}style="color:#{if $v.cant == 2}B92626{else}6f8f52{/if};" title="Vot&oacute; {if $v.cant == 2}negativo{else}positivo{/if}" class="hovercard" uid="{$v.tuser}">{$v.user_name}</a>{if $tsPost.total_votos $i+1}, {/if}
                                {/foreach}
                            </
div


En acciones.js --> themes --> default --> js --> acciones.js

Buscar:

Código PHP:
$('#puntos_post').html(number_format(parseInt($('#puntos_post').html().replace(".""")) + parseInt(puntos), 0',''.')); 


Debajo agregar:

Código PHP:
$('#vp_pos').remove();
 $(
'#vp_neg').remove();
 var 
total = (puntos == 2) ? parseInt($('#vp_total').html())-parseInt($('#vp_total').html())+1;
 $(
'#vp_total').html(total);
 if(
total 0) $('#vp_total').css({'background' '#B92626'}); 



Y subir esta carpeta

Mega
http://Registrate o inicia tu sesión par... contenido

Google Drive
http://Registrate o inicia tu sesión par... contenido

Mediafire
http://Registrate o inicia tu sesión par... contenido



Creditos: Kmario19
Gracias
Una duda ¿Con estos votos ayuda para aumentar la reputación del post también?
(01-25-2021, 03:07 PM)Chctrpgo escribió: [ -> ]
[img]Registrate o inicia tu sesión para ver este contenido[/img]
 
[img]Registrate o inicia tu sesión para ver este contenido[/img]
 
[img]Registrate o inicia tu sesión para ver este contenido[/img]



En c.posts.php --> inc --> class --> c.posts.php

Buscar:
 
Código PHP:
$puntos intval($_POST['puntos']); 


Reemplazar por:
 
Código PHP:
$puntos = ($_POST['puntos'] == 2) ? 1


Buscar:
 
Código PHP:
// SUMAR PUNTOS AL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE p_posts SET post_puntos = post_puntos + '.(int)$puntos.' WHERE post_id = \''.(int)$post_id.'\'');
// SUMAR PUNTOS AL DUEÑO DEL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntos = user_puntos + \''.(int)$puntos.'\' WHERE user_id = \''.(int)$data['post_user'].'\'');
// RESTAR PUNTOS AL VOTANTE
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntosxdar = user_puntosxdar - \''.(int)$puntos.'\' WHERE user_id = \''.$tsUser->uid.'\''); 


Reemplazar por:
 
Código PHP:
// SUMAR PUNTOS AL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE p_posts SET post_puntos = post_puntos '.(($puntos == 2) ? '- \'1\'' '+ \'1\'').' WHERE post_id = \''.(int)$post_id.'\'');
// SUMAR PUNTOS AL DUEÑO DEL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntos = user_puntos '.(($puntos == 2) ? '- \'1\'' '+ \'1\'').' WHERE user_id = \''.(int)$data['post_user'].'\'');
// RESTAR PUNTOS AL VOTANTE
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntosxdar = user_puntosxdar - \'1\' WHERE user_id = \''.$tsUser->uid.'\''); 


Buscar:
 
Código PHP:
//PUNTOS
        
if($postData['post_user'] == $tsUser->uid || $tsUser->is_admod){
        
$postData['puntos'] = result_array(db_exec(array(__FILE____LINE__), 'query''SELECT p.*, u.user_id, u.user_name FROM p_votos AS p LEFT JOIN u_miembros AS u ON p.tuser = u.user_id WHERE p.tid = \''.(int)$postData['post_id'].'\' && p.type = \'1\' ORDER BY p.cant DESC'));



Reemplazar por:
 
Código PHP:
//PUNTOS
        
if($postData['post_puntos']){
        
$postData['puntos'] = result_array(db_exec(array(__FILE____LINE__), 'query''SELECT p.*, u.user_id, u.user_name FROM p_votos AS p LEFT JOIN u_miembros AS u ON p.tuser = u.user_id WHERE p.tid = \''.(int)$postData['post_id'].'\' && p.type = \'1\' ORDER BY p.voto_id DESC'));



Buscar:
 
Código PHP:
// NUEVA VISITA : FUNCION SIMPLE 


Arriba agregar:
 
Código PHP:
// YA LO VOTE?
$vote db_exec('fetch_row'db_exec(array(__FILE____LINE__), 'query''SELECT COUNT(voto_id) AS v FROM p_votos WHERE tid = \''.(int)$postData['post_id'].'\' AND tuser = \''.$tsUser->uid.'\' LIMIT 1'));
$postData['vote'] = !empty($vote[0]) ? true false


En c.monitor.php --> inc --> class --> c.monitor.php

Buscar:
 
Código PHP:
=> array('text' => 'dej&oacute; _REP_ puntos en tu''ln_text' => 'post''css' => 'points'), 


Reemplazar por:
 
Código PHP:
=> array('text' => 'vot&oacute; _REP_ tu''ln_text' => 'post''css' => 'voto_'), 


Buscar:
 
Código PHP:
if($no_type == 3$oracion['text'] = str_replace('_REP_''<b>'.$data['obj_dos'].'</b>'$oracion['text']); 


Reemplazar por:
 
Código PHP:
if($no_type == 3$oracion['text'] = str_replace('_REP_''<b>'.($data['obj_dos'] == 2) ? 'negativo' 'positivo' .'</b>'$oracion['text']);
                if(
$no_type == 3) {
$voto_type = ($data['obj_dos'] == 2) ? 'negativo' 'positivo';
$oracion['text'] = str_replace('_REP_''<b>'.$voto_type.'</b>'$oracion['text']);
$oracion['style'] = 'voto_'.$voto_type;



En c.actividad.php --> inc --> class --> c.actividad.php

Buscar:
 
Código PHP:
=> array('text' => array('Dej&oacute;''puntos en el post'), 'css' => 'points'), 


Reemplazar por:
 
Código PHP:
=> array('text' => array('Vot&oacute;''el post'), 'css' => 'voto_'), 


Buscar:
 
Código PHP:
if($ac_type == 3$extra_text $data['obj_dos']; 


Reemplazar por:
 
Código PHP:
if($ac_type == 3$extra_text = ($data['obj_dos'] == 2) ? 'negativo' 'positivo'


Buscar:
 
Código PHP:
$oracion['style'] = ($ac_type == 6) ? 'voto_'.$extra_text $oracion['style']; 


Reemplazar por:
 
Código PHP:
$oracion['style'] = ($ac_type == || $ac_type == 6) ? 'voto_'.$extra_text $oracion['style']; 


En m.posts_metadata.tpl --> themes --> default --> templates --> modules --> m.posts_metadata.tpl

Buscar y borrarlo:
 
Código PHP:
{if ($tsUser->is_admod || $tsUser->permisos.godp) && $tsUser->is_member == && $tsPost.post_user != $tsUser->uid && $tsUser->info.user_puntosxdar >= 1}
                            <
div class="dar-puntos">
 {if 
$tsPunteador.rango >= 50}
 <
center>
 <
div align="center" style="background: #F2F2F2;width: 58px;padding: 2px;border: 1px solid #DDD;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;">
 <
input type="number" id="points" style="width:50px;height:15px;" value="{$tsPunteador.rango}min="1" max="{$tsPunteador.rango}"/> 
 <
input type="submit" onclick="votar_post(document.getElementById('points').value); return false;" value="Votar" class="btn_g" style="width: 55px;">  
 </
div>
 </
center>
 {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.index $tsPunteador.rango}-{/if}
                                {/
section}
 {/if}
                                (
de {$tsUser->info.user_puntosxdarDisponibles)
                            </
div>
                            <
hr class="divider"/>
                            {/if} 


En m.posts_content.tpl --> themes --> default --> templates --> modules --> m.posts_content.tpl

Buscar:
 
Código PHP:
<div class="compartir-mov" style="text-align: right; color:#888; font-size: 14px;margin: 30px 0 10px"


Arriba agregar:


Código PHP:
<div class="floatR">
                                {if !
$tsPost.vote && $tsPost.post_user != $tsUser->uid}
                                <
a href="#" onclick="votar_post(1); return false;" id="vp_pos" title="Votar positivo"><img src="{$tsConfig.images}/v_pos.png" /></a>
                                <
a href="#" onclick="votar_post(2); return false;" id="vp_neg" title="Votar negativo"><img src="{$tsConfig.images}/v_neg.png" /></a>
                                {/if}
                                <
a href="#" onclick="$('#vp_toggle').toggle('fast'); return false;" id="vp_total" style="background:#{if $tsPost.post_puntos < 0}B92626{else}6f8f52{/if};color:#fff;font-size:10px;padding:0px 5px;font-weight: bold;border-radius:3px;display: inline-block;vertical-align: top;" title="Total votos">{$tsPost.post_puntos}</a>
                            </
div>
                            <
div id="vp_toggle" style="display:none;margin-top: 27px;">
                            {foreach 
from=$tsPost.puntos item=v key=i}
                                <
a href="{$tsConfig.url}/perfil/{$v.user_name}style="color:#{if $v.cant == 2}B92626{else}6f8f52{/if};" title="Vot&oacute; {if $v.cant == 2}negativo{else}positivo{/if}" class="hovercard" uid="{$v.tuser}">{$v.user_name}</a>{if $tsPost.total_votos $i+1}, {/if}
                                {/foreach}
                            </
div


En acciones.js --> themes --> default --> js --> acciones.js

Buscar:
 
Código PHP:
$('#puntos_post').html(number_format(parseInt($('#puntos_post').html().replace(".""")) + parseInt(puntos), 0',''.')); 


Debajo agregar:
 
Código PHP:
$('#vp_pos').remove();
 $(
'#vp_neg').remove();
 var 
total = (puntos == 2) ? parseInt($('#vp_total').html())-parseInt($('#vp_total').html())+1;
 $(
'#vp_total').html(total);
 if(
total 0) $('#vp_total').css({'background' '#B92626'}); 



Y subir esta carpeta

Mega
#V1RRqod6oAFSeLQ4tKF7ECURhwWoBjbBcQ7SltbOwcI[/url]

Google Drive
[/url]

Mediafire
%2528Act_1.3%2529.rar/file[/url]



Creditos:

Excelente y facil de aplicar !! Lo adapte a la V7 de Cerberus. Registrate o inicia tu sesión para ver este contenido
(01-25-2021, 03:07 PM)Chctrpgo escribió: [ -> ]
[img]Registrate o inicia tu sesión para ver este contenido[/img]
 
[img]Registrate o inicia tu sesión para ver este contenido[/img]
 
[img]Registrate o inicia tu sesión para ver este contenido[/img]



En c.posts.php --> inc --> class --> c.posts.php

Buscar:
 
Código PHP:
$puntos intval($_POST['puntos']); 


Reemplazar por:
 
Código PHP:
$puntos = ($_POST['puntos'] == 2) ? 1


Buscar:
 
Código PHP:
// SUMAR PUNTOS AL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE p_posts SET post_puntos = post_puntos + '.(int)$puntos.' WHERE post_id = \''.(int)$post_id.'\'');
// SUMAR PUNTOS AL DUEÑO DEL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntos = user_puntos + \''.(int)$puntos.'\' WHERE user_id = \''.(int)$data['post_user'].'\'');
// RESTAR PUNTOS AL VOTANTE
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntosxdar = user_puntosxdar - \''.(int)$puntos.'\' WHERE user_id = \''.$tsUser->uid.'\''); 


Reemplazar por:
 
Código PHP:
// SUMAR PUNTOS AL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE p_posts SET post_puntos = post_puntos '.(($puntos == 2) ? '- \'1\'' '+ \'1\'').' WHERE post_id = \''.(int)$post_id.'\'');
// SUMAR PUNTOS AL DUEÑO DEL POST
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntos = user_puntos '.(($puntos == 2) ? '- \'1\'' '+ \'1\'').' WHERE user_id = \''.(int)$data['post_user'].'\'');
// RESTAR PUNTOS AL VOTANTE
db_exec(array(__FILE____LINE__), 'query''UPDATE u_miembros SET user_puntosxdar = user_puntosxdar - \'1\' WHERE user_id = \''.$tsUser->uid.'\''); 


Buscar:
 
Código PHP:
//PUNTOS
        
if($postData['post_user'] == $tsUser->uid || $tsUser->is_admod){
        
$postData['puntos'] = result_array(db_exec(array(__FILE____LINE__), 'query''SELECT p.*, u.user_id, u.user_name FROM p_votos AS p LEFT JOIN u_miembros AS u ON p.tuser = u.user_id WHERE p.tid = \''.(int)$postData['post_id'].'\' && p.type = \'1\' ORDER BY p.cant DESC'));



Reemplazar por:
 
Código PHP:
//PUNTOS
        
if($postData['post_puntos']){
        
$postData['puntos'] = result_array(db_exec(array(__FILE____LINE__), 'query''SELECT p.*, u.user_id, u.user_name FROM p_votos AS p LEFT JOIN u_miembros AS u ON p.tuser = u.user_id WHERE p.tid = \''.(int)$postData['post_id'].'\' && p.type = \'1\' ORDER BY p.voto_id DESC'));



Buscar:
 
Código PHP:
// NUEVA VISITA : FUNCION SIMPLE 


Arriba agregar:
 
Código PHP:
// YA LO VOTE?
$vote db_exec('fetch_row'db_exec(array(__FILE____LINE__), 'query''SELECT COUNT(voto_id) AS v FROM p_votos WHERE tid = \''.(int)$postData['post_id'].'\' AND tuser = \''.$tsUser->uid.'\' LIMIT 1'));
$postData['vote'] = !empty($vote[0]) ? true false


En c.monitor.php --> inc --> class --> c.monitor.php

Buscar:
 
Código PHP:
=> array('text' => 'dej&oacute; _REP_ puntos en tu''ln_text' => 'post''css' => 'points'), 


Reemplazar por:
 
Código PHP:
=> array('text' => 'vot&oacute; _REP_ tu''ln_text' => 'post''css' => 'voto_'), 


Buscar:
 
Código PHP:
if($no_type == 3$oracion['text'] = str_replace('_REP_''<b>'.$data['obj_dos'].'</b>'$oracion['text']); 


Reemplazar por:
 
Código PHP:
if($no_type == 3$oracion['text'] = str_replace('_REP_''<b>'.($data['obj_dos'] == 2) ? 'negativo' 'positivo' .'</b>'$oracion['text']);
                if(
$no_type == 3) {
$voto_type = ($data['obj_dos'] == 2) ? 'negativo' 'positivo';
$oracion['text'] = str_replace('_REP_''<b>'.$voto_type.'</b>'$oracion['text']);
$oracion['style'] = 'voto_'.$voto_type;



En c.actividad.php --> inc --> class --> c.actividad.php

Buscar:
 
Código PHP:
=> array('text' => array('Dej&oacute;''puntos en el post'), 'css' => 'points'), 


Reemplazar por:
 
Código PHP:
=> array('text' => array('Vot&oacute;''el post'), 'css' => 'voto_'), 


Buscar:
 
Código PHP:
if($ac_type == 3$extra_text $data['obj_dos']; 


Reemplazar por:
 
Código PHP:
if($ac_type == 3$extra_text = ($data['obj_dos'] == 2) ? 'negativo' 'positivo'


Buscar:
 
Código PHP:
$oracion['style'] = ($ac_type == 6) ? 'voto_'.$extra_text $oracion['style']; 


Reemplazar por:
 
Código PHP:
$oracion['style'] = ($ac_type == || $ac_type == 6) ? 'voto_'.$extra_text $oracion['style']; 


En m.posts_metadata.tpl --> themes --> default --> templates --> modules --> m.posts_metadata.tpl

Buscar y borrarlo:
 
Código PHP:
{if ($tsUser->is_admod || $tsUser->permisos.godp) && $tsUser->is_member == && $tsPost.post_user != $tsUser->uid && $tsUser->info.user_puntosxdar >= 1}
                            <
div class="dar-puntos">
 {if 
$tsPunteador.rango >= 50}
 <
center>
 <
div align="center" style="background: #F2F2F2;width: 58px;padding: 2px;border: 1px solid #DDD;-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;">
 <
input type="number" id="points" style="width:50px;height:15px;" value="{$tsPunteador.rango}min="1" max="{$tsPunteador.rango}"/> 
 <
input type="submit" onclick="votar_post(document.getElementById('points').value); return false;" value="Votar" class="btn_g" style="width: 55px;">  
 </
div>
 </
center>
 {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.index $tsPunteador.rango}-{/if}
                                {/
section}
 {/if}
                                (
de {$tsUser->info.user_puntosxdarDisponibles)
                            </
div>
                            <
hr class="divider"/>
                            {/if} 


En m.posts_content.tpl --> themes --> default --> templates --> modules --> m.posts_content.tpl

Buscar:
 
Código PHP:
<div class="compartir-mov" style="text-align: right; color:#888; font-size: 14px;margin: 30px 0 10px"


Arriba agregar:


Código PHP:
<div class="floatR">
                                {if !
$tsPost.vote && $tsPost.post_user != $tsUser->uid}
                                <
a href="#" onclick="votar_post(1); return false;" id="vp_pos" title="Votar positivo"><img src="{$tsConfig.images}/v_pos.png" /></a>
                                <
a href="#" onclick="votar_post(2); return false;" id="vp_neg" title="Votar negativo"><img src="{$tsConfig.images}/v_neg.png" /></a>
                                {/if}
                                <
a href="#" onclick="$('#vp_toggle').toggle('fast'); return false;" id="vp_total" style="background:#{if $tsPost.post_puntos < 0}B92626{else}6f8f52{/if};color:#fff;font-size:10px;padding:0px 5px;font-weight: bold;border-radius:3px;display: inline-block;vertical-align: top;" title="Total votos">{$tsPost.post_puntos}</a>
                            </
div>
                            <
div id="vp_toggle" style="display:none;margin-top: 27px;">
                            {foreach 
from=$tsPost.puntos item=v key=i}
                                <
a href="{$tsConfig.url}/perfil/{$v.user_name}style="color:#{if $v.cant == 2}B92626{else}6f8f52{/if};" title="Vot&oacute; {if $v.cant == 2}negativo{else}positivo{/if}" class="hovercard" uid="{$v.tuser}">{$v.user_name}</a>{if $tsPost.total_votos $i+1}, {/if}
                                {/foreach}
                            </
div


En acciones.js --> themes --> default --> js --> acciones.js

Buscar:
 
Código PHP:
$('#puntos_post').html(number_format(parseInt($('#puntos_post').html().replace(".""")) + parseInt(puntos), 0',''.')); 


Debajo agregar:
 
Código PHP:
$('#vp_pos').remove();
 $(
'#vp_neg').remove();
 var 
total = (puntos == 2) ? parseInt($('#vp_total').html())-parseInt($('#vp_total').html())+1;
 $(
'#vp_total').html(total);
 if(
total 0) $('#vp_total').css({'background' '#B92626'}); 



Y subir esta carpeta

Mega
#V1RRqod6oAFSeLQ4tKF7ECURhwWoBjbBcQ7SltbOwcI[/url]

Google Drive
[/url]

Mediafire
%2528Act_1.3%2529.rar/file[/url]



Creditos:

Todo quedó funcional pero en Notificaciones cuando votan un post positivo aparece negativo ¿puede ser que haya algun error en el código que tengamos que corregir?
[img]Registrate o inicia tu sesión para ver este contenido[/img]
Adjunto la imagen que muestra que un post votado positivo lo notifica como negativo aunque el voto es positivo.
(04-22-2024, 07:13 PM)Mawriceo escribió: [ -> ]Todo quedó funcional pero en Notificaciones cuando votan un post positivo aparece negativo ¿puede ser que haya algun error en el código que tengamos que corregir?
[img]Registrate o inicia tu sesión para ver este contenido[/img]
Adjunto la imagen que muestra que un post votado positivo lo notifica como negativo aunque el voto es positivo.

Hola prueba esto, en el punto que reemplaza algunas lineas en el inc/class/c.monitor.php (2da línea a buscar) que tienen que reemplazar esto
Código PHP:
if($no_type == 3$oracion['text'] = str_replace('_REP_''<b>'.$data['obj_dos'].'</b>'$oracion['text']); 
Por esto 
Código PHP:
if($no_type == 3$oracion['text'] = str_replace('_REP_''<b>'.($data['obj_dos'] == 2) ? 'negativo' 'positivo' .'</b>'$oracion['text']);
                if(
$no_type == 3) {
$voto_type = ($data['obj_dos'] == 2) ? 'negativo' 'positivo';
$oracion['text'] = str_replace('_REP_''<b>'.$voto_type.'</b>'$oracion['text']);
$oracion['style'] = 'voto_'.$voto_type;


Esta mal, ya que esta repitiendo 2 veces la misma acción, el if ternario que tiene en la primera línea puede ser la causante ya que es (condición ? true : false) eso solo si esta dentro de una función, su fuese una variable va bien...

Usa esta línea y comprueba si funciona o tienes el mismo resultado... (básicamente esa línea de más lo hace en este if)
Código PHP:
if($no_type == 3) {
    
$voto_type = ($data['obj_dos'] == 2) ? 'negativo' 'positivo';
    
$oracion['text'] = str_replace('_REP_''<b>'.$voto_type.'</b>'$oracion['text']);
    
$oracion['style'] = 'voto_'.$voto_type;


PD: no lo he probado, pero estuve mirando el código.
(04-23-2024, 07:51 PM)Miguel92 escribió: [ -> ]
(04-22-2024, 07:13 PM)Mawriceo escribió: [ -> ]Todo quedó funcional pero en Notificaciones cuando votan un post positivo aparece negativo ¿puede ser que haya algun error en el código que tengamos que corregir?
[img]Registrate o inicia tu sesión para ver este contenido[/img]
Adjunto la imagen que muestra que un post votado positivo lo notifica como negativo aunque el voto es positivo.

Hola prueba esto, en el punto que reemplaza algunas lineas en el inc/class/c.monitor.php (2da línea a buscar) que tienen que reemplazar esto
 
Código PHP:
if($no_type == 3$oracion['text'] = str_replace('_REP_''<b>'.$data['obj_dos'].'</b>'$oracion['text']); 
Por esto 
 
Código PHP:
if($no_type == 3$oracion['text'] = str_replace('_REP_''<b>'.($data['obj_dos'] == 2) ? 'negativo' 'positivo' .'</b>'$oracion['text']);
                if(
$no_type == 3) {
$voto_type = ($data['obj_dos'] == 2) ? 'negativo' 'positivo';
$oracion['text'] = str_replace('_REP_''<b>'.$voto_type.'</b>'$oracion['text']);
$oracion['style'] = 'voto_'.$voto_type;


Esta mal, ya que esta repitiendo 2 veces la misma acción, el if ternario que tiene en la primera línea puede ser la causante ya que es (condición ? true : false) eso solo si esta dentro de una función, su fuese una variable va bien...

Usa esta línea y comprueba si funciona o tienes el mismo resultado... (básicamente esa línea de más lo hace en este if)
 
Código PHP:
if($no_type == 3) {
    
$voto_type = ($data['obj_dos'] == 2) ? 'negativo' 'positivo';
    
$oracion['text'] = str_replace('_REP_''<b>'.$voto_type.'</b>'$oracion['text']);
    
$oracion['style'] = 'voto_'.$voto_type;


PD: no lo he probado, pero estuve mirando el código.

Que capo!!! Gracias, Miguel92. ahora si notifica bien, lo probe votando negativo y positivo en otro posts, , incluso los que estaban como negativo y eran positivo pasaron a positivo en el smiley.
[img]Registrate o inicia tu sesión para ver este contenido[/img]