MyBB Community Forums

Full Version: Reading URL parameters
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

On my member_profile page, I have a link that links off to my plugin URL. I'm trying to pass the $memprofile['uid'] through the URL, and read information from the SQL database based on that user's UID. I want to be able to click the button, redirect to my plugin's page, and see information about the user. How can I achieve this in my plugin?

On member_profile, I have

<a href="/misc.php?action=example&uid=1">Example Text</a>

In my example.php I have

function example()
{
	global $mybb, $db, $templates, $lang, $header, $headerinclude, $memprofile, $footer;

	add_breadcrumb('Example', "misc.php?action=example");

	$db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid = '{$memprofile['uid']}'");

	if($mybb->get_input('action') == 'example' && $mybb->get_input['action'] == $uid)
	{
		eval("\$page = \"".$templates->get("example")."\";");
		output_page($page);
	}
}

Here are the hooks that I'm using

$plugins->add_hook('misc_start', 'example');
$plugins->add_hook('member_profile_end', 'example');

The issue I'm having is that in the SQL query, it's not reading the {$memprofile['uid']}. It tries to query as
SELECT * FROM users WHERE uid = '''

Any help is appreciated
any help on this is appreciated
Change
$mybb->get_input['action'] == $uid

To
$mybb->get_input['uid'] == $uid

Then put the following in your function example()
$uid = $mybb->input['uid'];