Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

[ITech] [AJAX] Inferno Top X Stats v1.0.1


wareczek

Rekomendowane odpowiedzi

Mam problem z modyfikacją [iTech] [AJAX] Inferno Top X Stats v1.0.1.

Chciałem zakodować, na wzór tutorialu Pogrubione nieczytane tematy, żeby najnowsze tematy, w których mamy nieprzeczytane posty, były pogrubiane. Walczyłem z kodem dwie godziny i już mi się odechciało, bo nic nie działa :)

Pomocy :)

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Nie będę analizować całego kodu tego moda, ale jeśli dasz to co robiłeś/próbowałeś to może coś wymyślę. :)

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

Zmieniona funkcja fetch_latest_replies($read_perms) w pliku sources/lib/inferno_topxstats.php

function fetch_latest_replies($read_perms)
{
	$latest_replies = '';

	$this->ipsclass->DB->simple_construct(
		array(
			'select'	=> 't.title, t.tid, t.last_poster_name, t.last_poster_id, t.views, t.posts as replies, m.mgroup, t.last_post as date, t.forum_id',
			'from'		=> 'topics t left join ' . SQL_PREFIX . 'members m on (m.id = t.last_poster_id)',
			'where'		=> 't.forum_id in (' . $read_perms . ')',
			'order'		=> 't.last_post desc',
			'limit'		=> array(0, $this->ipsclass->vars['_inferno_topxstats_show'])
		)
	);
	$this->ipsclass->DB->simple_exec();

	$last_time = 0;

	while ($thread = $this->ipsclass->DB->fetch_row())
	{
		$thread['replies']			= $this->ipsclass->do_number_format($thread['replies']);
		$thread['views']			= $this->ipsclass->do_number_format($thread['views']);
		$thread['title']			= $this->ipsclass->txt_truncate($thread['title'], $this->ipsclass->vars['_inferno_topxstats_titles']);
		$thread['last_poster_name']	= $this->ipsclass->make_name_formatted($thread['last_poster_name'], $thread['mgroup']);
		$thread['last_post']		= $thread['date'];
		$thread['date']				= $this->ipsclass->get_date($thread['date'], 'SHORT');

		if ( $thread['last_post'] )
		{
			if ( isset($thread['db_read']) AND $thread['db_read'] )
			{
				$last_time = $thread['db_read'];
			}
			else if ( $this->db_row['marker_last_cleared'] )
			{
				$last_time = $this->db_row['marker_last_cleared'];
			}
			else
			{
				$last_time = 1;
			}
		}

		if($last_time && ($thread['last_post'] > $last_time))
		{
			$thread['title'] = "<b>".$thread['title']."</b>";
		}

		$latest_replies .= $this->ipsclass->compiled_templates[$this->skingroup]->inferno_topxstats_latestreply($thread);
	}

	return $latest_replies;
}

Zmienna $thread['db_read'] nie jest zdefiniowana, a jak chce to zdefiniować jakoś podobnie jak jest w sources/action_public/forums.php to się wykrzacza, podobnie z $this->db_row['marker_last_cleared']

Odnośnik do komentarza
Udostępnij na innych stronach

Kod funkcji od autora:

function fetch_latest_replies($read_perms)
{
$latest_replies = '';

$this->ipsclass->DB->simple_construct(
	array(
		'select'	=> 't.title, t.tid, t.last_poster_name, t.last_poster_id, t.views, t.posts as replies, m.mgroup, t.last_post as date',
		'from'		=> 'topics t left join ' . SQL_PREFIX . 'members m on (m.id = t.last_poster_id)',
		'where'		=> 't.forum_id in (' . $read_perms . ')',
		'order'		=> 't.last_post desc',
		'limit'		=> array(0, $this->ipsclass->vars['_inferno_topxstats_show'])
	)
);
$this->ipsclass->DB->simple_exec();

while ($thread = $this->ipsclass->DB->fetch_row())
{
	$thread['replies']			= $this->ipsclass->do_number_format($thread['replies']);
	$thread['views']			= $this->ipsclass->do_number_format($thread['views']);
	$thread['title']			= $this->ipsclass->txt_truncate($thread['title'], $this->ipsclass->vars['_inferno_topxstats_titles']);
	$thread['last_poster_name']	= $this->ipsclass->make_name_formatted($thread['last_poster_name'], $thread['mgroup']);
	$thread['date']				= $this->ipsclass->get_date($thread['date'], 'SHORT');

	$latest_replies .= $this->ipsclass->compiled_templates[$this->skingroup]->inferno_topxstats_latestreply($thread);
}

return $latest_replies;
}

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Jak najprościej powiedzieć, streścić co napisałem Wareczkowi na GG -> nie warto tego kodzić. Efekt nie jest współmierny do poniesionego na to czasu gdyby doszło do kodowania, a i serwera szkoda by mielił niemiłosiernie te posty.

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.