ARTICULOS

Respuesta rápida en phpBB

Autor: Fabian Muller (http://www.webexperto.com) - 06/07/2006

Los foros phpBB se han vuelto muy populares, y al ser totalmente Open Source, desde hace tiempo muchos usuarios han ido ideando y realizando diferentes módulos para agregar al sistema. En este caso, veremos como instalar un MOD que permite a un usuario del foro emitir una respuesta desde la misma página del tema sin tener que hacer clic en Responder.

Para agregar la Respuesta Rápida (Quick Reply) a nuestro foro utilizaremos el MOD realizado por Smartor, el cual incluye la posibilidad de Citar (Quote) el último mensaje.

La instalación es realmente muy sencilla, y sólamente se deben editar 3 archivos:

  • viewtopic.php
  • language/lang_XX/lang_main.php
  • templates/template_XX/viewtopic_body.tpl

Editando archivos

viewtopic.php

Buscamos:

$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

Y antes de esas líneas agregamos:

// Quick Reply Mod
//
if ( ((!$is_auth['auth_reply']) or ($forum_topic_data['forum_status'] == FORUM_LOCKED) or ($forum_topic_data['topic_status'] == TOPIC_LOCKED)) and ($userdata['user_level'] != ADMIN) )
{
$quick_reply_form = "";
}
else
{
if ( $can_watch_topic && $is_watching_topic )
{
$notify = 1;
}
else
{
$notify = $userdata['user_notify'];
}
$bbcode_uid = $postrow[$total_posts - 1]['bbcode_uid'];
$last_poster = $postrow[$total_posts - 1]['username'];
$last_msg = $postrow[$total_posts - 1]['post_text'];
$last_msg = str_replace(":1:$bbcode_uid", "", $last_msg);
$last_msg = str_replace(":u:$bbcode_uid", "", $last_msg);
$last_msg = str_replace(":o:$bbcode_uid", "", $last_msg);
$last_msg = str_replace(":$bbcode_uid", "", $last_msg);
$last_msg = str_replace("'", "'", $last_msg);
$last_msg = "[QUOTE=\"$last_poster\"]" . $last_msg . "[/QUOTE]";
$quick_reply_form = "
<script language='JavaScript' type='text/javascript'>
function checkForm() {
formErrors = false;
document.post.message.value = '';
if (document.post.input.value.length < 2) {
formErrors = '" . $lang['Empty_message'] . "';
}
if (formErrors) {
alert(formErrors);
return false;
} else {
if (document.post.quick_quote.checked) {
document.post.message.value = document.post.last_msg.value;
}
document.post.message.value += document.post.input.value;
return true;
}
}
</script>
<form action='".append_sid("posting.$phpEx")."' method='post' name='post' onsubmit='return checkForm(this)'>
<span class='genmed'><b>".$lang["Quick_Reply"].":</b><br />";

if (!$userdata['session_logged_in'])
{
$quick_reply_form .= $lang['Username'] . ":&nbsp;<input class='post' type='text' name='username' size='25' maxlength='25' value='' /><br />";
}

$quick_reply_form .= "<textarea name='input' rows='10' cols='50' wrap='virtual' class='post''></textarea><br />
<input type='checkbox' name='quick_quote' />".$lang["Quick_quote"]."<br />
<input type='checkbox' name='attach_sig' checked='checked' />".$lang["Attach_signature"]."<br />
<input type='hidden' name='mode' value='reply' />
<input type='hidden' name='sid' value='" . $userdata['session_id'] . "' />
<input type='hidden' name='t' value='" . $topic_id . "' />
<input type='hidden' name='message' value='' />
<input type='hidden' name='notify' value=" . $notify . " />
<input type='hidden' name='last_msg' value='" . $last_msg . "' />
<input type='submit' name='preview' class='liteoption' value='".$lang['Preview']."' />&nbsp;
<input type='submit' name='post' class='mainoption' value='".$lang["Submit"]."' />
</form></span>";
}

$template->assign_vars(array(
'QUICK_REPLY_FORM' => $quick_reply_form)
);
//
// END Quick Reply Mod

lang_main.php

Buscamos:

// That's all, Folks!

Y antes agregar:

// Quick Reply Mod
$lang['Quick_Reply'] = 'Respuesta rápida';
$lang['Quick_quote'] = 'Citar último mensaje';

viewtopic_body.tpl

Buscamos:

{S_TOPIC_ADMIN}

Y después agregar:

{QUICK_REPLY_FORM}

Resultado

Gracias a estas simples modificaciones, tendremos un MOD de Respuesta Rápida en nuestro foro phpBB:

Puedes ver un ejemplo funcionando visitando nuestros foros.

 

Más artículos sobre phpBB

1. Integrar tu sitio con phpBB
2. Respuesta rápida en phpBB
3. phpBB: Administración de los Foros
4. phpBB: Instalación
5. phpBB: Crear un foro privado
6. phpBB: Administración general
7. phpBB: Mostrar los últimos mensajes
Más artículos...

Otros artículos...

Marketing Aumentar el número de páginas vistas
Varios Instalar Wordpress en hosting gratis
Java Script Todo sobre imágenes en JavaScript
HTML Evitar la caché del navegador
XML ¿Qué es la Sindicación de Contenidos?
Marketing 10 formas de darle notoriedad a un sitio web
ASP.net Detectar país del usuario
phpBB phpBB: Administración de los Foros
Usabilidad Guía para diseñar páginas de error
Java Script Precarga de imágenes en JavaScript
Más artículos...