MyBB Community Forums

Full Version: What's the string name for a certain setting?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What's the string name for a certain setting? As in, what would I call to display the value of the [custom] setting 'display_rating'? Something like $mybb->setting['display_rating']?
If your setting name is display_rating, then you would access it with the variable $mybb->settings['display_rating']

Please note there's a difference between setting name and setting title
As Dennis said, you have to be careful of what you put. Look at the "Setting Name" and place it EXACTLY how you placed it in the settings manager at the acp.

An example...if your setting name was "testing", then you would create a string such as this

Quote:$mybb->settings['testing']

Incorrect:

Quote:$mybb->settings['someothername']
Can I use PHP if checks in MyBB's template? Or, does MyBB have it's own method? If not, then I highly suggest you add the ability to do so!
eXaulz Wrote:Can I use PHP if checks in MyBB's template? Or, does MyBB have it's own method? If not, then I highly suggest you add the ability to do so!

No. Add your PHP 'if' in the php code of the page, then output it as a variable on the template.

For example if you wanted to add a message to logged in users to the header, you would open global.php and add right before the eval($header...) line:
if($mybb->user['uid'] > 0)
{
$mystring = 'Logged in user';
}
else
{
$mystring = 'Not logged in';
}

Then add in the header template $mystring.
Wouldn't you need to eval($mystring ...) for that to work? Or am I just thinking of this method if you wanted a template you created on the admin cp to show on the forum?
Yes Cory. That code is for templates only. Dennis's code will work.
Most of the time, the stuff that is eval'ed is when you are parsing a template. Then by the eval, all the variables will be replaced with the appropriate values.