- // Get theme from profile
- $result = SQL_QUERY_ESC("SELECT curr_theme".$ADD." FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array($GLOBALS['userid']), __FILE__, __LINE__);
+// Is the member id and u_hash set?
+if (isMemberIdSet() && (isSessionVariableSet('u_hash'))) {
+ // Is 'theme' installed and activated?
+ if (isExtensionActive('theme')) {
+ // Get theme from profile
+ if (!fetchUserData(getMemberId())) {
+ // Userid is not valid
+ debug_report_bug('User id '.getMemberId() . ' is invalid.');
+ } // END - if