It is required to hide the block with user info if it is authorized on the site. I wrote this code, but it does not work. what could be wrong?

<?php $user = JFactory::getUser(); if($user->id>=0) { ?> <script type="text/javascript"> $(document).ready(function(){ jQuery('.menter6').hide(); }); }); </script> 
  • Understood himself. It is necessary to remove: $ (document) .ready (function () {and all end brackets and; after hide (); - Vlad

2 answers 2

And if($user->id>=0) { where does it close?

Check if the IF in the JS script put the alert( "Привет" );

If it works, then the condition is correct.

And therefore the problem is somewhere here .menter6 .

     if($user->id>=0) 

    to check the user by $user->id condition cannot be >=

    $user->id > 0 : user is authorized.

    $user->id == 0 : user is not authorized.