IPB последните 10 теми в Асистента
Така в този урок ще ви покажа как да си направите в IPB форума последните ви 10 теми да се записват в my assistence ето една снимка за да имате представа за какво говоря

Нека да започваме:

Намерете в sources/sql/mysql_queries.php

function search_get_last_ten( $a )
{
return "SELECT p.*, t.*, t.posts as topic_posts, t.title as topic_title, m.*, me.*
FROM ".SQL_PREFIX."posts p
LEFT JOIN ".SQL_PREFIX."topics t ON (t.tid=p.topic_id)
LEFT JOIN ".SQL_PREFIX."members m ON (m.id=p.author_id)
LEFT JOIN ".SQL_PREFIX."member_extra me ON (me.id=p.author_id)
WHERE p.queued=0 AND t.forum_id IN({$a['forums']}) AND p.author_id={$a['mid']}
ORDER BY post_date DESC
LIMIT 0,10";
}

и добавете след него



function search_get_last_ten_topics( $a )
{
return "SELECT t.*
FROM ".SQL_PREFIX."topics t
WHERE t.forum_id IN({$a['forums']}) AND t.starter_id={$a['mid']}
ORDER BY t.tid DESC
LIMIT 0,10";
}


Намерете в sources/action_public/search.php

case 'lastten':
$this->get_last_ten();
break;

и добавете след

Тcase 'lasttentopics':
$this->get_last_ten_topics();
break;

Намерете в sources/action_public/search.php

/*-------------------------------------------------------------------------*/
// Get all replies
/*-------------------------------------------------------------------------*/


и добавете след


/*-------------------------------------------------------------------------*/
// Last 10 topics
/*-------------------------------------------------------------------------*/

function get_last_ten_topics()
{
//-----------------------------------------
// Do we have flood control enabled?
//-----------------------------------------

if ($this->ipsclass->member['g_search_flood'] > 0)
{
$flood_time = time() - $this->ipsclass->member['g_search_flood'];

// Get any old search results..

$this->ipsclass->DB->simple_construct( array( 'select' => 'id',
'from' => 'search_results',
'where' => "(member_id='".$this->ipsclass->member['id']."' OR ip_address='".$this->ipsclass->input['IP_ADDRESS']."') AND search_date > '$flood_time'" ) );
$this->ipsclass->DB->simple_exec();

if ( $this->ipsclass->DB->get_num_rows() )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_flood', 'EXTRA' => $this->ipsclass->member['g_search_flood']) );
}
}

$this->ipsclass->input['forums'] = 'all';

$forums = $this->get_searchable_forums();

$mid = $this->ipsclass->member['id'];

//-----------------------------------------
// Do we have any forums to search in?
//-----------------------------------------

if ($forums == "")
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_forum') );
}

//-----------------------------------------
// Cache query
//-----------------------------------------

$this->ipsclass->DB->cache_add_query( 'search_get_last_ten_topics', array( 'mid' => $mid, 'forums' => $forums ) );

$query_to_cache = $this->ipsclass->DB->cur_query;
$this->ipsclass->DB->flush_query();

//-----------------------------------------
// If we are still here, store the data into the database...
//-----------------------------------------

$unique_id = md5(uniqid(microtime(),1));

$this->ipsclass->DB->do_insert( 'search_results', array (
'id' => $unique_id,
'search_date' => time(),
'post_max' => 10,
'sort_key' => $this->sort_key,
'sort_order' => $this->sort_order,
'member_id' => $this->ipsclass->member['id'],
'ip_address' => $this->ipsclass->input['IP_ADDRESS'],
'query_cache' => $query_to_cache
) );

$this->ipsclass->boink_it( $this->ipsclass->base_url."act=Search&nav=au&CODE=show&searchid=$unique_id&search_in=topics&result_type=topics" );
}


Намерете в cache/lang_cache/en/lang_buddy.php
'sm_my_last_posts' => "My last 10 posts",
и добавете след
'sm_my_last_topics' => "My last 10 topics",

Отворете Admin CP > Look & Feel > Select your skin > Edit Template HTML
изберете "MyAssistant"
цъкнете "xml_showme"
Намерете:

<br /> · <a href="{$this->ipsclass->base_url}act=Search&CODE=lastten">{$this->ipsclass->lang['sm_my_last_posts']}</a>


и добавете след

<br /> · <a href="{$this->ipsclass->base_url}act=Search&CODE=lasttentopics">{$this->ipsclass->lang['sm_my_last_topics']}</a>



Урока е само преведен от мен от http://invisionize.com/


/ Трябва да сте регистриран за да напишете коментар /