Skip to content

Instantly share code, notes, and snippets.

@joelmiguelvalente
Created September 6, 2020 21:12
Show Gist options
  • Save joelmiguelvalente/0d8436388a248c4e0ec14e476345309f to your computer and use it in GitHub Desktop.
Save joelmiguelvalente/0d8436388a248c4e0ec14e476345309f to your computer and use it in GitHub Desktop.
Posts solo seguidores
En el paso 5, en vez de reemplazar por ese código, reemplazalo con este
<div id="ver_post"></div>
{if $tsAutor.user_id == $tsUser->uid}
<span>{$tsPost.post_body}</span>
{else}
<span>
{if !$tsAutor.follow AND $tsPost.p_seg == 1}
<div id="segv">
<h1>Posts solo para Seguidores</h1>
<p>Para poder ver este Posts debes seguirme simplemente</p>
<div id="seg1">
<a class="btn btn-info follow_user_post" href="javascript:seguirUsuario({if !$tsUser->is_member}'0'{else}'1', '{$tsAutor.user_id}'{/if});"><span class="icons follow">Seguir Usuario</span></a>
</div>
</div>
{else}
{$tsPost.post_body}
{/if}
</span>
{/if}
Paso 6:
Ir a inc/php/ajax/ajax.posts.php y buscar
'posts-votar' => array('n' => 2, 'p' => ''),
debajo agregas
'posts-siguiendo' => array('n' => 2, 'p' => ''),
luego más abajo buscas
case 'posts-votar':
//<--
echo $tsPosts->votarPost();
//-->
break;
y debajo agregas
case 'posts-siguiendo':
//<--
$tsPost = $tsPosts->getPost();
echo $tsPost["post_body"];
//-->
break;
Paso 7:
Si tienes el archivo posts.js lo agregas al final, si no en acciones.js o funciones.js pegas lo siguiente:
function seguirUsuario(tipo, user) {
if(tipo == 0) registro_load_form();
else {
notifica.follow('user', user, notifica.userInPostHandle, $(this).children('span'));
setTimeout(function() {
$.get(global_data.url+'/posts-siguiendo.php', {post_id:global_data.postid}, function(h) {
$('#ver_post').html(h);
$('#segv').remove();
});
}, 3000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment