Hey Lynne,
I really tried my best yet I couldnt make yet work
you can check it here the code so far
PHP Code:
if (isset($vbulletin->GPC['tab']))
{
$selected_tab = $vbulletin->GPC['tab'];
}
$blockinfo['title'] = "الصور";
$blockid = "photos";
$taburl = $memberurl = fetch_seo_url('member', $prepared) . "&tab=photos#photos";
$templater = vB_Template::create('memberinfo_tab');
$templater->register('selected_tab', $selected_tab);
$templater->register('relpath', $relpath);
$templater->register('blockinfo', $blockinfo);
$templater->register('blockid', $blockid);
$templater->register('taburl', $taburl);
$template_hook['profile_tabs_last'] .= $templater->render();
// ### Your code to fill the tab ###
// Don't forget you need to register any variables for use in templates
function prepare_output($id = '', $options = array())
{
global $show, $vbphrase;
if (is_array($options))
{
$options = array_merge($this->option_defaults, $options);
}
else
{
$options = $this->option_defaults;
}
require_once(DIR . '/includes/functions_album.php');
$state = array('public');
if (can_view_private_albums($this->profile->userinfo['userid']))
{
$state[] = 'private';
}
if (can_view_profile_albums($this->profile->userinfo['userid']))
{
$state[] = 'profile';
}
if (!$this->profile->prepared['myprofile'])
{
if (!can_moderate(0, 'canmoderatepictures'))
{
$sql = "AND album.visible > 0";
}
else
{
$sql = "AND (album.visible > 0 OR album.moderation > 0)";
}
}
else
{
$sql = "";
}
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('member_profileblock_album_query')) ? eval($hook) : false;
$albums = $this->registry->db->query_read_slave("
SELECT album.*,
a.attachmentid, album.moderation,
fd.thumbnail_dateline, fd.thumbnail_width, fd.thumbnail_height, IF(fd.thumbnail_filesize > 0, 1, 0) AS hasthumbnail
$hook_query_fields
FROM " . TABLE_PREFIX . "album AS album
LEFT JOIN " . TABLE_PREFIX . "attachment AS a ON (album.coverattachmentid = a.attachmentid)
LEFT JOIN " . TABLE_PREFIX . "filedata AS fd ON (fd.filedataid = a.filedataid)
$hook_query_joins
WHERE
album.userid = ". $this->profile->userinfo['userid'] . "
AND
album.state IN ('" . implode("', '", $state) . "')
$sql
$hook_query_where
ORDER BY album.lastpicturedate DESC
");
$albumbits = '';
while ($album = $this->registry->db->fetch_array($albums))
{
$album['picturedate'] = vbdate($this->registry->options['dateformat'], $album['lastpicturedate'], true);
$album['picturetime'] = vbdate($this->registry->options['timeformat'], $album['lastpicturedate']);
$album['title_html'] = fetch_word_wrapped_string(fetch_censored_text($album['title']));
$album['coverdimensions'] = ($album['thumbnail_width'] ? "width=\"$album[thumbnail_width]\" height=\"$album[thumbnail_height]\"" : '');
if ($album['moderation'])
{
$album['moderatedcount'] = vb_number_format($album['moderation']);
$show['moderated'] = true;
}
else
{
$show['moderated'] = false;
}
$templater = vB_Template::create('memberinfo_block_photos');
$templater->register('album', $album);
$albumbits .= $templater->render();
}
$photos_tab_content = $albumbits;
}
$templater = vB_Template::create('memberinfo_block_photos');
$templater->register('selected_tab', $selected_tab);
$templater->register('photos_tab_content', $photos_tab_content);
$template_hook['profile_tabs'] .= $templater->render();
hope if you can help me
as I removed the LIMIT from the sql query
so I registered the array contain everything
added to the templates that already created and delcared
yet it doesnt display the albums????
--------------- Added [DATE]1371390920[/DATE] at [TIME]1371390920[/TIME] ---------------
what I have don so far
PHP Code:
if (isset($vbulletin->GPC['tab']))
{
$selected_tab = $vbulletin->GPC['tab'];
}
$blockinfo['title'] = "الصور";
$blockid = "photos";
$taburl = $memberurl = fetch_seo_url('member', $prepared) . "&tab=photos#photos";
$templater = vB_Template::create('memberinfo_tab');
$templater->register('selected_tab', $selected_tab);
$templater->register('relpath', $relpath);
$templater->register('blockinfo', $blockinfo);
$templater->register('blockid', $blockid);
$templater->register('taburl', $taburl);
$template_hook['profile_tabs_last'] .= $templater->render();
// ### Your code to fill the tab ###
// Don't forget you need to register any variables for use in templates
global $show, $vbphrase;
require_once(DIR . '/includes/functions_album.php');
$state = array('public');
if (can_view_private_albums($this->profile->userinfo['userid']))
{
$state[] = 'private';
}
if (can_view_profile_albums($this->profile->userinfo['userid']))
{
$state[] = 'profile';
}
if (!$this->profile->prepared['myprofile'])
{
if (!can_moderate(0, 'canmoderatepictures'))
{
$sql = "AND album.visible > 0";
}
else
{
$sql = "AND (album.visible > 0 OR album.moderation > 0)";
}
}
else
{
$sql = "";
}
$albums = $this->registry->db->query_read_slave("
SELECT album.*,
a.attachmentid, album.moderation,
fd.thumbnail_dateline, fd.thumbnail_width, fd.thumbnail_height, IF(fd.thumbnail_filesize > 0, 1, 0) AS hasthumbnail
$hook_query_fields
FROM " . TABLE_PREFIX . "album AS album
LEFT JOIN " . TABLE_PREFIX . "attachment AS a ON (album.coverattachmentid = a.attachmentid)
LEFT JOIN " . TABLE_PREFIX . "filedata AS fd ON (fd.filedataid = a.filedataid)
$hook_query_joins
WHERE
album.userid = ". $this->profile->userinfo['userid'] . "
AND
album.state IN ('" . implode("', '", $state) . "')
$sql
$hook_query_where
ORDER BY album.lastpicturedate DESC
");
$albumbits = '';
while ($album = $this->registry->db->fetch_array($albums))
{
$album['picturedate'] = vbdate($this->registry->options['dateformat'], $album['lastpicturedate'], true);
$album['picturetime'] = vbdate($this->registry->options['timeformat'], $album['lastpicturedate']);
$album['title_html'] = fetch_word_wrapped_string(fetch_censored_text($album['title']));
$album['coverdimensions'] = ($album['thumbnail_width'] ? "width=\"$album[thumbnail_width]\" height=\"$album[thumbnail_height]\"" : '');
if ($album['moderation'])
{
$album['moderatedcount'] = vb_number_format($album['moderation']);
$show['moderated'] = true;
}
else
{
$show['moderated'] = false;
}
$templater = vB_Template::create('memberinfo_block_photosbit');
$templater->register('album', $album);
$albumbits .= $templater->render();
}
$templater = vB_Template::create('memberinfo_block_photos');
$templater->register('selected_tab', $selected_tab);
$templater->register('albumbits', $albumbits);
$template_hook['profile_tabs'] .= $templater->render();
deleted functions just made straigt away plugin work
also removed
this
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('member_profileblock_alb um_query')) ? eval($hook) : false;
and added the plugin to work in hook
member_profileblock_album_query
so the tab disappeared
????
--------------- Added [DATE]1371391385[/DATE] at [TIME]1371391385[/TIME] ---------------
so far
splitted the plugin into to plugins
once to work in
member_profileblock_album_query
to retrieve all albums
PHP Code:
$albums = $this->registry->db->query_read_slave("
SELECT album.*,
a.attachmentid, album.moderation,
fd.thumbnail_dateline, fd.thumbnail_width, fd.thumbnail_height, IF(fd.thumbnail_filesize > 0, 1, 0) AS hasthumbnail
$hook_query_fields
FROM " . TABLE_PREFIX . "album AS album
LEFT JOIN " . TABLE_PREFIX . "attachment AS a ON (album.coverattachmentid = a.attachmentid)
LEFT JOIN " . TABLE_PREFIX . "filedata AS fd ON (fd.filedataid = a.filedataid)
$hook_query_joins
WHERE
album.userid = ". $this->profile->userinfo['userid'] . "
AND
album.state IN ('" . implode("', '", $state) . "')
$sql
$hook_query_where
ORDER BY album.lastpicturedate DESC
");
$albumbits = '';
while ($album = $this->registry->db->fetch_array($albums))
{
$album['picturedate'] = vbdate($this->registry->options['dateformat'], $album['lastpicturedate'], true);
$album['picturetime'] = vbdate($this->registry->options['timeformat'], $album['lastpicturedate']);
$album['title_html'] = fetch_word_wrapped_string(fetch_censored_text($album['title']));
$album['coverdimensions'] = ($album['thumbnail_width'] ? "width=\"$album[thumbnail_width]\" height=\"$album[thumbnail_height]\"" : '');
$templater = vB_Template::create('memberinfo_block_photosbit');
$templater->register('album', $album);
$albumbits .= $templater->render();
}
$templater = vB_Template::create('memberinfo_block_photos');
$templater->register('albumbits', $albumbits);
and the second to add the tab that contained the albums
PHP Code:
if (isset($vbulletin->GPC['tab']))
{
$selected_tab = $vbulletin->GPC['tab'];
}
$blockinfo['title'] = "الصور";
$blockid = "photos";
$taburl = $memberurl = fetch_seo_url('member', $prepared) . "&tab=photos#photos";
$templater = vB_Template::create('memberinfo_tab');
$templater->register('selected_tab', $selected_tab);
$templater->register('relpath', $relpath);
$templater->register('blockinfo', $blockinfo);
$templater->register('blockid', $blockid);
$templater->register('taburl', $taburl);
$template_hook['profile_tabs_last'] .= $templater->render();
// ### Your code to fill the tab ###
// Don't forget you need to register any variables for use in templates
$templater = vB_Template::create('memberinfo_block_photos');
$templater->register('selected_tab', $selected_tab);
$template_hook['profile_tabs'] .= $templater->render();
which is in hook member_complete
still not displaying the albums????