Pay To Blog Integration

Hey,

Just a couple of questions:

1. Is it possible to integrate the Pay To Blog plugin during sign up so members can choose their plan before they first login?

2. If not, how can we make it so they cannot view their site till they pay for a plan?

Thanks again for your time and support!

  • webgroup
    • Flash Drive

    Thanks for your response drmike.

    any chance for a sample on how I would customize the Pay To Blog plugin so that it redirects the blog to a login page or the payment plan page if the member has not purchased a plan or the plan has expired?

  • Andrew
    • Champion of Loops

    Hiya,

    Are you wanting to keep users from viewing the frontend if the user hasn’t payed? If so there are a couple reasons this wasn’t added to the plugin:

    1) You would have to redirect all users who aren’t logged in to the login form as there is no way to identify the blog owner.

    2) If the users are logged in you’ll have to redirect the blog owner to the admin panel pay to blog page and the other users somewhere else.

    Basically the redirects just for hitting the blog page will most likely frustrate users.

    Thanks,

    Andrew

  • webgroup
    • Flash Drive

    Hi Andrew,

    Thanks for your response.

    Good points. Instead of a redirect, would this be possible: If a user has not chosen a plan or has canceled a plan, could we have the ability to change the default theme and have this theme a welcome page which could encourage the owner of the blog to choose a plan or resubscribe?

  • Andrew
    • Champion of Loops

    Hiya,

    That’s definitely possible. What you would need to do is add a very simple theme and then do a check against the pay to blog status. If it returns false then change the blog theme. To change the blog theme you can just updated the “template” and “stylesheet” blog options.

    You should be able to figure out how to check the blog status by looking at the pay to blog code.

    Thanks,

    Andrew

  • webgroup
    • Flash Drive

    Sorry, is this the code to check?

    function pay_to_blog_blog_check() {
    global $wpdb;
    if ( $wpdb->blogid != 1 && !is_site_admin() ) {
    if ( !strpos($_SERVER['REQUEST_URI'], 'blog') ) {
    $blog_expire = get_option('blog_expire');
    if ( empty( $blog_expire ) || $blog_expire == '0' ) {
    $now = time();
    $now = $now - 30;
    $blog_expire = $demo_period_days = get_site_option( "demo_period_days" );
    $blog_expire = $blog_expire * 86400;
    $blog_expire = $now + $blog_expire;
    update_option('blog_expire', $blog_expire);
    }
    if ( time() > $blog_expire ) {
    echo "
    <SCRIPT LANGUAGE='JavaScript'>
    window.location='blog.php';
    </script>
    ";
    //wp_redirect('blog.php');
    }
    }
    }
    }

  • Andrew
    • Champion of Loops

    That’s it.

    $blog_expire = get_option('blog_expire');
    if ( empty( $blog_expire ) || $blog_expire == '0' ) {
    $now = time();
    $now = $now - 30;
    $blog_expire = $demo_period_days = get_site_option( "demo_period_days" );
    $blog_expire = $blog_expire * 86400;
    $blog_expire = $now + $blog_expire;
    update_option('blog_expire', $blog_expire);
    }
    if ( time() > $blog_expire ) {
    //YOUR THEME CODE HERE
    }

    Thanks,

    Andrew