Skip to main content
typo fix & code improvements, there where 2 different syntaxes mixed up, the : endif; and the {} version
Source Link
<?php if( current_user_can('editor')): {:
echo "wlecome";
} echo "welcome";
elseif( current_user_can('member')): {:
  echo "wlecome";
}"welcome";
else :
    wp_die("<h2>
            To"<h2>To view this page you must first 
            <a href='". wp_login_url(get_permalink()) ."' title='Login'>log in</a>
        <a></h2>");
    endif;
?>
<?php if( current_user_can('editor')): {
echo "wlecome";
} 
elseif( current_user_can('member')): {
echo "wlecome";
}
else:
    wp_die("<h2>
            To view this page you must first 
            <a href='". wp_login_url(get_permalink()) ."' title='Login'>log in</a>
        </h2>");
    endif;
?>
<?php if( current_user_can('editor')) :
  echo "welcome";
elseif( current_user_can('member')) :
  echo "welcome";
else :
 wp_die("<h2>To view this page you must first <a href='". wp_login_url(get_permalink()) ."' title='Login'>log in</a></h2>");
endif;
?>

<?php if( current_user_can('editor')): { echo "wlecome"; } elseif( current_user_can('member')): { echo "wlecome"; } else: wp_die("<h2> To view this page you must first <a href='". wp_login_url(get_permalink()) ."' title='Login'>log in</a> </h2>"); endif; ?>

<?php if( current_user_can('editor')): {
echo "wlecome";
} 
elseif( current_user_can('member')): {
echo "wlecome";
}
else:
    wp_die("<h2>
            To view this page you must first 
            <a href='". wp_login_url(get_permalink()) ."' title='Login'>log in</a>
        </h2>");
    endif;
?>

<?php if( current_user_can('editor')): { echo "wlecome"; } elseif( current_user_can('member')): { echo "wlecome"; } else: wp_die("<h2> To view this page you must first <a href='". wp_login_url(get_permalink()) ."' title='Login'>log in</a> </h2>"); endif; ?>

<?php if( current_user_can('editor')): {
echo "wlecome";
} 
elseif( current_user_can('member')): {
echo "wlecome";
}
else:
    wp_die("<h2>
            To view this page you must first 
            <a href='". wp_login_url(get_permalink()) ."' title='Login'>log in</a>
        </h2>");
    endif;
?>
Source Link

<?php if( current_user_can('editor')): { echo "wlecome"; } elseif( current_user_can('member')): { echo "wlecome"; } else: wp_die("<h2> To view this page you must first <a href='". wp_login_url(get_permalink()) ."' title='Login'>log in</a> </h2>"); endif; ?>