View Single Post
  #6  
Old 06-16-2013, 10:31 AM
Honourable Honourable is offline
 
Join Date: Oct 2010
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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????
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03147 seconds
  • Memory Usage 1,980KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete