MyBB Community Forums

Full Version: Username Allowed For Profile Viewing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have tried this plugin but it realizes a redirect only toward the principal page of the user profile.

does a way exist to not have the redirect?
It can always be hardcoded in the member.php file Wink Will take a look for it right away Wink

Open member.php

Find
	$query = $db->simple_select(TABLE_PREFIX."users", "*", "uid='$uid'");	


Replace by
	if(!$mybb->input['username'])
	{
		$query = $db->simple_select(TABLE_PREFIX."users", "*", "uid='$uid'");	
	}
	else
	{
		// CHECK IF USERNAME EXISTS
		$uname = username_exists($db->escape_string($mybb->input['username']));
		if($uname)
		{
			$username = $db->escape_string($mybb->input['username']);
			// GET INFO
			$query = $db->simple_select(TABLE_PREFIX."users", "*", "username='$username'");
		}
	}

Find
	$memprofile = $db->fetch_array($query);
Add below
	$uid = $memprofile['uid'];
LeX- Wrote:It can always be hardcoded in the member.php file Wink Will take a look for it right away Wink

Open member.php

Find
	$query = $db->simple_select(TABLE_PREFIX."users", "*", "uid='$uid'");	


Replace by
	if(!$mybb->input['username'])
	{
		$query = $db->simple_select(TABLE_PREFIX."users", "*", "uid='$uid'");	
	}
	else
	{
		// CHECK IF USERNAME EXISTS
		$uname = username_exists($db->escape_string($mybb->input['username']));
		if($uname)
		{
			$username = $db->escape_string($mybb->input['username']);
			// GET INFO
			$query = $db->simple_select(TABLE_PREFIX."users", "*", "username='$username'");
		}
	}

You have tested this code? Because I don't succeed in doing to working Sad
Yes i've tested it, you can test it at my forum.

With Username ::
http://thingiej.be/mybb129/member.php?ac...ername=LeX-

With UID ::
http://thingiej.be/mybb129/member.php?ac...file&uid=1
Thanks It's good!!!

Is impossibile translate this code in a plugin?
Since there aren't any good hooks for it, i will have to say no for now =P
LeX- Wrote:Since there aren't any good hooks for it, i will have to say no for now =P

Thanks for your code, is good!

Is possible modified in the URL the username for example if there is a nickname: gòkù i want that the url is http://forum.it/member.php?action=profile&username=goku and not http://forum.it/member.php?action=profile&username=gòkù

Is possible?
No, cause when you're gonna search for the username "goku" it wont return any result. And you can't use a str_replace for the char o into ò and u into ù , cause not every name needs that replacement.
LeX- Wrote:It can always be hardcoded in the member.php file Wink Will take a look for it right away Wink

Open member.php

Find
	$query = $db->simple_select(TABLE_PREFIX."users", "*", "uid='$uid'");	


Replace by
	if(!$mybb->input['username'])
	{
		$query = $db->simple_select(TABLE_PREFIX."users", "*", "uid='$uid'");	
	}
	else
	{
		// CHECK IF USERNAME EXISTS
		$uname = username_exists($db->escape_string($mybb->input['username']));
		if($uname)
		{
			$username = $db->escape_string($mybb->input['username']);
			// GET INFO
			$query = $db->simple_select(TABLE_PREFIX."users", "*", "username='$username'");
		}
	}

However this code has a bug: in the page profile when there is written "Find All Threads — Find All Posts", the links in them don't work Sad
gokufg Wrote:
LeX- Wrote:It can always be hardcoded in the member.php file Wink Will take a look for it right away Wink

Open member.php

Find
	$query = $db->simple_select(TABLE_PREFIX."users", "*", "uid='$uid'");	


Replace by
	if(!$mybb->input['username'])
	{
		$query = $db->simple_select(TABLE_PREFIX."users", "*", "uid='$uid'");	
	}
	else
	{
		// CHECK IF USERNAME EXISTS
		$uname = username_exists($db->escape_string($mybb->input['username']));
		if($uname)
		{
			$username = $db->escape_string($mybb->input['username']);
			// GET INFO
			$query = $db->simple_select(TABLE_PREFIX."users", "*", "username='$username'");
		}
	}

However this code has a bug: in the page profile when there is written "Find All Threads — Find All Posts", the links in them don't work Sad

Find all threads - Find all posts goes by search.php ... not by member.php. And every profilelink is build up by default with a uid; if the normal profilelink works it will also work when you click on a profilelink in the "Find all threads - find all posts" results.
Pages: 1 2