ClassiPress Redirect Function
Hi,
I have two different users for my ClassiPress site: Corporate and Individuals. I want Individuals to post for FREE but Corporate Members must purchase a membership package to post. I have explored different options, and this seems the simplest way to go thus far.
I have created the two different user types using Advanced Custom Fields. In functions.php I would like to insert a code so that when posting an ad, if the member is Corporate and Has no active membership pack, redirect them to the membership purchase page.
Here is my code however, my site does not load after putting. I am not familiar with php but attempting to learn. Any assistance to would be appreciated:
PHP Code:
//Redirect Corporate Users if No Membership Pack
add_action( 'template_redirect', 'redirect_to_specific_page' );
function redirect_to_specific_page() {
if ( ( is_page('add-new')) && !(get_user_meta($user->ID, 'user_type', true) == 'Corporate') && !(get_user_meta($user->ID, 'active_membership_pack', false)) ) {
wp_redirect( 'http://www.barterhutt.com/memberships/', 301 );
exit;
}
}