0

I try to limit access to a page only for registered users before a specific date. For the others, a message must be display.

Here is my code

    <?php if( strtotime( $user->user_registered ) < mktime( 0, 0, 0, 3, 7, 2016 ) ) {
echo do_shortcode('[gravityform id=14]');
}
else {
    echo "Désolé. La participation est réservée aux membres inscrits avant le 07 mars 2016.";
}
?>

Actually, this code display the gravityform even if registration date is taller than mktime value. I want to display the message "Désolé. La participation est réservée aux membres inscrits avant le 07 mars 2016." for users registered after 2616/03/06.

How can i do it ? Thanks for your help.

  • Sorry. Find by myself. Just forget to declare $user = wp_get_current_user(); – Guenfood Mar 7 '16 at 11:45
  • 1
    If you found the answer it is best to add it as an answer then choose it as best answer so this thread can be marked as answered :) – yobddigi Mar 7 '16 at 11:50
-1

Find by myself. Just forget to declare $user = wp_get_current_user();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.