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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.