MyBB Community Forums

Full Version: How do I define that which is 'undefined'?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In MyBB, how do I define that which is 'undefined'?

The best way to explain what I mean is to go to my web forum and click on the login prompt at the top of the page:

http://www.fislam.com/mybb_1610/Upload/

Click on the login prompt

What results is this prompt:

[img]www.fislam.com/undefined.PNG[/img]

Now, the button that says "undefined" means "Login" the check box, on the other hand, has a purpose that I do not understand and should be commented out (coding lingo).

I have done my best to try to narrow down where this is happening. The string "undefined" is located in too many places for me to guess where to look.

The member.php has a switch statement that i can tell is called when you click on the Login option:

// Make navigation
switch($mybb->input['action'])
{
	case "register":
	case "do_register":
		add_breadcrumb($lang->nav_register);
		break;
	case "activate":
		add_breadcrumb($lang->nav_activate);
		break;
	case "resendactivation":
		add_breadcrumb($lang->nav_resendactivation);
		break;
	case "lostpw":
		add_breadcrumb($lang->nav_lostpw);
		break;
	case "resetpassword":
		add_breadcrumb($lang->nav_resetpassword);
		break;
	case "login":
		add_breadcrumb($lang->nav_login);
		break;
	case "emailuser":
		add_breadcrumb($lang->nav_emailuser);
		break;
}


The "add_bredcrumb" function is defined in the functions.php like this:

/**
 * Add a breadcrumb menu item to the list.
 *
 * @param string The name of the item to add
 * @param string The URL of the item to add
 */
function add_breadcrumb($name, $url="")
{
	global $navbits;

	$navsize = count($navbits);
	$navbits[$navsize]['name'] = $name;
	$navbits[$navsize]['url'] = $url;
}

Here is what I suspect is going on. The member.lang.php file has a set of assignments. If an assignment is missing, there is a default label called "undefind" that is put in its place.

But I do not know how to track down the varable for the login button or the check box label. Please offer some advice.
That's not connected to the .php files.

You need to collapse Header Templates, then in header_welcomeblock_guest options choose Diff Report. You should see missing/incorrect language variables, if you don't know what to change post screenshot of whole Diff Report here.
@ Xarzu, few days back I had sent you a PM. reply it if you need direct help (you have to provide required temporary access)
The problem is not with your internal files. The problem is with general.js where the quick login thing is defined. It is somehow not able to read "lang.username", etc from the quick_login language javascript.

Post your general.js here?
Cedric,

I do not think that general.js was overwritten when I installed my new theme. I did not see a general.js along with the files unzipped from the theme.

So I do not understand how the file got changed or corrupted.

In the quickLogin function in general.js, I found this which looks suspicious:

			form.insert({ bottom: new Element("input",
				{
					name: "submit",
					type: "submit",
					value: lang.login,
					"class": "button"
				})
			});

			var span = new Element("span", { "class": "remember_me" }).insert({ bottom: new Element("input",
				{
					name: "quick_remember",
					id: "quick_login_remember",
					type: "checkbox",
					value: "yes",
					"class": "checkbox"
				})
			});

I just fixed it. I will tell you how in a moment.

I fixed it.

I could not have done this without your help.

The header_welcomeblock_guest was part of the problem.

For some reason, in both the default theme and the new theme has the the assignments in header_welcomeblock_guest commented out like this:

<!--
    lang.username = "{$lang->login_username}";
    lang.password = "{$lang->login_password}";
    lang.login = "{$lang->login}";
    lang.lost_password = " - <a href=\"{$mybb->settings['bburl']}/member.php?action=lostpw\"><small>{$lang->lost_password}</small><\/a>";
    lang.register_url = " - <a href=\"{$mybb->settings['bburl']}/member.php?action=register\"><small>{$lang->welcome_register}</small><\/a>";
    lang.remember_me = "<small>{$lang->remember_me}</small>";
// -->

The suggestion to look at the quick_login function in general.js showed me that the button is defined by lang.login whose assignment is part of the commented-out code.

Once I removed the commented out blocks, the website works fine.

Thanks, mates.
^ general.js file does not get replaced by the theme and it might not be the cause for the referred issue.
you might be missing some code in header_welcomeblock_guest template / language file or it might be due to a plugin

follow suggestions in post#2 or see replies here for guidance and there are similar threads on this community
@.m.

Wrong. Depends on the Theme you create. I have also EDITED (HIGHLY edited) general.js for my Elder Scrolls Theme.

It depends on theme-to-theme. They can modify any JS file.