08-10-2017, 08:21 PM
08-11-2017, 03:35 AM
The gallery is located in it's own tab like on the demo site found on this site.
But you write your own codes to display on your board index.
But you write your own codes to display on your board index.
08-11-2017, 06:03 AM
I'm not a coder so wouldn't know where to start.
12-12-2017, 12:36 AM
(08-11-2017, 03:35 AM)MyBBHacks Wrote: [ -> ]The gallery is located in it's own tab like on the demo site found on this site.
But you can read this amazing Binance review and write your own codes to display on your board index.
I know some basics but I need help. Are there any resources that help you get started with this?
12-12-2017, 11:15 AM
This is the full php code that can be used just modify it to your needs for gallery pro
Code:
require_once MYBB_ROOT."inc/ezgallery.lib.php";
LoadGallerySettings();
// Call you mainpageblock code below
function MainPageBlock($title,$type = 'recent')
{
global $db, $lang, $gallerySettings, $mybb, $settings, $context, $gallerySettings;
$groupsdata = $mybb->user['usergroup'];
if (empty($gallerySettings['gallery_index_images_to_show']))
$gallerySettings['gallery_index_images_to_show'] = 4;
$maxrowlevel = empty($gallerySettings['gallery_set_images_per_row']) ? 4 : $gallerySettings['gallery_set_images_per_row'];
echo '<table cellspacing="0" cellpadding="5" border="0" align="center" width="90%" class="tborder">
<tr class="thead">
<td align="center" colspan="'. $maxrowlevel . '">', $title, '
';
//Check what type it is
$query = "SELECT p.ID_PICTURE, p.commenttotal, p.totalratings, p.rating,
p.filesize, p.views, p.thumbfilename, p.title, p.ID_MEMBER, m.username, mg.namestyle,
p.date, p.description, p.mature, c.view, (p.rating / p.totalratings ) AS ratingaverage , v.ID_PICTURE as unread
FROM ".TABLE_PREFIX."gallery_pic as p
LEFT JOIN ".TABLE_PREFIX."users AS m ON (m.uid = p.ID_MEMBER)
LEFT JOIN ".TABLE_PREFIX."usergroups AS mg ON (m.usergroup = mg.gid)
LEFT JOIN ".TABLE_PREFIX."gallery_usersettings AS s ON (s.ID_MEMBER = m.uid)
LEFT JOIN ".TABLE_PREFIX."gallery_catperm AS c ON (c.ID_GROUP IN ($groupsdata) AND c.ID_CAT = p.ID_CAT)
LEFT JOIN ".TABLE_PREFIX."gallery_log_mark_view AS v ON (p.ID_PICTURE = v.ID_PICTURE AND v.ID_MEMBER = " . $mybb->user['uid'] . " AND v.user_id_cat = p.USER_ID_CAT)
WHERE ((s.private =0 || s.private IS NULL ) AND (s.password = '' || s.password IS NULL ) AND p.USER_ID_CAT !=0 AND p.approved =1) || (p.approved =1 AND p.USER_ID_CAT =0 AND (c.view IS NULL || c.view =1))
GROUP by p.ID_PICTURE ORDER BY ";
switch($type)
{
case 'viewed':
$query .= "p.views DESC LIMIT " . $gallerySettings['gallery_index_images_to_show'];
echo ' <a href="',$mybb->settings['bburl'] . '/ezgallery.php?action=gallery&sa=listall&type=views">',$lang->gallery_stats_listall,'</a>';
break;
case 'mostcomments':
$query .= "p.commenttotal DESC LIMIT " . $gallerySettings['gallery_index_images_to_show'];
echo ' <a href="',$mybb->settings['bburl'] . '/ezgallery.php?action=gallery&sa=listall&type=comments">',$lang->gallery_stats_listall,'</a>';
break;
case 'toprated':
$query .= "ratingaverage DESC, p.totalratings DESC LIMIT " . $gallerySettings['gallery_index_images_to_show'];
echo ' <a href="',$mybb->settings['bburl'] . '/ezgallery.php?action=gallery&sa=listall&type=toprated">',$lang->gallery_stats_listall,'</a>';
break;
case 'recentcomments':
$query = "SELECT max(com.ID_COMMENT) AS lastcomment, p.ID_PICTURE, p.commenttotal, p.totalratings, p.rating, p.filesize, p.views,
p.thumbfilename, p.title, p.ID_MEMBER, m.username, mg.namestyle, p.date,
p.description, p.mature, c.view, v.ID_PICTURE as unread
FROM (".TABLE_PREFIX."gallery_pic as p, ".TABLE_PREFIX."gallery_comment as com)
LEFT JOIN ".TABLE_PREFIX."users AS m ON (m.uid = p.ID_MEMBER)
LEFT JOIN ".TABLE_PREFIX."usergroups AS mg ON (m.usergroup = mg.gid)
LEFT JOIN ".TABLE_PREFIX."gallery_usersettings AS s ON (s.ID_MEMBER = m.uid)
LEFT JOIN ".TABLE_PREFIX."gallery_catperm AS c ON (c.ID_GROUP IN ($groupsdata) AND c.ID_CAT = p.ID_CAT)
LEFT JOIN ".TABLE_PREFIX."gallery_log_mark_view AS v ON (p.ID_PICTURE = v.ID_PICTURE AND v.ID_MEMBER = " . $mybb->user['uid'] . " AND v.user_id_cat = p.USER_ID_CAT)
WHERE com.ID_PICTURE = p.ID_PICTURE AND (((s.private =0 || s.private IS NULL ) AND (s.password = '' || s.password IS NULL ) AND p.USER_ID_CAT !=0 AND p.approved =1) || (p.approved =1 AND p.USER_ID_CAT =0 AND (c.view IS NULL || c.view =1)))
GROUP by p.ID_PICTURE ORDER BY ";
$query .= "lastcomment DESC LIMIT " . $gallerySettings['gallery_index_images_to_show'];
echo ' <a href="',$mybb->settings['bburl'] . '/ezgallery.php?action=gallery&sa=listall&type=recentcomments">',$lang->gallery_stats_listall,'</a>';
break;
case 'random':
$query .= "RAND() LIMIT " . $gallerySettings['gallery_index_images_to_show'];
echo ' <a href="',$mybb->settings['bburl'] . '/ezgallery.php?action=gallery&sa=listall&type=random">',$lang->gallery_stats_listall,'</a>';
break;
default:
$query .= "p.ID_PICTURE DESC LIMIT " . $gallerySettings['gallery_index_images_to_show'];
echo ' <a href="',$mybb->settings['bburl'] . '/ezgallery.php?action=gallery&sa=listall&type=recent">',$lang->gallery_stats_listall,'</a>';
break;
}
echo '</td>
</tr>';
$smfgalleryBlockCache = array();
$dbresult = $db->query($query);
while($row = $db->fetch_array($dbresult))
{
$smfgalleryBlockCache[] = $row;
}
$db->free_result($dbresult);
$rowlevel = 0;
if(count($smfgalleryBlockCache) > 0)
foreach($smfgalleryBlockCache as $row)
{
if ($rowlevel == 0)
echo '<tr class="trow2">';
if ($row['mature'] == 1)
{
if (CanViewMature() == false)
$row['thumbfilename'] = 'mature.gif';
}
echo '<td align="center"><a href="' . $mybb->settings['bburl'] . '/ezgallery.php?action=view&id=' . $row['ID_PICTURE'] . '"><img src="' . $gallerySettings['gallery_url'] . $row['thumbfilename'] . '" alt="" /></a><br />';
// Unread
if (empty($row['unread'])) // && $gallerySettings['gallery_set_show_newicon'] == true)
{
echo '<img src="' . $gallerySettings['gallery_url'] . 'icons/new.png" alt="" /><br />';
}
echo '<span class="smalltext">';
if ($gallerySettings['gallery_set_img_title'])
{
echo '<a href="' . $mybb->settings['bburl'] . '/ezgallery.php?action=view&id=' . $row['ID_PICTURE'] . '">' . $row['title'] . '</a><br />';
}
if (!empty($gallerySettings['gallery_set_t_rating']))
{
if ($gallerySettings['gallery_points_instead_stars'])
echo $lang->gallery_form_rating . $row['rating'] . '<br />';
else
echo $lang->gallery_form_rating . GetStarsByPrecent(($row['totalratings'] != 0) ? ($row['rating'] / ($row['totalratings']* 5) * 100) : 0) . '<br />';
}
if(!empty($gallerySettings['gallery_set_t_views']))
echo $lang->gallery_text_views . $row['views'] . '<br />';
if(!empty($gallerySettings['gallery_set_t_filesize']))
echo $lang->gallery_text_filesize . gallery_format_size($row['filesize'], 2) . '<br />';
if(!empty($gallerySettings['gallery_set_t_date']))
echo $lang->gallery_text_date . timeformat($row['date']) . '<br />';
if(!empty($gallerySettings['gallery_set_t_comment']))
echo $lang->gallery_text_comments . ' (<a href="' . $mybb->settings['bburl'] . '/ezgallery.php?action=view&id=' . $row['ID_PICTURE'] . '">' . $row['commenttotal'] . '</a>)<br />';
if(!empty($gallerySettings['gallery_set_t_username']))
{
if ($row['username'] != '')
echo $lang->gallery_text_by . ' <a href="' . $mybb->settings['bburl'] . '/member.php?action=profile&uid=' . $row['ID_MEMBER'] . '">' . str_replace('{username}',$row['username'], $row['namestyle']) . '</a><br />';
else
echo $lang->gallery_text_by . ' ' . $lang->gallery_guest . '<br />';
}
echo '</span></td>';
if($rowlevel < ($maxrowlevel-1))
$rowlevel++;
else
{
echo '</tr>';
$rowlevel = 0;
}
}
if($rowlevel != 0)
{
echo '</tr>';
}
echo '
</table><br />';
}
04-03-2018, 02:59 AM
Thanks for the reply
Where do I add this code to please?
Thanks
Mark
Where do I add this code to please?
Thanks
Mark