Support only during business hours : Monday to friday, from 8:30 am – 5:30 pm CEST

Due to the decrease in our staff due to vacations, our response time may be longer.

Be sure we're doing our best to manage your topic as soon as possible.

How to use Membership Pro to create PayWall?

Find Answers and Get Support Forums Cera – Intranet & Community Theme Website Setup Posts How to use Membership Pro to create PayWall?

This topic is resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • Muamer
    Participant
    • 13 Topics
    • 33 Posts
    @mllapan

    Well, I need something to acomplish with this theme, but I noticed in the content-single, it uses this function:

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<?php
    	/**
    	 * Functions hooked into cera_single action
    	 *
    	 * @hooked cera_single          - 10
    	 * @hooked cera_grimlock_single - 10
    	 */
    	do_action( 'cera_single' ); ?>
    </article><!-- #post-## -->

    With previous theme I used to put paywall with this function:

    /* Prikazaće određeni broj riječi u postu, a zatim ispod obavijest da je tekst samo za VIP korisnike. */
    function vip_part_text( $atts, $content = null ) {
    if(is_user_logged_in()){
         $content = apply_filters('the_content', get_the_content());
         echo $content;
    } else {
    $more = '
    <br>
    ...
    <br>
    <div class="advert" style="">
    <div class="advert-page" style="">
    <a style="" href="https://mllapan.com/pretplata/" target="_blank">
    <div class="pretplata">Nemate dozvolu da pročitate ovaj članak u potpunosti.
    <br>
    Kupite doživotni VIP pristup svim člancima na stranici.
    <br>
    Uz VIP dobijate 24/7 pomoć na forumu također.
    <br>
    Za više informacija kliknite ovdje.
    <br>
    </a>
    </div>
    </div>
    ';
         $content = apply_filters('the_content', get_the_content());
         echo force_balance_tags( html_entity_decode( wp_trim_words( htmlentities( $content ), 100, $more ) ) );
    }
    }

    With this inside functions.php, I just called the shortcode in single-custom-template.php:
    <?php echo do_shortcode('[vip_part_text]'); ?>

    Now that I am using membership pro with this theme, I found that easiest way to limit text would be to combine this code:

    <?php
    if(pmpro_hasMembershipLevel(array('12','14','Gold')))
    {
    ?>
    //Place your HTML or PHP code here if the user is in the required membership level
    ...
    <?php 
    }
    ?>

    But I am not sure how to implement it on do_action( 'cera_single' );, I mean, I would like to show particular number of words in the post and under that would be an URL that would lead user to buy membership pro in case he is not a membership pro user, if he is, he would be able to see full text.

    So, can you help me to sort this out?

    Manathan
    Keymaster
    Themosaurus Support
    • 0 Topics
    • 6297 Posts
    @themodactyl

    Hi @mllapan,

    Thanks for getting in touch! We’ve received your request and we’ll get you an answer shortly. 🙂

    We’re experiencing a much larger number of requests than usual so our wait times are longer than expected. We’re working hard to get back to you as quickly as we can and we really appreciate your patience!

    We really thank you for your patience!

    In the meantime, feel free to check out our documentation resources for more help:

    FAQ & Support Documentation

    Kind regards,

    Themosaurusrex
    Keymaster
    Themosaurus Support
    • 0 Topics
    • 2048 Posts
    @themosaurusrex

    Hi @mllapan,

    You can achieve this by using the cera_single action, simply hook your function to this action. Please also make sure to remove the functions already hooked to this action if (and only if) necessary. For more about WordPress actions and hooks, please read the following post:
    https://www.wpbeginner.com/glossary/action/

    If you wish to custom code to your site, we recommend that you use the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/). If you have never activated this plugin, please read the following post:

    Adding Custom PHP Without Changing Your Child Theme

    Please also note that we don’t provide any theme customization. So, you shouldn’t expect other snippets from us unless it’s to fix an issue stemming from our own codebase. We always try our best to help theme users whenever we can and only provide code snippets out of courtesy to prevent them from waiting for the next update.

    Regards,

Roboraptor 🦖
Themosaurus Topic Closer

Hi there,

This topic has been inactive for a while now so we will be closing it to keep the forum tidy. Don't hesitate to create a new topic if you still need help and we'll be glad to help you!

Best regards,
The Themosaurus team.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘How to use Membership Pro to create PayWall?’ is closed to new replies.

Troubleshooting Demo Imports

You're trying to setup your theme but you're experiencing errors when importing the demo content? Or you've just followed the setup guide but your website doesn't look exactly like our demo? These are common issues for which you can find easy and quick fixes.

Happy With our Support So Far?

Feel free to review our theme on Themeforest! It helps us making our products more known to new potential customers, which allow us more time to improve the quality and develop new features. #SharingIsCaring ❤️

Discover MatchPress

Skip • Like • Super-Like

Add powerful matching features like Member likes, skips, super likes, conditional private messaging and much more.

Setup Your Cera or Gwangi powered Community Website and Turn it into an iOS and Android App

15% discount for Cera users

To unleash the full power of your Cera or Gwangi theme, we have partnered with the Zipline team. Your community website can now be fully setup and turned into your very own custom app for iOS and Android.

Whether you've newly acquired the theme or already got your site up and running, Zipline got you covered. And we got you an incredible discount.

Holiday, Weather & Festive effects
to pimp your WordPress Site