ProPortal Box
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #1
ProPortal Box
This is probably directed towards Lee more than anyone, LOL...but any and all help is appreciated!

I need a proportal center box that will allow me to add HTML info each month but also have a pagination menu for all the past months.  What i want to do is showcase my Car of the Month winners on the portal page each month.  Easy enough with a custom portal block, but the kicker is keeping the past winners in the block archive.

I'm not sure if there could be a block made for this or maybe some way to do it will HTML??

I tried customizing the announcements portal block but it interferrs with the announcement settings in the proportal page settings...here is the original code:

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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<?php
if (!defined("IN_PORTAL")) {
	die("<div style=\"border:1px solid #CC0000; padding:3px; margin:0; font-family:Tahoma; width:250px; font-size:12px;\"><strong>Error:</strong> This file cannot be viewed directly!</div>");
}
 
// Get latest news announcements
// First validate announcement fids:
$announcementsfids = explode(',', $proportal->settings['announcementsfid']);
if(is_array($announcementsfids))
{
	foreach($announcementsfids as $fid)
	{
		$fid_array[] = intval($fid);
	}
	$announcementsfids = implode(',', $fid_array);
}
// And get them!
$query = $db->simple_select("forums", "*", "fid IN (".$announcementsfids.")");
while($forumrow = $db->fetch_array($query))
{
    $forum[$forumrow['fid']] = $forumrow;
}

// Let's add pagination
$annnum = $db->fetch_field($db->simple_select('threads', 'COUNT(*) AS annnum', "fid IN (".$proportal->settings['announcementsfid'].") AND visible='1' AND closed NOT LIKE 'moved|%'"), 'annnum');
$pagenum = intval($mybb->input['page']);
$totalpage = ceil($annnum / $proportal->settings['numannouncements']);
if($pagenum < 1 || !$pagenum || $pagenum > $totalpage){ $pagenum = 1; }
$multipage = multipage($annnum, $proportal->settings['numannouncements'], $pagenum, $mybb->settings['bburl'].'/portal.php');

$pids = '';
$tids = '';
$comma = '';
$query = $db->query("
	SELECT p.pid, p.message, p.tid
	FROM ".TABLE_PREFIX."posts p
	LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
	WHERE t.fid IN (".$announcementsfids.") AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.firstpost=p.pid
	ORDER BY t.dateline DESC 
	LIMIT ".(($pagenum-1)*$proportal->settings['numannouncements']).", ".$proportal->settings['numannouncements']
);
while($getid = $db->fetch_array($query))
{
	$pids .= ",'{$getid['pid']}'";
	$tids .= ",'{$getid['tid']}'";
	$posts[$getid['tid']] = $getid;
}
$pids = "pid IN(0{$pids})";
// Now lets fetch all of the attachments for these posts
$query = $db->simple_select("attachments", "*", $pids);
while($attachment = $db->fetch_array($query))
{
	$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
}

if(is_array($forum))
{
	foreach($forum as $fid => $forumrow)
	{
		$forumpermissions[$fid] = forum_permissions($fid);
	}
}

$icon_cache = $cache->read("posticons");

$announcements = '';
$query = $db->query("
	SELECT t.*, t.username AS threadusername, u.username, u.avatar, u.avatardimensions
	FROM ".TABLE_PREFIX."threads t
	LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
	WHERE t.fid IN (".$announcementsfids.") AND t.tid IN (0{$tids}) AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
	ORDER BY t.dateline DESC
	LIMIT 0, ".$proportal->settings['numannouncements']
);
while($announcement = $db->fetch_array($query))
{
	$announcement['message'] = $posts[$announcement['tid']]['message'];
	$announcement['pid'] = $posts[$announcement['tid']]['pid'];
	$announcement['threadlink'] = get_thread_link($announcement['tid']);
	
	if($announcement['uid'] == 0)
	{
		$profilelink = htmlspecialchars_uni($announcement['threadusername']);
	}
	else
	{
		$profilelink = build_profile_link($announcement['username'], $announcement['uid']);
	}
	
	if(!$announcement['username'])
	{
		$announcement['username'] = $announcement['threadusername'];
	}
	$announcement['subject'] = htmlspecialchars_uni($parser->parse_badwords($announcement['subject']));
	if($announcement['icon'] > 0 && $icon_cache[$announcement['icon']])
	{
		$icon = $icon_cache[$announcement['icon']];
		$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
	}
	else
	{
		$icon = "&nbsp;";
	}
	if($announcement['avatar'] != '')
	{
		$avatar_dimensions = explode("|", $announcement['avatardimensions']);
		if($avatar_dimensions[0] && $avatar_dimensions[1])
		{
			list($max_width, $max_height) = explode("x", my_strtolower("35x35"));
			if($avatar_dimensions[0] > $max_width || $avatar_dimensions[1] > $max_height)
			{
				require_once MYBB_ROOT."inc/functions_image.php";
				$scaled_dimensions = scale_image($avatar_dimensions[0], $avatar_dimensions[1], $max_width, $max_height);
				$ann_avatar_width_height = "width=\"{$scaled_dimensions['width']}\" height=\"{$scaled_dimensions['height']}\"";
			}
			else
			{
				$ann_avatar_width_height = "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\"";	
			}
		}
		if (!stristr($announcement['avatar'], 'http://'))
		{
			$announcement['avatar'] = $mybb->settings['bburl'] . '/' . $announcement['avatar'];
		}		
		$avatar = "<img src=\"{$announcement['avatar']}\" alt=\"\" {$ann_avatar_width_height} />";
	}
	else
	{
		$avatar = '';
	}
	$anndate = my_date($mybb->settings['dateformat'], $announcement['dateline']);
	$anntime = my_date($mybb->settings['timeformat'], $announcement['dateline']);

	if($announcement['replies'])
	{
		$numcomments = "- <a href=\"{$mybb->settings['bburl']}/{$announcement['threadlink']}\"><strong>{$announcement['replies']}</strong> {$lang->replies}</a>";
	}
	else
	{
		$numcomments = "- {$lang->no_replies}";
		$lastcomment = '';
	}
	
	$views = "<strong>{$announcement['views']}</strong> {$lang->latest_threads_views}";
	
	$plugins->run_hooks("pro_portal_announcement");

	$parser_options = array(
		"allow_html" => $forum[$announcement['fid']]['allowhtml'],
		"allow_mycode" => $forum[$announcement['fid']]['allowmycode'],
		"allow_smilies" => $forum[$announcement['fid']]['allowsmilies'],
		"allow_imgcode" => $forum[$announcement['fid']]['allowimgcode'],
		"filter_badwords" => 1
	);
	if($announcement['smilieoff'] == 1)
	{
		$parser_options['allow_smilies'] = 0;
	}

	$message = $parser->parse_message($announcement['message'], $parser_options);
	// Cut the message and place a read more link if the related option is enabled
	if($proportal->settings['annmessagelength'] > "0")
	{
		$message = substr($message, 0, $proportal->settings['annmessagelength']);
		$message = $message."...<br /><a href=\"".$mybb->settings['bburl']."/".$announcement['threadlink']."\">".$lang->messagemore."</a>";
	}
	
	if(is_array($attachcache[$announcement['pid']]))
	{ // This post has 1 or more attachments
		$validationcount = 0;
		$id = $announcement['pid'];
		foreach($attachcache[$id] as $aid => $attachment)
		{
			if($attachment['visible'])
			{ // There is an attachment thats visible!
				$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
				$attachment['filesize'] = get_friendly_size($attachment['filesize']);
				$ext = get_extension($attachment['filename']);
				if($ext == "jpeg" || $ext == "gif" || $ext == "bmp" || $ext == "png" || $ext == "jpg")
				{
					$isimage = true;
				}
				else
				{
					$isimage = false;
				}
				$attachment['icon'] = get_attachment_icon($ext);
				// Support for [attachment=id] code
				if(stripos($message, "[attachment=".$attachment['aid']."]") !== false)
				{
					if($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != '')
					{ // We have a thumbnail to show (and its not the "SMALL" enough image
						eval("\$attbit = \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";");
					}
					elseif($attachment['thumbnail'] == "SMALL" && $forumpermissions[$announcement['fid']]['candlattachments'] == 1)
					{
						// Image is small enough to show - no thumbnail
						eval("\$attbit = \"".$templates->get("postbit_attachments_images_image")."\";");
					}
					else
					{
						// Show standard link to attachment
						eval("\$attbit = \"".$templates->get("postbit_attachments_attachment")."\";");
					}
					$message = preg_replace("#\[attachment=".$attachment['aid']."]#si", $attbit, $message);
				}
				else
				{
					if($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != '')
					{ // We have a thumbnail to show
						eval("\$post['thumblist'] .= \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";");
						if($tcount == 5)
						{
							$thumblist .= "<br />";
							$tcount = 0;
						}
						++$tcount;
					}
					elseif($attachment['thumbnail'] == "SMALL" && $forumpermissions[$announcement['fid']]['candlattachments'] == 1)
					{
						// Image is small enough to show - no thumbnail
						eval("\$post['imagelist'] .= \"".$templates->get("postbit_attachments_images_image")."\";");
					}
					else
					{
						eval("\$post['attachmentlist'] .= \"".$templates->get("postbit_attachments_attachment")."\";");
					}
				}
			}
			else
			{
				$validationcount++;
			}
		}
		if($post['thumblist'])
		{
			eval("\$post['attachedthumbs'] = \"".$templates->get("postbit_attachments_thumbnails")."\";");
		}
		if($post['imagelist'])
		{
			eval("\$post['attachedimages'] = \"".$templates->get("postbit_attachments_images")."\";");
		}
		if($post['attachmentlist'] || $post['thumblist'] || $post['imagelist'])
		{
			eval("\$post['attachments'] = \"".$templates->get("postbit_attachments")."\";");
		}
	}

	eval("\$announcements .= \"".$templates->get("pro_portal_announcement")."\";");
	unset($post);
}
if(!$announcements){ $announcements = "<table cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\">
<tr>
<td class=\"thead\"><strong>{$lang->no_announcement}</strong></td>
</tr>
<tr>
<td class=\"trow2\" valign=\"middle\">{$lang->no_announcement_desc}</td>
</tr>
</table>"; }
$multipage = str_replace('<div class="pagination">', '<div class="pagination" align="center">', $multipage);
echo $announcements.$multipage;
?>


The forum i will be pulling from will be fid=71 but I'm also not sure how to plug that in and bypass the acp settings??


[Image: gallery_2_628_39582.jpg]
(This post was last modified: 01-24-2011 11:35 PM by RocketFoot.)
01-24-2011 09:25 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #2
RE: ProPortal Box
RocketFoot, have you considered using a slider with the slideshow auto turned off? I have something like that on my test board. It doesn't need a block, and you can put HTML in it.

It has pagination which you can style to look like mybb pagination.


[Image: leelink.gif]
MYBB1.6 & XThreads
01-25-2011 12:40 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #3
RE: ProPortal Box
I did think about making a flash box but I want something easy to maintain.  What's your test board url again?  I'll take a look!  Biggrin

[Image: gallery_2_628_39582.jpg]
01-25-2011 01:21 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #4
RE: ProPortal Box
same as before re login and password - link is

http://www.leefish.nl/testfish/


[Image: leelink.gif]
MYBB1.6 & XThreads
01-25-2011 03:24 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #5
RE: ProPortal Box
Ok...I just couldn't remember the link, LOL.

That is nice!  I found one that fit my needs...it is set to manual and has link and comment features so I can display what month the car won and include a link to the hall of fame!  I do like your slider's pagination better though!  Here is a screen cap...I can't make it visible until i have the first COTM winner at the end of january!  (I already have 3 entries so far!  Woot!)


Attached File(s) Thumbnail(s)
   

[Image: gallery_2_628_39582.jpg]
(This post was last modified: 01-25-2011 06:00 AM by RocketFoot.)
01-25-2011 05:59 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #6
RE: ProPortal Box
Glad you could get an easy solution for it Rocketfoot.

maybe you should change the colour on the resizer bar to fit a bit more nicely with your board?

On that topic, what was the fix again for resize in pro_portal?


[Image: leelink.gif]
MYBB1.6 & XThreads
01-25-2011 06:44 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #7
RE: ProPortal Box
It won't have the resize bar when I use the proper photos...I'll resize with photoshop or something.

I use Fit To Page and I actually had to get G33K to make a few changes to the plugin's js file and then add the resize script to every page that is non default!  He is still trying to make smaller right column pics in my Wiki!  It is a pain.  Are you using Fit To Page?

[Image: gallery_2_628_39582.jpg]
(This post was last modified: 01-25-2011 08:50 AM by RocketFoot.)
01-25-2011 08:49 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #8
RE: ProPortal Box
Well, I might consider it if I could get it to work everywhere Smile

Like on my custom  XThreads showthreads I can't get it to work and the portal has NEVER worked right for me either.


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 01-25-2011 10:54 AM by leefish.)
01-25-2011 10:13 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RocketFoot Offline
Senior Member
****
Posts: 338
Joined: Jul 2010
Post: #9
RE: ProPortal Box
Once I get everything fixed up, I can share the js file and template edits with you as long as the author doesn't mnd...I'll ask him.

[Image: gallery_2_628_39582.jpg]
01-25-2011 10:47 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #10
RE: ProPortal Box
That would be awesome - thank you. My problem on portal was that if I had a portal announcement with a picture link via insert attachment it didn't resize.


[Image: leelink.gif]
MYBB1.6 & XThreads
01-25-2011 10:56 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: