¡Bienvenido! ¿Aún no estás registrado?, deberás registrarte antes de poder usar el Chat, Comentar y Descargar en el Foro. Usa un email válido para la activación.
Calificación:
  • 1 voto(s) - 5 Media
  • 1
  • 2
  • 3
  • 4
  • 5

COMPLEMENTOS Votar positivo-negativo en post (Act 1.3)
#4

1
(01-25-2021, 03:07 PM)Chctrpgo escribió: Debes agradecer para ver el contenido...
[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:
 
$puntos intval($_POST['puntos']); 


Reemplazar por:
 
$puntos = ($_POST['puntos'] == 2) ? 1


Buscar:
 
// 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:
 
// 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:
 
//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:
 
//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:
 
// NUEVA VISITA : FUNCION SIMPLE 


Arriba agregar:
 
// 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:
 
=> array('text' => 'dejó _REP_ puntos en tu''ln_text' => 'post''css' => 'points'), 


Reemplazar por:
 
=> array('text' => 'votó _REP_ tu''ln_text' => 'post''css' => 'voto_'), 


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


Reemplazar por:
 
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:
 
=> array('text' => array('Dej&oacute;''puntos en el post'), 'css' => 'points'), 


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


Buscar:
 
if($ac_type == 3$extra_text $data['obj_dos']; 


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


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


Reemplazar por:
 
$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:
 
{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:
 
<div class="compartir-mov" style="text-align: right; color:#888; font-size: 14px;margin: 30px 0 10px"


Arriba agregar:


<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:
 
$('#puntos_post').html(number_format(parseInt($('#puntos_post').html().replace(".""")) + parseInt(puntos), 0',''.')); 


Debajo agregar:
 
$('#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
Responder


Compartir en:

Mensajes en este tema
Votar positivo-negativo en post (Act 1.3) - por Chctrpgo - 01-25-2021, 03:07 PM
RE: Votar positivo-negativo en post (Act 1.3) - por Lalo24 - 01-19-2024, 06:58 AM
RE: Votar positivo-negativo en post (Act 1.3) - por moyo - 04-01-2024, 08:24 PM
RE: Votar positivo-negativo en post (Act 1.3) - por Mawriceo - 04-22-2024, 05:46 AM
RE: Votar positivo-negativo en post (Act 1.3) - por Mawriceo - 04-22-2024, 07:13 PM
RE: Votar positivo-negativo en post (Act 1.3) - por Miguel92 - 04-23-2024, 07:51 PM
RE: Votar positivo-negativo en post (Act 1.3) - por Mawriceo - 04-23-2024, 08:02 PM

Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)