screenshot


http://s1.postimg.org/rlj6w3xm7/warning_modify_header.png

this is my code

<?php
ob_start();
global $current_user, $wp_roles;
get_currentuserinfo();
$error = array();
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'update-user' ) {
    if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {
        if ( $_POST['pass1'] == $_POST['pass2'] )
            wp_update_user( array( 'ID' => $current_user->ID, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );
        else
            $error[] = __('password yang anda masukkan tidak sama,password belum bisa diupdate.', 'profile');
        }
     if ( count($error) == 0 ) {
                //action hook for plugins and extra fields saving
                do_action('edit_user_profile_update', $current_user->ID);
                wp_redirect( get_permalink() );
                exit;
    }
}
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>">
<?php the_content(); ?>
<?php if ( !is_user_logged_in() ) : ?>
<p class="warning">
<?php _e('Anda harus masuk sebagai member terlebih dahulu, untuk mengedit profile', 'profile'); ?>
</p><!-- .warning -->
<?php else : ?>
<?php if ( count($error) > 0 ) echo '<p class="error">' . implode("<br />", $error) . '</p>'; ?>
<form method="post" id="adduser" action="<?php the_permalink(); ?>">
<?php 
    do_action('edit_user_profile',$current_user); ?>
<p class="form-password">
<label for="pass1"><?php _e('Password *', 'profile'); ?> </label>
<input class="text-input" name="pass1" type="password" id="pass1" />
</p><!-- .form-password -->
<p class="form-password">
<label for="pass2"><?php _e('Repeat Password *', 'profile'); ?></label>
<input class="text-input" name="pass2" type="password" id="pass2" />
</p><!-- .form-password -->
<p class="form-submit">
<?php echo $referer; ?>
<input name="updateuser" type="submit" id="updateuser" class="submit button" value="<?php _e('Update', 'profile'); ?>" />
<?php wp_nonce_field( 'update-user' ) ?>
<input name="action" type="hidden" id="action" value="update-user" />
</p><!-- .form-submit -->
</form>
<?php endif; ?>
    </div><!-- .hentry .post -->
    <?php endwhile; ?>
<?php else: ?>
    <p class="no-data">
        <?php _e('maaf,tidak ada halaman yang sesuai dengan', 'profile'); ?>
    </p><!-- .no-data -->
<?php endif; ?>

it’s purpose to change password ,if password match and will be saving
then error Cannot modify header information . . . . display loop until line 1121.

i already try this code ob_start();
fromWarning: Cannot modify header information - headers already sent by ERROR

any idea how I could fix this?

thanks

Read more here: how to fix Warning: Cannot modify header information in page wordpress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , , ,

Wordpress related questions and answers: