- This topic has 1 reply, 2 voices, and was last updated 10 years, 4 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › If member ID php tweak Not working
Tagged: If member
Hi Im trying to display certain content for an specific member id, I wrote the php tweak in this way <?php
$member_id = SwpmMemberUtils::get_logged_in_members_id();
if ($member_id == “4”){
woocommerce_template_single_add_to_cart();
} else {
echo ‘…..’;
}
?>
But when I log in whit member id 4 nothing is shown what am I doing wrong ??
Thanks
echo the member ID before you use the “if” statement so you know if the ID is getting retrieved correctly. Also, make sure that you are calling that function after the simple membership plugin is loaded (using the “plugins_loaded” hook). Otherwise that function won’t return anything if it hasn’t loaded yet.