Hallo, Gast! (Registrieren)

Wir wünschen allen Besuchern frohe Ostern!

Letzte Ankündigung: MyBB 1.8.37 veröffentlicht (04.11.23)


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste
Recent Posts Forum Index
#1
Eine neue Erweiterung wurde veröffentlicht: Recent Posts Forum Index

Zitat:This mod will add the most recent posts of your forum at the top of your forum index. The permissions are carried intact. i.e. the group/groups that does/have not permissions to view a forum, will not be able to see the posts from the forum/forums that they are not allowed to view.

Also posts from forums set as Inactive will not show up. The same goes for the invisible posts too.

Installation. First unzip the mod package and ftp the inc folder inside to the root of your forum folder preserving the structure intact. Then to configure it go to your Acp->Configuration->Settings->Forum Home Options. Scroll all the way to the bottom and you will see 2 extra settings added. One is to turn the plugin on/off and the other to decide how many posts you would like to show at the Recent Posts Stats Box.

For more please check out the attached screenshots.

If you will need support with this please post at the mod thread at my forum. Thank you Smile

http://www.forumservices.eu/mybb/showthread.php?tid=7

Vorschau:
http://www.forumservices.eu/mybb/
Zitieren
#2
Hallo,

bei diesem Plugin wird nur der Name seo-freundlich angezeigt, aber der Rest nicht. Muss ich da was in der Plugindatei umschreiben oder soll ich ihnen gleich die .htaccess zeigen. Halt die Standard-Datei von Google Seo.
Mit freundlichen Grüßen



Für etwaige Tipps, Vorschläge oder Anleitungen von mir gebe ich keine Gewähr. Die Durchführung erfolgt auf eigene Gefahr!
Zitieren
#3
In dem Plugin ist der URL-Stil showthread.php?tid=123 einfach hardgecoded. Das hat mit Google SEO nichts zu tun, wenn du die MyBB-Form thread-123.html verwenden würdest, wäre es mit diesem Plugin trotzdem showthread.php?tid=123.

Das Plugin sollte die Funktionen get_thread_link() / get_forum_link() benutzen.
Zitieren
#4
Aber benutzt es nicht oder wenn nicht, kann man dies umschreiben?
Mit freundlichen Grüßen



Für etwaige Tipps, Vorschläge oder Anleitungen von mir gebe ich keine Gewähr. Die Durchführung erfolgt auf eigene Gefahr!
Zitieren
#5
Schau dir den Sourcecode des Plugins an und überall wo showthread.php?tid=$x benutzt wird machst du get_thread_link($x) daraus. Analog für forumdisplay.php und get_forum_link(). Diese Funktionen sind in inc/functions.php definiert.
Zitieren
#6
Okay. Ich versuch es mal. Ansonsten werde ich wieder hier vorstellig.
Mit freundlichen Grüßen



Für etwaige Tipps, Vorschläge oder Anleitungen von mir gebe ich keine Gewähr. Die Durchführung erfolgt auf eigene Gefahr!
Zitieren
#7
Die angesprochene Variable showthread.php?tid=$x find ich nicht.

Plugin
Push it
Mit freundlichen Grüßen



Für etwaige Tipps, Vorschläge oder Anleitungen von mir gebe ich keine Gewähr. Die Durchführung erfolgt auf eigene Gefahr!
Zitieren
#8
Bitte verlinke Plugins anstatt sie hier hochzuladen, danke.
[Bild: banner.png]

Bitte die Foren-Regeln beachten und im Profil die verwendete MyBB-Version angeben.
Zitieren
#9
PHP-Code:
<?php

//Latest Posts Board Index Mod by Borbole

//Trying to access directly the file, are we :D

if(!defined("IN_MYBB"))
{
    die(
"Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

//Hooking into index_start with our function
$plugins->add_hook("index_start""recentposts_box");


//Show some info about our mod
function recentpostsindex_info()
{
    return array(
        
"name"            => "Recent Posts Forum Index",
        
"description"    => "It shows the recent posts on your board index.",
        
"website"        => "http://www.forumservices.eu/mybb",
        
"version"        => "1.0",
        
"author"        => "borbole",
        
"authorsite"    => "http://www.forumservices.eu/mybb",
        
"compatibility"  => "16*",
        
'guid'        => 'f8cd8d11a353a4f58a29fbc0d72ec9c3'
    
);
}

//Activate it
function recentpostsindex_activate()
{
    global 
$db;

    
//Insert the mod settings in the forumhome settinggroup. It looks beter there :D

    
$query $db->simple_select("settinggroups""gid""name='forumhome'");
    
$gid $db->fetch_field($query"gid");


    
$setting = array(
        
'name' => 'enable',
        
'title' => 'Recent Posts Forum Index',
        
'description' => 'Would you like to display the Recent Posts Box at your board index?',
        
'optionscode' => 'yesno',
        
'value' => '1',
        
'disporder' => '90',
        
'gid' => intval($gid)
    );
    
$db->insert_query('settings',$setting);

    
$setting = array(
        
"name" => "limit_posts_nr",
        
"title" => "Recent Posts!",
        
"description" => "Enter here the number of the recent posts that you would like to show at the forum index. By default it set to show 5 posts.",
        
"optionscode" => "text",
        
"value" => "5",
        
"disporder" => "91",
        
"gid" => intval($gid),
        );
    
$db->insert_query("settings"$setting);

    
rebuild_settings();

   
//Add our custom var in the index template to display the latest posts box
   
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";

   
find_replace_templatesets("index""#".preg_quote('{$header}') . "#i"'{$header}' "\n" '{$recentposts}');

}


//Don't want to use it anymore? Let 's deactivate it then and drop the settings and the custom var as well

function recentpostsindex_deactivate()
{
    global 
$db;

$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='enable'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='limit_posts_nr'");

rebuild_settings();

require_once 
MYBB_ROOT."/inc/adminfunctions_templates.php";

find_replace_templatesets("index""#".preg_quote('{$header}' "\n" '{$recentposts}') . "#i"'{$header}',0);

}


//Insert our function
function recentposts_box()
{
    global 
$db$mybb$lang$theme$recentposts;

    
//Enable it
    
if($mybb->settings['enable'] == )
    {
        
//Load the language files and set up the table for the recent posts box
        
$lang->load('recentpostsindex');

        
$recentposts .= '
        <table border="0" cellspacing="' 
$theme['borderwidth'] . '" cellpadding="' $theme['tablespace'] . '" class="tborder">
            <tbody>
                    <tr>
                   <td class="thead" colspan="4" align="left">
                       <strong>' 
$lang->recentpostname '</strong>
                   </td>
               </tr>
               <tr>
            <td class="tcat" width="25%"><span class="smalltext"><strong>' 
$lang->postforum '</strong></span></td>

                   <td class="tcat" align="center" width="15%"><span class="smalltext"><strong>' 
$lang->lastposttime '</strong></span></td>
                   <td class="tcat" align="center" width="20%"><span class="smalltext"><strong>' 
$lang->poster '</strong></span></td>
            <td class="tcat" align="center" width="35%"><span class="smalltext"><strong>' 
$lang->recentpoststitle '</strong></span></td>
               </tr>
           '
;

        
//Preserve the forum viewing permissions intact

        
$fids "";
        
$unviewablefids get_unviewable_forums();

        if(
$unviewablefids)
        {
            
$fids "WHERE t.fid NOT IN ({$unviewablefids})";
        }

        
//Exclude inactive forums from showing up

        
$inactivefids get_inactive_forums();
        if (
$inactivefids)
        {
            
$fids .= " WHERE t.fid NOT IN ($inactivefids)";
        }


        
//Run the query to get the most recent posts along with their posters, time and forums

       
$query $db->query("
       SELECT t.tid, t.fid, t.subject, t.lastpost,
       t.lastposter, t.lastposteruid, f.name,
       u.usergroup, u.displaygroup
       FROM "
.TABLE_PREFIX."threads AS t
       INNER JOIN "
.TABLE_PREFIX."forums as f
       ON (f.fid = t.fid)
       LEFT JOIN " 
TABLE_PREFIX "users AS u
       ON (t.lastposteruid = u.uid)
       
{$fids}
       AND t.visible = '1'
       GROUP BY t.tid
       ORDER BY t.lastpost DESC
       LIMIT " 
$mybb->settings['limit_posts_nr']);

        while(
$row $db->fetch_array($query))
        {
           
$recentposts .= '
           <tr>'
;

           
//Trim the thread titles if they are over 49 characters

           
$subject htmlspecialchars_uni($row['subject']);

           if (
strlen($subject) > 49)
           {
              
$subject substr($subject049) . "...";
           }

           
//Trim the usernames if they are over 9 characters

           
if (strlen($row['lastposter']) > 9)
           {
              
$row['lastposter'] = substr($row['lastposter'], 09) . "...";
           }

            
//Trim the forum names if they are over 19 characters so everything will be in porpotion
           
if (strlen($row['name']) > 19)
           {
              
$row['name'] = substr($row['name'], 019) . "...";
           }

           
//Get the date and time of the most recent posts

           
$lastpostdate my_date($mybb->settings['dateformat'], $row['lastpost']);
           
$lastposttime my_date($mybb->settings['timeformat'], $row['lastpost']);

           
//Get the usernames and make them pretty too with the group styling

           
$username build_profile_link(format_name($row['lastposter'],$row['usergroup'],$row['displaygroup']), $row['lastposteruid']);

           
//Display them all trimmed up and pretty :D

           
$recentposts .= '
                  <td class="trow2" align="left" width="25%">
               <a href="forumdisplay.php?&amp;fid=' 
$row['fid'] . '">' $row['name'] . '</a>
            </td>
           <td class="trow1" align="center" width="15%">
           ' 
.$lastpostdate ' ' $lastposttime '
           </td>
                  <td class="trow2" align="center" width="15%">
              ' 
$username '
           </td>
                  <td class="trow1" align="center" width="35%">
              <a href="showthread.php?tid=' 
$row['tid'] . '&amp;action=lastpost">' $subject .'</a>
           </td>

          </tr>'
;
        }

          
//End of mod. I hope you enjoy it as much as I did coding it :)

          
$recentposts .= "</tbody></table><br /><br />";

   }

}

?>

Dies ist der Code von dem Plugin. Könnt mir da jemand mal helfen? Danke!
Mit freundlichen Grüßen



Für etwaige Tipps, Vorschläge oder Anleitungen von mir gebe ich keine Gewähr. Die Durchführung erfolgt auf eigene Gefahr!
Zitieren
#10
(29.04.2014, 12:36)frostschutz schrieb: Schau dir den Sourcecode des Plugins an und überall wo showthread.php?tid=$x benutzt wird machst du get_thread_link($x) daraus. Analog für forumdisplay.php und get_forum_link(). Diese Funktionen sind in inc/functions.php definiert.
(29.04.2014, 19:17)hkkp schrieb: Die angesprochene Variable showthread.php?tid=$x find ich nicht.
Dann suche mal nach
PHP-Code:
forumdisplay.php?&amp;fid=' . $row['fid'] . ' 
und
PHP-Code:
showthread.php?tid=' . $row['tid'] . '&amp;action=lastpost
Toungue
viele Grüße
Jockl
übersetzte und eigene Plugins
Zitieren


Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  Recent Threads On Index MyBB.de Bot 14 4.268 20.06.2021, 03:40
Letzter Beitrag: skrilaxrev
  WordPress Posts on Forum Index MyBB.de Bot 0 827 28.11.2019, 16:25
Letzter Beitrag: MyBB.de Bot
  Recent Threads MyBB.de Bot 1 1.192 04.06.2018, 18:25
Letzter Beitrag: MyBB.de Bot
  Recent threads from post author MyBB.de Bot 0 1.296 09.12.2014, 10:25
Letzter Beitrag: MyBB.de Bot
  Recent Threads Forum Sidebar MyBB.de Bot 18 6.570 16.10.2014, 17:05
Letzter Beitrag: frage7