Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Bad profile link in archive mode, SEO off [C-Michael83]
#1
MyBB 1.4.2
Profile links in archive mode target to '/archive/member.php' when SEO-links are off. Although I have SEO off archive version uses it (e.g. http://forum.pcformat.pl/archive/index.p...12639.html), so links "../member.php" are relative to "/archive/".
In file functions.php FIND:
		if(IN_ARCHIVE == 1)
		{
			global $mybb;
			
			if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1))
			{
				return "<a href=\"../../".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
			}
			
			return "<a href=\"../".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
		}
Replace with:
		if(IN_ARCHIVE == 1)
		{
			global $mybb;
			
			// KK: bad_profile_link_in_archive_without_seo - always return '../../'.
				return "<a href=\"../../".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
		}
www.kozik.net.pl
- So... Maybe you shouldn't have hacked it.
- And why don't you try not breathing. Hurts, dunnit. (userfriendly.org)
#2
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
#3
Changeset #4216

This fix causes a problem.

Example: The URL of the page with the link is
http://localhost/mybb/archive/index.php?thread-1.html
The usernames are linked to
http://localhost/member.php?action=profile&uid=x
This is causing a 404 error because it should be
http://localhost/mybb/member.php?action=profile&uid=x
Greets,
Michael
-------------
[Image: donation_drive_sig.png]
#4
Gah, thanks for that.

Here's the new function which should get around that:
function build_profile_link($username="", $uid=0, $target="", $onclick="")
{
	global $lang, $mybb;

	if(!$username && $uid == 0)
	{
		// Return Guest phrase for no UID, no guest nickname
		return $lang->guest;
	}
	elseif($uid == 0)
	{
		// Return the guest's nickname if user is a guest but has a nickname
		return $username;
	}
	else
	{
		// Build the profile link for the registered user
		if(!empty($target))
		{
			$target = " target=\"{$target}\"";
		}

		if(!empty($onclick))
		{
			$onclick = " onclick=\"{$onclick}\"";
		}

		// If we're in the archive, link back a directory
		if(IN_ARCHIVE == 1)
		{
			return "<a href=\"".$mybb->settings['bburl']."/".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
		}
		elseif(IN_ADMINCP == 1)
		{
			return "<a href=\"../".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
		}
		else
		{
			return "<a href=\"".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
		}
	}
}
#5
Woot go SQA Team!
Dennis Tsang
Former MyBB Team Member
Web: http://dennistt.net
#6
Seems to be working fine now.
Greets,
Michael
-------------
[Image: donation_drive_sig.png]


Forum Jump:


Users browsing this thread: 1 Guest(s)