Google+

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rezolvat Ultimul post by author nu lastposter
#1
Va deranjez din nou , folosesc pluginul RecentPostIndex am postat codul pluginului mai jos , iar daca poate cineva sa ma ajute cu urmatoarea problema : asa cum este acuma imi apare in index ultimul anunt postat dar nu imi apare de cine este postat ci de ultima persoana care a lasat reply la topic. Ce trebuie sa modific sa imi ramana in Recent Post , Posted by : AUTORUL topicului nu sa se schimbe de fiecaredata cand primeste un reply pentru ca induce lumea in eroare .

link forum : http://www.oradeanet.com

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?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'] == 1 )
	{
	    //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="center">
                       <strong>' . $lang->recentpostname . '</strong>
				   </td>
               </tr>
               <tr>
                   <td class="tcat" width="45%"><span class="smalltext"><strong>' . $lang->recentpoststitle . '</strong></span></td>
                   <td class="tcat" align="center" width="15%"><span class="smalltext"><strong>' . $lang->poster . '</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->postforum . '</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($subject, 0, 49) . "..."; 
		   }
		   
		   //Trim the usernames if they are over 9 characters
		   
		   if (strlen($row['lastposter']) > 9)
		   {
	          $row['lastposter'] = substr($row['lastposter'], 0, 9) . "..."; 
		   }
		   
		    //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'], 0, 19) . "..."; 
		   }
		   
		   //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="trow1" width="45%">
		      <a href="showthread.php?tid=' . $row['tid'] . '&amp;action=lastpost">' . $subject .'</a> 
		   </td>
		   
		   <td class="trow1" align="center" width="15%">
		      ' . $username . '
		   </td>
		   
		   <td class="trow1" align="center" width="15%">
		   ' .$lastpostdate . ' ' . $lastposttime . '
		   </td>
		   
		   <td class="trow1" align="center" width="20%">
		       <a href="forumdisplay.php?&amp;fid=' . $row['fid'] . '">' . $row['name'] . '</a>
		    </td>
		  </tr>';
	    }
          
		  //End of mod. I hope you enjoy it as much as I did coding it :)
		  
          $recentposts .= "</tbody></table><br /><br />";

   }

}

?>

#2
Inainte de a mai cere ajutorul nostru, asigura-te ca respecti regulamentul.
In cazul tau ar trebui sa specifici undeva in footer ca traducerea in limba romana este oferita de Mybb Romania.

Code:
Traducere oferita de <a href="http://mybb.ro" target=_blank"> Mybb Romania</a>

Pentru a mentine un forum unitar si pentru a utiliza informatia intr-un numar cat mai mic de subiecte, va rugam ca inainte de a deschide o Discutie Noua sa folositi functia Cautare (Search) !
Cititi periodic
Regulamentul


Forum Jump:


Users browsing this thread: 1 Guest(s)