Support

Account

Home Forums Feedback ACF makes a good combo with Live-Edit Reply To: ACF makes a good combo with Live-Edit

  • Hi @sjeev

    There is a good topic regarding the current_user_can function here:
    http://stackoverflow.com/questions/13404284/wordpress-capabilities-and-current-user-can-in-functions-php

    Lets go back to the live edit init function and simplify the code to:

    
    <?php 
    
    /*
    *  init
    *
    *  @description: 
    *  @created: 7/09/12
    */
    
    function init()
    {
    	// must be logged in
    	if( is_user_logged_in() )
    	{
    		
    		if( current_user_can('author') )
    		{
    			echo '<pre>';
    				print_r('author');
    			echo '</pre>';
    			die;
    		}
    		
    		
    		if( current_user_can('ministrator') )
    		{
    			echo '<pre>';
    				print_r('ministrator');
    			echo '</pre>';
    			die;
    		}
    		
    		// actions
    		add_action('admin_head', array($this,'admin_head'));
    		add_action('admin_menu', array($this,'admin_menu'));
    		
    		
    		add_action('wp_enqueue_scripts', array($this,'wp_enqueue_scripts'));
    		add_action('wp_head', array($this,'wp_head'));
    		add_action('wp_footer', array($this,'wp_footer'));
    		add_action('wp_ajax_live_edit_update_width', array($this, 'ajax_update_width'));
    	}
    }
    
     ?>
    
    

    This will now visually display some text so you can see if the if statement is working correctly.