• Hi, I see that uam loads css and js in every request, but it seems not to be needed. in user-access-manager.php on lines 303 and 304 I simply commented out the lines

    add_action('wp_print_scripts', array($oUserAccessManager, 'addScripts'));
    add_action('wp_print_styles', array($oUserAccessManager, 'addStyles'));

    this stops loading the uam css and js in the frontend, and I see no problems, everything seems to work. In the settings page I set everything to “no” besides “Authors always has access to own posts/pages” and “Lock recursive” – do you see any problem that might occur with the css and js loadig deactivated in frontend?

    If not, why is it there at all?

    Thanks for your attention!

    https://www.ads-software.com/extend/plugins/user-access-manager/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I speeded up my site as well by doing the same. It seems to work fine without them. However, Try theese hooks insted of changing the core of the plugin files.

    // Cleanup UAM
    function ua_dequeue_scripts() {
    	if (!is_admin()) {
    		wp_dequeue_script('UserAccessManagerJQueryTools');
    		wp_dequeue_script('UserAccessManagerFunctions');
    	}
    }
    add_action('wp_print_scripts', 'ua_dequeue_scripts');
    
    function ua_dequeue_styles() {
    	if (!is_admin()) {
    		wp_dequeue_style('UserAccessManagerAdmin');
    		wp_dequeue_style('UserAccessManagerLoginForm');
    	}
    }
    add_action('wp_print_styles', 'ua_dequeue_styles');

    I disabled the Tooltip as well in the backend. It loads the third part library from juery Tools – on all pages. Not good for just a mouseover info in the backend.

    if you deque.. the tooltip in backend as well, you must replace the functions in UserAccessManagerFunctions (just a few) who calls the $('a.uam_group_info_link').tooltip()

    for example This script replaces all the tooltip stuff to accordions:

    function ua_admin_backend_js() {
        echo '<script type="text/javascript">'."\n";
    	?>
    	jQuery(document).ready(function($){
    
    		// User access manager tooltip replacement
    		if($('a.uam_group_info_link').get(0)){
    			$('a.uam_group_info_link').click(function(){
    				$(this).next().toggle();
    				return false;
    			});
    		}
    	});
    	<?php
    	echo '</script>'."\n";
    }
    add_action('admin_footer', 'ua_admin_backend_js');

    Hi Jonas,

    I read this thread and found your tips useful.
    I’m experiencing a little problem with UAM and Lightbox Colorbox: it seems lightbox stop working because of an error caused just by the UAM tooltip function you said you disabled.
    I would not change the plugin core, so could you post the code you used to obtain this too? I’m not that good in fixing plugins.
    Thanks.

    Hi,

    Are you talking about backend or front end? (the problem with lightbox)

    The point is, if you disable the tooltip library / script, you must disable the plugin script call as well. Otherwise the plugin core script tries to call the tooltip function without checking if its loaded.

    The plugin script also add an accordion to the plugin settingspage. If you choose “Hide all titles” and so on, the script hides other options.

    As a workaround and if you can live with that, you can totally turn script and tooltip off front and backend by:

    // Cleanup UAM
      function ua_dequeue_scripts() {
    	wp_dequeue_script('UserAccessManagerJQueryTools');
    	wp_dequeue_script('UserAccessManagerFunctions');
      }
      add_action('wp_print_scripts', 'ua_dequeue_scripts');
    
      function ua_dequeue_styles() {
    	wp_dequeue_style('UserAccessManagerAdmin');
    	wp_dequeue_style('UserAccessManagerLoginForm');
      }
      add_action('wp_print_styles', 'ua_dequeue_styles');

    If you use the // User access manager tooltip replacement above, the info for group links works as a toggel below box function…

    I have no bigger thoughts with this fix. The replacement can be better and complete. I just NOW .. wanna get rid of the tooltip script, its a overkill for just a hover effect – noone often uses! And the library juery Tools works best if only using the whole package with their OWN lightbox, tabs, highlights and much more.

    Its a good library, but do not mix. The problem is actually often bad conflict code setups by Other plugins. But thats the real world…

    Note,
    The prefix ua_ in everything has nothing to do with UAM, Its a short version for User agent – an office template for wordpress.

    so, optional, You can replace ua_ with your own template prefix.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘CSS and JS loading on every page request – needed in frontend?’ is closed to new replies.