Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    1
    Member #
    40067

    Redirect based on page and get user meta

    Hi everyone,
    I am trying to set up a function on my Wordpress full-width template that if it is a particular page (forum) and the user profile field "active membership pack" is empty, then redirect to the login page. I cannot get this to work. Can anyone please see the code below and let me know what I am missing?

    Thank you.

    PHP Code:
    add_action'redirect_to_specific_page'*); 

    function*
    redirect_to_specific_page()*{ 

    if*(*(*
    is_page('forum'))*&&*!(get_user_meta($user->ID,*'active_membership_pack',*false))*)*{ 

    wp_redirect('http://www.mywebsite.org/login/',*301*);* 
    **exit; 
    ****} 
    }* 

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:22 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com