Hi. This issue occurs when activating my base theme which I use as a framework for sites. Before this, using the same plugins the issue does not occur. I believe it is likely to do with my functions-setup.php. This file runs once when first activating the theme. There is a section that deals with user permissions. I don't quite see how this would be effecting form permissions but it seems the most likely candidate.
Thanks
/*////////////////////////////////////////////////////////////
If needed to run functions again chnage uncommend below
////////////////////////////////////////////////////////////*/
//update_option( 'theme_setup_status', '0' );
/*////////////////////////////////////////////////////////////
Run on first theme switch
////////////////////////////////////////////////////////////*/
add_action( 'after_setup_theme', 'the_theme_setup' );
function the_theme_setup()
{
// First we check to see if our default theme settings have been applied.
$the_theme_status = get_option( 'theme_setup_status' );
// If the theme has not yet been used we want to run our default settings.
if ( $the_theme_status !== '1' ) {
/*////////////////////////////////////////////////////////////
Setup Default WordPress settings
////////////////////////////////////////////////////////////*/
$core_settings = array(
'avatar_default' => 'mystery', // Comment Avatars should be using mystery by default
'avatar_rating' => 'G', // Avatar rating
'comment_max_links' => 0, // We do not allow links from comments
'comments_per_page' => 20 // Default to 20 comments per page
);
foreach ( $core_settings as $k => $v ) {
update_option( $k, $v );
}
/*////////////////////////////////////////////////////////////
Delete dummy post, page and comment.
////////////////////////////////////////////////////////////*/
wp_delete_post( 1, true );
wp_delete_post( 2, true );
wp_delete_comment( 1 );
/*////////////////////////////////////////////////////////////
Add pages
////////////////////////////////////////////////////////////*/
$new_page_title = array ('Home','Contact','About');
$new_page_content = array ('');
$new_page_template = array (''); //Template, blank for default
foreach ( $new_page_title as $page_title ) {
$page_check = get_page_by_title($page_title);
$new_page = array(
'post_type' => 'page',
'post_title' => $page_title,
'post_content' => $new_page_content,
'post_status' => 'publish',
'post_author' => 1,
);
if(!isset($page_check->ID)){
$new_page_id = wp_insert_post($new_page);
if(!empty($new_page_template)){
update_post_meta($new_page_id, '_wp_page_template', $new_page_template);
}
}
}//end foreach
/*////////////////////////////////////////////////////////////
set page as front page
////////////////////////////////////////////////////////////*/
$homeSet = get_page_by_title( 'Home' );
update_option( 'page_on_front', $homeSet->ID );
update_option( 'show_on_front', 'page' );
/*////////////////////////////////////////////////////////////
Change permalink structure
////////////////////////////////////////////////////////////*/
global $wp_rewrite;
$wp_rewrite->set_permalink_structure( '/%postname%/' );
/*////////////////////////////////////////////////////////////
Remove wordpress roles
////////////////////////////////////////////////////////////*/
remove_role( 'author' );
remove_role( 'contributor' );
/*////////////////////////////////////////////////////////////
Set role capabilities
////////////////////////////////////////////////////////////*/
$edit_editor = get_role('editor');
$edit_editor->add_cap('add_users');
$edit_editor->add_cap('create_users');
$edit_editor->add_cap('delete_users');
$edit_editor->add_cap('edit_users');
$edit_editor->add_cap('list_users');
$edit_editor->add_cap('promote_users');
$edit_editor->add_cap('remove_users');
$edit_editor->add_cap('edit_theme_options');
$edit_editor->remove_cap('manage_links');
/*////////////////////////////////////////////////////////////
Set theme_setup_status as 1
////////////////////////////////////////////////////////////*/
update_option( 'theme_setup_status', '1' );
$msg = '
<div class="error">
<p>The ' . get_option( 'current_theme' ) . 'theme has changed your WordPress default <a href="' . admin_url() . 'options-general.php" title="See Settings">settings</a> and deleted default posts & comments.</p>
</div>';
add_action( 'admin_notices', $c = create_function( '', 'echo "' . addcslashes( $msg, '"' ) . '";' ) );
}
elseif ( $the_theme_status === '1' and isset( $_GET['activated'] ) ) {
$msg = '
<div class="updated">
<p>The ' . get_option( 'current_theme' ) . ' theme was successfully re-activated.</p>
</div>';
add_action( 'admin_notices', $c = create_function( '', 'echo "' . addcslashes( $msg, '"' ) . '";' ) );
}
}
Posted 12 years ago on Tuesday September 11, 2012 |
Permalink