Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
Prev Previous Post   Next Post Next
  #3  
Old 07-19-2010, 03:08 PM
dvsDave's Avatar
dvsDave dvsDave is offline
 
Join Date: Nov 2005
Posts: 107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yup! That is what my users want! Anybody have any ideas how to accomplish this?

I think this is the section of the code that needs editing, but I might be wrong:
PHP Code:
    /**
     * This sets up the search parameters, gets the query results,
     * and renders them
     *
     * @param array $config
     * @return string
     */
    
private function getResults($config)
    {
        include_once 
DIR '/includes/functions_misc.php';
        
$search_core vB_Search_Core::get_instance();

        
//first see if we can get cached results
        
$hashkey $this->getHash();
        
$cache_data vB_Cache::instance()->read($hashkeyfalsefalse);
        if (
$cache_data)
        {

            
//If there are no id's, we're done.
            
if (empty($cache_data['ids']))
            {
                return 
false;
            }

            
$controller vB_Search_Core::get_instance()->get_search_type_from_id($config['contenttypeid']);

            if (
method_exists($controller'create_array'))
            {
                
$results $controller->create_array($cache_data['ids']);
            }
            else if(
method_exists($controller'create_item'))
            {
                
$results = array();
                foreach (
$cache_data['ids'] as $resultid)
                {
                    
$result $controller->create_item($resultid);
                    if (
$result)
                    {
                        
$results[] = $result;
                    }
                }
            }
            else
            {
                return 
false;
            }
            return array(
'results' => $results'criteria' => $cache_data['criteria']);
        }

        
$rst vB::$vbulletin->db->query_read("SELECT relationid FROM "
        
TABLE_PREFIX "userlist WHERE friend='yes' AND userid = "
        
vB::$vbulletin->userinfo['userid']
        );

        if (!
$rst)
        {
            return 
false;
        }
        
$userids = array();

        while(
$row vB::$vbulletin->db->fetch_row($rst))
        {
            
$userids[] = $row[0];
        }

        
//If there are no friends there's no friend information.
        
if (! count($userids))
        {
            return 
'';
        }

        if (
$config['contenttypeid'] == null)
        {
            
$config['contenttypeid']= array();
        }
        else if (!
is_array($config['contenttypeid']))
        {
            
$config['contenttypeid'] = array($config['contenttypeid']);
        }

        if (!
count($userids))
        {
            new 
vB_Phrase('global''your_friends_list_is_empty');
        }

        
$criteria vB_Search_Core::get_instance()->create_criteria(vB_Search_Core::SEARCH_ADVANCED);
        
$criteria->add_contenttype_filter($config['contenttypeid']);
        
$criteria->set_advanced_typeid($contenttypeid);

        
$criteria->add_userid_filter($useridsfalse);
        
$criteria->set_grouped(vB_Search_Core::GROUP_NO);
        
$timelimit TIMENOW - (86400 $config['days']);
        
$criteria->add_date_filter(vB_Search_Core::OP_GT$timelimit);
        
$criteria->set_sort('dateline''desc');
        
$current_user = new vB_Legacy_CurrentUser();
        
$results vB_Search_Results::create_from_cache($current_user$criteria);

        if (!
$results)
        {
            
$results vB_Search_Results::create_from_criteria($current_user$criteria);
        }

        if (empty(
$results))
        {
            return 
false;
        }

        
$page_results $results->get_page(1$config['count'], 1);
        
//prepare types for render
        
$items_by_type = array();
        foreach (
$page_results as $item)
        {
            
$typeid $item->get_contenttype();

            if (
$typeid)
            {
                
$items_by_type[$typeid][] =  $item;
                
$ids[] = $item->get_id();
            }
        }

        foreach (
$items_by_type as $contenttype => $items)
        {
            
$type vB_Search_Core::get_instance()->get_search_type_from_id($contenttype);
            
$type->prepare_render($results->get_user(), $items);

        }

        
vB_Cache::instance()->write($hashkey, array('ids' => $ids,
            
'criteria' =>$criteria), $this->cache_ttl,
                
'widget_config_' $this->widget->getId());

        return array(
'results' => $page_results'criteria' => $criteria);
    } 
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05356 seconds
  • Memory Usage 2,460KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadedmode.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete