Páginas (2):    1 2
Poizonus   12 Mar, 2012, 9:42 am
#11
Ya fue entonces, porque no se nada de php.
Poizonus   13 Mar, 2012, 7:18 am
#12
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:
$plugins->run_hooks("index_start"); 

After that, add:
// 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")."\";");
        } 
And in your index template add
{$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
Gypaete   13 Mar, 2012, 8:54 am
#13
Eso es cosa de las plantillas.
En la plantilla portal_latestthreads_thread:
<img src="{$threads['avatar']}" alt="" /> y listo.
Poizonus   13 Mar, 2012, 10:14 am
#14
No creo que sea así de facil, lo probe y no funciona. Pero yo lo quisiera en el index.
Gypaete   13 Mar, 2012, 10:18 am
#15
(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. Wink
Poizonus   13 Mar, 2012, 10:37 am
#16
xD..! Nada Gypaete, deseo que aparesca en el index. Y nisiquiera aparece en el portal.
Gypaete   13 Mar, 2012, 10:39 am
#17
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.closed 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.closed NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC
LIMIT 0, 10"
);
Y lito, ya te funciona lo del avatar.
Gypaete   17 Mar, 2012, 3:05 am
#18
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.
Páginas (2):    1 2
  
Powered By MyBB, © 2002-2025 MyBB Group.
Made with by Curves UI.