I'm using wordpress_signon() function to login the consumer. I'm carrying this out like

$creds = array();

$creds['user_login'] = $username;

$creds['user_password'] = $password;

$creds['remember'] = true;

$user = wp_signon( $creds, false );

i wish to send user by page after login.

However i Am facing following error:

Warning: Cannot modify header information - headers already sent by (output began at E:xampphtdocswpmoodlewp-contentthemestwentytenheader.php:12) in E:xampphtdocswpmoodlewp-includespluggable.php online 690.

Thanks ahead of time.

Additional problem:

Adding the code of wordpress_wignon on top the login works properly however the page will not be shown compeletly until I personally use a hyperlink or click F5 (page reload)?

<?php
/*
Template Name: KUNDENLOGIN-DEV
*/
?>

<?php
// setup
$user_login = 'user';
$user_password = 'pass';

// Login
$creds = array();
$creds['user_login'] = $user_login;
$creds['user_password'] = $user_password;
$creds['remember'] = true;
$user = wp_signon( $creds, false );

if ( is_wp_error($user) ) {
    echo $user->get_error_message(); 
} else { echo "Benutzer eingeloggt! <br />"; }

// Aktuellen Benutzer setzen
wp_set_current_user($user->ID);

//wp_set_auth_cookie($user->ID);

// Testausgabe der Logindaten
global $current_user;
get_currentuserinfo();
echo 'Benutzername: ' . $current_user->user_login . '<br />'; 



if (is_user_logged_in()) {
    echo 'user is logged in';
} else {
    echo 'user is not logged in';
}
?>


<?php get_header(); ?> 
<div id="main">     
    <div class="columns">      
    <div class="narrowcolumn singlepage">
     <?php if (have_posts()) : ?>
     <?php while (have_posts()) : the_post(); ?>                            
            <div class="post">

                <div class="title"><h2><?php the_title(); ?></h2></div>                
                <div class="entry">


<?php
echo ("<br /><b>Meine Videos:</b><br />");
$category_id = get_cat_ID('zugriffsbeschraenkt'); // auslesen der category
$args = array( 'numberposts' => 3, 'order' => 'ASC', 'category' => $category_id );
$lastposts = get_posts( $args );
foreach($lastposts as $post) : setup_postdata($post); ?>
    <?php the_title(); ?> <a href="<?php the_permalink(); ?>"><img src="http://81.169.188.244/wp-content/plugins/exxplain-sugarcrm/images/applications-multimedia.png" alt="play" width="20px" height="20px" /></a><br />
<?php endforeach;
// END list postings
echo '<br />';
?>



                     <?php t_show_video($post->ID); ?>
                     <?php the_content(); ?>    
                    <div class="clear"></div>
                </div>   
                <p class="postmetadata">                   
                <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>                      
                <?php edit_post_link(__('Edit','nattywp'), '<p>', '</p>'); ?>   
                </p>                   
            </div>      
            <?php //comments_template( '', true ); ?>       
    <?php endwhile; ?>      
    <?php endif; ?>             
    </div> <!-- END Narrowcolumn -->
    <div id="sidebar" class="profile">
       <?php get_sidebar();?>
    </div>    
<div class="clear"></div>
<?php get_footer(); ?> 

wp_signon() must run before you've sent all of your actual page towards the browser.

The reason being a part of what wp_signon() does would be to set your authentication snacks. It will this by outputting a "Set-Cookie: ..." header -- should you take a look at line 690 of pluggable.php, where your error originates from, you'll notice that that line sets a cookie.

So, because wp_signon() results headers, you cannot curently have sent any content -- because headers should always be output before content.

However, the mistake signifies that you have already sent some output -- online 12 of header.php, presumable a few of the first HTML from the standard WordPress theme.

This essentially signifies you need to move your wp_signon() call to somewhere earlier within the WordPress processing, so it features a opportunity to output its headers before any page submissions are sent.