Pay to blog plugin rules

Ok I will explain exactly what I need. I need blog admins to only be able to see the comment template on the main blog when they have paid to blog. when their pay to blog subscription runs out they should not be able to see the comment template any more.
in normal wordpress functions I think it would be
if (pay_to_blog(inactive) {
do this
} else {
do that
}
but I have no idea how your plugin determine when a blog is inactive and how to call that function.
Can someone please help me.

  • holidaymaine
    • Flash Drive

    Ok i got the first 2 parts of the code I need.
    I need help with this even if only to point me in a direction of something remotely close.
    I am using the pay to blog plugin an I need to put this code in the theme of the main blog

    <?php 
    
    			$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 "yes";
    
                                      } else {
                                    echo "no";
    			}
    
    ?>

    o i need it to get the expired blog by the current users blogId. I already know how to get the blog id of the current user, but I don't know how to write the code.
    Example: $blog_expire = get_option('blog_expire->$user_blog->userblog_id'); or $blog_expire = get_option('blog_expire') == $user_blog->userblog_id;

    I hope that made sense.
    any help would be welcomed even a link to something you think might help.

  • Aaron
    • CTO

    Getting a blog id from a user is not a simple task as it's not a one-to-one ration. Basically you would need to use the $blog = get_active_blog_for_user( $user_id ) function to return blog details object from their main blog, then $blog->blog_id will give you the id. Then use get_blog_option() to get the expiration.

    You should know though that get_active_blog_for_user() depends on the primary blog being set in usermeta, if its not it will pull the next one they are a member of, or the dashboard blog if they are not a member of any other. You should also check if they are an admin of the blog returned.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.