SnippetsComo solucionar conflicto entre phpBB SEO y Topic Solved

Ese foro es para snippets, pequeños mods, no suficiente grandes para ser Mods

Moderators: Carlos, Soporte en MODs, Soporte en phpBB

Previous topicNext topic

0
No votes
 
Total votes: 0

User avatar
Carlos
Admin
Admin
Posts: 159
Joined: 17 Jun 2012 01:01:50
Bandera: Mexico
Nombre real: Carlos

Como solucionar conflicto entre phpBB SEO y Topic Solved

Post by Carlos »

Hola, el dia de hoy les enseñare como solucionar este conflicto entre SEO y Topic Solved
Solucion creada por leviatan21

[openfile]Abrir: viewtopic.php[/openfile]
[findcode]Buscar:

Code: Select all

// www.phpBB-SEO.com SEO TOOLKIT BEGIN -> Zero dupe
$phpbb_seo->seo_opt['zero_dupe']['start'] = $phpbb_seo->seo_chk_start( $start, $config['posts_per_page'] );
if (!empty($phpbb_seo->seo_opt['url_rewrite'])) {
	$phpbb_seo->seo_path['canonical'] = $phpbb_seo->drop_sid(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"));
}
if ( $post_id && !$view && !$phpbb_seo->set_do_redir_post()) {
	$phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
		'p' => array('val' => $post_id, 'keep' => true, 'force' => true, 'hash' => "p$post_id"),
		'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => !empty($highlight_match)),
	);
} else {
	$seo_watch = request_var('watch', '');
	$seo_unwatch = request_var('unwatch', '');
	$seo_bookmark = request_var('bookmark', 0);
	$keep_watch = (boolean) ($seo_watch == 'topic' && $user->data['is_registered']);
	$keep_unwatch = (boolean) ($seo_unwatch == 'topic' && $user->data['is_registered']);
	$keep_hash = (boolean) ($keep_watch || $keep_unwatch || $seo_bookmark);
	$seo_uid = max(0, request_var('uid', 0));
	$phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
		'uid' => array('val' => $seo_uid, 'keep' => (boolean) ($keep_hash && $seo_uid)),
		'f' => array('val' => $forum_id, 'keep' => true, 'force' => true),
		't' => array('val' => $topic_id, 'keep' => true, 'force' => true, 'hash' => $post_id ? "p$post_id" : ''),
		'p' => array('val' => $post_id, 'keep' =>  ($post_id && $view == 'show' ? true : false), 'hash' => "p$post_id"),
		'watch' => array('val' => $seo_watch, 'keep' => $keep_watch),
		'unwatch' => array('val' => $seo_unwatch, 'keep' => $keep_unwatch),
		'bookmark' => array('val' => $seo_bookmark, 'keep' => (boolean) ($user->data['is_registered'] && $config['allow_bookmarks'] && $seo_bookmark)),
		'start' => array('val' => $phpbb_seo->seo_opt['zero_dupe']['start'], 'keep' => true, 'force' => true),
		'hash' => array('val' => request_var('hash', ''), 'keep' => $keep_hash),
		'st' => array('val' => $sort_days, 'keep' => true),
		'sk' => array('val' => $sort_key, 'keep' => true),
		'sd' => array('val' => $sort_dir, 'keep' => true),
		'view' => array('val' => $view, 'keep' => $view == 'print' ? (boolean) $auth->acl_get('f_print', $forum_id) : (($view == 'viewpoll' || $view == 'show') ? true : false)),
		'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => (boolean) !(!$user->data['is_registered'] && $phpbb_seo->seo_opt['rem_hilit'])),
	);
	if ($phpbb_seo->seo_opt['zero_dupe']['redir_def']['bookmark']['keep']) { // Prevent unessecary redirections
		// Note : bookmark, watch and unwatch cases could just not be handled by the zero dupe (no redirect at all when used),
		// but the handling as well acts as a poweful security shield so, it's worth it ;)
		unset($phpbb_seo->seo_opt['zero_dupe']['redir_def']['start']);
	}
}
$phpbb_seo->seo_chk_dupe();
// www.phpBB-SEO.com SEO TOOLKIT END -> Zero dupe
Reemplazar por:

Code: Select all

    /// www.phpBB-SEO.com SEO TOOLKIT BEGIN -> Zero dupe
// Topic solved FIX - START
if (!$solved_id && !$unsolved)
{
// Topic solved FIX - END
$phpbb_seo->seo_opt['zero_dupe']['start'] = $phpbb_seo->seo_chk_start( $start, $config['posts_per_page'] );
if (!empty($phpbb_seo->seo_opt['url_rewrite'])) {
	$phpbb_seo->seo_path['canonical'] = $phpbb_seo->drop_sid(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"));
}
if ( $post_id && !$view && !$phpbb_seo->set_do_redir_post()) {
	$phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
		'p' => array('val' => $post_id, 'keep' => true, 'force' => true, 'hash' => "p$post_id"),
		'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => !empty($highlight_match)),
	);
} else {
	$seo_watch = request_var('watch', '');
	$seo_unwatch = request_var('unwatch', '');
	$seo_bookmark = request_var('bookmark', 0);
	$keep_watch = (boolean) ($seo_watch == 'topic' && $user->data['is_registered']);
	$keep_unwatch = (boolean) ($seo_unwatch == 'topic' && $user->data['is_registered']);
	$keep_hash = (boolean) ($keep_watch || $keep_unwatch || $seo_bookmark);
	$seo_uid = max(0, request_var('uid', 0));
	$phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
		'uid' => array('val' => $seo_uid, 'keep' => (boolean) ($keep_hash && $seo_uid)),
		'f' => array('val' => $forum_id, 'keep' => true, 'force' => true),
		't' => array('val' => $topic_id, 'keep' => true, 'force' => true, 'hash' => $post_id ? "p$post_id" : ''),
		'p' => array('val' => $post_id, 'keep' =>  ($post_id && $view == 'show' ? true : false), 'hash' => "p$post_id"),
		'watch' => array('val' => $seo_watch, 'keep' => $keep_watch),
		'unwatch' => array('val' => $seo_unwatch, 'keep' => $keep_unwatch),
		'bookmark' => array('val' => $seo_bookmark, 'keep' => (boolean) ($user->data['is_registered'] && $config['allow_bookmarks'] && $seo_bookmark)),
		'start' => array('val' => $phpbb_seo->seo_opt['zero_dupe']['start'], 'keep' => true, 'force' => true),
		'hash' => array('val' => request_var('hash', ''), 'keep' => $keep_hash),
		'st' => array('val' => $sort_days, 'keep' => true),
		'sk' => array('val' => $sort_key, 'keep' => true),
		'sd' => array('val' => $sort_dir, 'keep' => true),
		'view' => array('val' => $view, 'keep' => $view == 'print' ? (boolean) $auth->acl_get('f_print', $forum_id) : (($view == 'viewpoll' || $view == 'show') ? true : false)),
		'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => (boolean) !(!$user->data['is_registered'] && $phpbb_seo->seo_opt['rem_hilit'])),
	);
	if ($phpbb_seo->seo_opt['zero_dupe']['redir_def']['bookmark']['keep']) { // Prevent unessecary redirections
		// Note : bookmark, watch and unwatch cases could just not be handled by the zero dupe (no redirect at all when used),
		// but the handling as well acts as a poweful security shield so, it's worth it ;)
		unset($phpbb_seo->seo_opt['zero_dupe']['redir_def']['start']);
	}
}
$phpbb_seo->seo_chk_dupe();
// Topic solved FIX - START
}
// Topic solved FIX - END
// www.phpBB-SEO.com SEO TOOLKIT END -> Zero dupe
[/findcode]

ya con eso debe funcionar el mod correctamente!.

Saludos
Equipo de phpBBMexico
[mod=Carlos]Recuerda poner tus datos de soporte antes de pedir ayuda! Asi nos evitamos dramas y te ayudamos rapido [/mod]
Previous topicNext topic

Return to “Snippets”