How can I detect if user has subscribed Memberpress product already
This should be pretty straight forward using MemberPress' built in capabilities:
if(current_user_can('memberpress_authorized')) {
// Do authorized only stuff here
}
else {
// Do unauthorized stuff here
}
MemberPress also adds capabilities for each MemberPress Membership so you could also do something like this:
if(current_user_can('memberpress_product_authorized_123')) {
// Do authorized only stuff here
}
else {
// Do unauthorized stuff here
}
In the second example the number 123 is the id of the MemberPress membership.