Forums

s2 Member redirect based on user level error re: header sent (1 post)

  1. niallw
    Member
    Posted 4 months ago #

    Hi there,

    I am having real difficulty implementing the code that will allow me to redirect users away from a login welcome page should there membership level be at a certain level.

    I understand the need to use advanced conditionals to do this and I have been attempting the following code snippet within the page to no avail:-

    <?php if (current_user_can("access_s2member_level1")){
    wp_redirect( home_url() ); exit;
    }else{
    wp_redirect( another_url() ); exit;
    } ?>

    I have the plugin installed that is recommended by the s2member team for adding php code into wordpress pages and posts.

    I am getting the following error message each time - Warning: Cannot modify header information – headers already sent by (output started at /homepages/39/d372554375/.............../template-full-width.php:7) in /homepages/39/d372554375/................./wp-content/plugins/php-execution-plugin/includes/class.php_execution.php(273) : eval()’d code on line 29

    I am new to this and maybe underestimated what was involved in getting this to work. I have seen a number of posts on this error message but can't find a solution tailored to my situation. The closest I've got is the following post

    Could anyone help. It is really frustrating.

    Thanks,

    niall w

Reply

You must log in to post.

About this Topic