WordPress.org

Ready to get started?Download WordPress

Forums

Check if my PHP is ok - Thx (1 post)

  1. tianbo84
    Member
    Posted 4 years ago #

    Hi there,

    I am wondering if someone could take a look at this code and see if I am missing some stuff (which I am pretty sure I am).

    Basically I would like to:
    1) Grab userID
    2) Check to see what url the user is trying to view
    3) Check if user has meta key of ppurl with value of "Yes" - If it finds it than does nothing
    4) if it does not find the meta key for the user it will redirect them.

    Thanks,

    <?php 
    
    	$userinfo = get_userdata(cp_currentUser());
    	$userid = $userinfo->ID;
    
        $currentpage ="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
         if ($currentpage == "http://".$_SERVER['HTTP_HOST']."/category/hot-topic-videos/")
    	 	get_usermeta($userid,'ppurl1');
    	if
    	(ppurl1 == "Yes")
    	{
         die(); //no action
        }
    	else {
    	wp_redirect('http://www.mainsite.com/'); //redirects user to URL
    	}
    	?>

Topic Closed

This topic has been closed to new replies.

About this Topic