WPMU DEV Members receive personal, comprehensive and timely support and assistance from experienced WPMU and BuddyPress developers.

Helping beginners and advanced users since 2005
Join WPMU DEV Today
And transform your WPMU or BuddyPress site
Includes Unlimited Access to:

Private Members
Only Forum

Live Chat Help
and Support

Comprehensive
"How To" Videos

WPMU and BuddyPress
Manuals and More

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.

Help & Support from WPMU Dev members and staff

There isn't a specific function, but you can see what code to use to check in the function named something like *_check_blog().

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.

bump

Hi holidaymaine, check the support staff hours on the right of the post box, no need to bump... also, I'm not a developer but I'm pretty sure that you could provide a bit more info, maybe a chart of how you want stuff to work?

bump?

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 you.most of it I already had prepared the only part that was missing was the get_blog_option() instead of get_option()
I got it resolved by plugin support and code.
Thank you.

Reply

You must log in to post.


To post your questions, and access all of our plugins, themes and support - become a member today.