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

XF 1.5 var_dump for admin only

#1
Hello, i often code a modifications for my forum and use var_dump.
I had change helperDump function for debug only for admin

PHP:
public static function helperDump($data)
{
   if (XenForo_Visitor::getUserId() === 1)
   {
      return Zend_Debug::dump($data, null, false);
   }
}
Okay, it's good working in templates ({xen:helper dump, $var})
But what's about var_dump function in php code? Is there customizable function for developing, that i can use var_dump in code and only i will see result of this function? Sorry for my english.
 

Chris D

XenForo developer
Staff member
#2
You'd have to write your own function and put it somewhere and then call that. It would basically be the same as above, but with the null, false arguments removed.

Have to say, though, if you're trying to develop on a live site, it's just generally a bad idea. If it absolutely must be online, for some reason, at least do it on a test install where you won't need to worry about people seeing the dumps.

We'd recommend having a local test installation to do your development then synchronise your changes to your live site when they're ready.
 
#3
You'd have to write your own function and put it somewhere and then call that. It would basically be the same as above, but with the null, false arguments removed.

Have to say, though, if you're trying to develop on a live site, it's just generally a bad idea. If it absolutely must be online, for some reason, at least do it on a test install where you won't need to worry about people seeing the dumps.

We'd recommend having a local test installation to do your development then synchronise your changes to your live site when they're ready.
I agree with you about local site, it is good idea. But i can't synchronize forum templates, forum settings in few clicks, i code/change something everyday and not one time in day