Ya fue entonces, porque no se nada de php.
Dark Neo, logré poner el código php al index del foro con un comentario que encontre por mybb comunnity, y es este.
In index.php, find:
After that, add:
And in your index template add
Y pues ya me salen los ultimos mensajes en el index.
Pues como tu hiciste el plugin de mostrar los avatares, me pregunta si sabrás como hacer para poner el avatar del usuario autor o del ultimo comentario al costado de los Ultimos temas
In index.php, find:
Código PHP:
$plugins->run_hooks("index_start");
After that, add:
Código PHP:
// get forums user cannot view
$unviewable = get_unviewable_forums(true);
if($unviewable)
{
$unviewwhere = " AND fid NOT IN ($unviewable)";
}
$altbg = alt_trow();
$threadlist = '';
$query = $db->query("
SELECT t.*, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC
LIMIT 0, 10"
);
while($thread = $db->fetch_array($query))
{
$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
// Don't link to guest's profiles (they have no profile).
if($thread['lastposteruid'] == 0)
{
$lastposterlink = $thread['lastposter'];
}
else
{
$lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
}
if(my_strlen($thread['subject']) > 25)
{
$thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
}
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
$altbg = alt_trow();
}
if($threadlist)
{
// Show the table only if there are threads
eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
}
Código:
{$latestthreads}
Y pues ya me salen los ultimos mensajes en el index.
Pues como tu hiciste el plugin de mostrar los avatares, me pregunta si sabrás como hacer para poner el avatar del usuario autor o del ultimo comentario al costado de los Ultimos temas
Eso es cosa de las plantillas.
En la plantilla portal_latestthreads_thread:
<img src="{$threads['avatar']}" alt="" /> y listo.
En la plantilla portal_latestthreads_thread:
<img src="{$threads['avatar']}" alt="" /> y listo.
No creo que sea así de facil, lo probe y no funciona. Pero yo lo quisiera en el index.
(13 Mar, 2012, 8:54 am)Gypaete escribió: Eso es cosa de las plantillas.
En la plantilla portal_latestthreads_thread:
<img src="{$threads['avatar']}" alt="" /> y listo.
$thread
Sorry, y sí, así de fácil.
xD..! Nada Gypaete, deseo que aparesca en el index. Y nisiquiera aparece en el portal.
En el código PHP
En el query:
$query = $db->query("
SELECT t.*, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
WHERE 1=1 $unviewwhere AND t.visible='1' AND t. NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC
LIMIT 0, 10"
);
Reemplázalo por esto:
$query = $db->query("
SELECT t.*, u.*
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
WHERE 1=1 $unviewwhere AND t.visible='1' AND t. NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC
LIMIT 0, 10"
);
Y lito, ya te funciona lo del avatar.
En el query:
$query = $db->query("
SELECT t.*, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
WHERE 1=1 $unviewwhere AND t.visible='1' AND t. NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC
LIMIT 0, 10"
);
Reemplázalo por esto:
$query = $db->query("
SELECT t.*, u.*
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
WHERE 1=1 $unviewwhere AND t.visible='1' AND t. NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC
LIMIT 0, 10"
);
Y lito, ya te funciona lo del avatar.
Poizonus no puso nada, pero le ayudé por el MSN y la solución fue la que le di en el mensaje anterior, pueden cerrar.