• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Blob content in xf_option table

AndyB

Well-known member
#1
Hello,

An admin I'm helping indicated my Register Email add-on was throwing an error during registration. What I found was the option_value field is different between his table and my test forum:

In his database the requireLocation is not present
pic001.jpg

On my database the requireLocation is present
pic002.jpg
 
Last edited:

AndyB

Well-known member
#2
Looks like the requireLocation is not going to be present unless that field in the Options page is selected at least once. So even if it's deselected it will remain in the option_value.
 

AndyB

Well-known member
#3
Th problem is in my Register Email add-on I have the following code:

PHP:
$requireLocation = XenForo_Application::get('options')->registrationSetup['requireLocation'];
So if the Require Location checkbox in the User Registration Options page has never been checked, the above PHP code throws an error due to the value not having been set yet. How can I prevent the server error? Do I need to do a database query directly on the xf_option table?
 
Last edited:

AndyB

Well-known member
#5
Like this?

PHP:
if (!empty(XenForo_Application::get('options')->registrationSetup['requireLocation']))
{
    $requireLocation = XenForo_Application::get('options')->registrationSetup['requireLocation'];
}
 
Last edited: