• Hello. I am using a membership plugin and with this plugin members can earn points. For example, writing a comment gives a point to member.
    My target is restrictions by member points on some pages. I will create a page and only members which have 500 points can access that page. It this possible?

    Points table on mysql (usermeta table);
    https://i.ibb.co/xm7BGK7/puan.jpg
    Id number 1 has 66 points.

    Thanks.

    • This topic was modified 4 years, 10 months ago by Artemitus.
    • This topic was modified 4 years, 10 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • lisa

    (@contentiskey)

    Which membership plugin are you using?

    Create a topic in plugin specific forum to get guidance from team familiar with the features of the membership plugin that is active on your website.

    Thread Starter Artemitus

    (@artemitus)

    Unfortunately my plugin is a premium plugin and i bought plugin on themeforest. And creator does not provide support on this issue.
    I found this code, but its not working ?? Any help?
    —————————

    function deny_pages() {
        $blocked_page_ids = array( 10, 11, 12 ); // page ids.
     
        if( is_user_logged_in() && is_page( $blocked_page_ids ) ) {
            $user_point = (int)get_user_meta( get_current_user_id(), 'points', true );
     
            if( $user_point < 500 ) {
                wp_redirect( home_url( '/' ) );
                exit();
            }
        } else {
            if( is_page( $blocked_page_ids ) ) {
                wp_redirect( home_url( '/' ) );
                exit();
            }
        }
    }
     
    add_action( 'init', 'deny_pages' );
    • This reply was modified 4 years, 10 months ago by Artemitus.
    • This reply was modified 4 years, 10 months ago by Artemitus.
    • This reply was modified 4 years, 10 months ago by Artemitus.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom page restrictions’ is closed to new replies.