MemberPress in Oxygen

le 26/10/2021
JAG

This tutorial provides the steps to protect the entire single entry (post, page etc.) built with Oxygen using MemberPress (affiliate link).
In this example, we are going to create a “Free Membership” and add a rule to grant viewing access to a specific post only the users that have the free membership.

Note that MemberPress works out of the box without any of the following steps as long as protecting the standard WordPress post content is concerned. Any other elements that are built with Oxygen though, are not. Hence this guide.
The concept is similar to my earlier How to Password Protect entries in Oxygen post.
Step 1
Install and activate MemberPress.
Step 2
Go through the plugin’s settings page and configure as needed.
Go to MemberPress > Memberships > Add New and add a new membership.
Step 3
Go to MemberPress > Rules and add a new rule to restrict a particular single post (for the sake of this example).
Select the free membership.

You should, of course, tweak this to match your site’s needs. For example, you may be wanting to restrict posts that belong to a particular category to users based on a membership or a group.
Note the ID in the “Partial Content Codes” section.

In our example, it is 658.
Step 4
Go to Oxygen > Templates.
Create a new reusable part named say, “Reusable for Blog Post”. Edit it with Oxygen and build it out.
You will most likely be already having a template for single blog posts. If so, you could bring up the Structure tree and save each of your top-level elements (typically, sections) as reusable parts. Then go back to “Reusable for Blog Post” and add these as editable.
Save the reusable part and go back to admin. Note the ID.
For example, if the URL is https://oxygen.test/wp-admin/post.php?post=660&action=edit, the ID is 660.
Step 5
Edit the template that’s applied to all your single blog posts. Create one if not present.
Delete all elements (if any).
Add a Code Block element having the following in PHP & HTML:

' . do_shortcode( '[[mepr-unauthorized-message]]' ) . '

';
}
?>

Replace 658 with the ID from Step 3 and 660 with the ID from Step 4.
That’s it!
Reference: https://docs.memberpress.com/article/112-available-shortcodes

Nos experts se tiennent à votre disposition
pour répondre à vos questions et vous conseiller
dans votre projet digital.

Vous souhaitez développer une application ?

Envie d’échanger avec l’un de nos experts ? Besoin d’en savoir plus ?
En savoir plus

Recevez notre newsletter

La protection des données nous tient à cœur. JAG utilise les informations que vous fournissez afin de vous proposer des informations et du contenu pertinent sur nos produits et services. Vous pouvez vous désinscrire de ce type de communications à tout moment. Pour plus d'informations, consultez notre politique de confidentialité
© 2022 JAG Consulting, sas. Tous droits réservés.
© 2022 JAG Consulting, sas. Tous droits réservés.
4.8
Lire les 51 avis
google
Brieuc Pauly
08/09/2022

Créative, dynamique et très professionnelle, c'est à mon sens les piliers qui soutiennent cette équipe talentueuse ! Une agence à taille humaine qui privilégie la qualité et le résultat. Alors si vous souhaitez le meilleur pour votre communication adressez vous les yeux fermés à ces passionnés, plus que compétents ! (Translated by Google) Creative, dynamic and very professional, these are in my opinion the pillars that support this talented team! A human-sized agency that favors quality and results. So if you want the best for your communication, turn your eyes closed to these enthusiasts, who are more than competent!

google
Amaury Tardier
08/09/2022

Merci à Julien et son équipe, plus que satisfait par le travail fourni ! Je recommande vivement ! (Translated by Google) Thanks to Julien and his team, more than satisfied with the work provided! I highly recommend !

Ravi de travailler avec l'équipe JAG pour la gestion de mon site de e-Commerce. Equipe réactive et toujours pleine de bonnes idées pour améliorer les performances du site (Translated by Google) Glad to work with the JAG team for the management of my e-Commerce site. Responsive team always full of good ideas to improve the performance of the site

Merci à Julien pour son accompagnement dans mon projet, je recommande à 200% c est le Top (Translated by Google) Thanks to Julien for his support in my project, I recommend 200% it is the top

Excellente agence. Equipe est très pro, à l'écoute et de bon conseils. (Translated by Google) Excellent agency. The team is very professional, attentive and gives good advice.

Temps de réponse hors pair quand il y a eu un pb sur mon site, je vous recommande chaleureusement Julien :-) (Translated by Google) Unparalleled response time when there was a problem on my site, I warmly recommend Julien :-)

Charger plus
listarrow-right
Julien

Julien

Votre conseiller

I will be back soon

Une question ?

Julien
Bonjour ! Je suis Julien.
Comment puis-je vous aider?
Démarrer la conversation:
chat Live Chat