Prosite retrieve a user blog level in mainsite

Hi there,

I hope all is well with you today, i just was scrolling through prosites code and find this code below. please visit \pro-sites\pro-sites-files\lib\ProSites\View\Front\Gateway.php line 270-272, you will see this snippet. `if ( ! empty( $info_retrieved['level'] ) ) {
$content .= '<li class="psts-level">' . esc_html__( 'Level:', 'psts' ) . ' <strong>' . $info_retrieved['level'] . '</strong></li>';
}`

This code is what a user sees when they visit my website eg. https://mysitename.com/paid-webs/ in that page it shows the user their current level and expiration date. please see the image 1.png

and in this page https://mysitename.com/paid-webs/?action=new_blog thats where the user go and signup for a new blog and it also check whether user is login etc.. so that is fine with me.

what am trying to achieve is how can i used that snippet example at \pro-sites\pro-sites-files\lib\ProSites\View\Front\Gateway.php to show the current login user level when they about to register a new blog at https://mysitename.com/paid-webs/?action=new_blog

the reason why i need to know how to show it in the "/?action=new_blog " section is because i want to limit users based on that prosite level. currently i have this snippet that will prevent all users from being able to register multiple blogs, but i think if am able to retrieve the user level just like how it is being retrieved in "https://mysitename.com/paid-webs/ " i will be able to check if that user level is 1,2,3, etc. and then prevent such user from being able to register multiple blog.

I hope i wasn't confusing anyone :smiley: , my support is still open on my website , you can login and see the links for proper clarification .

  • Tom

    here's the snippet

    /*limit users blog creation based on site level*/
    function limit_user_blog_creation($active_signup) {
    	//prosites
    		global $psts, $level, $blog_id, $user_id;
    		$level = $psts->get_level($blog_id);
    	// get the array of the current user's blogs
    		$blogs = get_blogs_of_user( get_current_user_id() );
    	// all users may be members of blog 1 so remove it from the count, could be a "Dashboard" blog as well
    		if ($blogs["1"]) unset($blogs["1"]);
    	//if the user still has blogs, disable signup else continue with existing active_signup rules at SiteAdmin->Options
    		$n = count($blogs);
     		 $example =  $info_retrieved['level']
    			 //checking if user is belong to 2sites and user level is 1
    		if($n==2 && $example ==1) :
    				$active_signup = false;
    				echo 'you only allowed to signup 1 site please upgrade your current site level etc.. ';
    
    				//starter users
    		endif;
    
    		return	$active_signup; // return "all", "none", "blog" or "user"
    
    }
    add_filter('wpmu_active_signup', 'limit_user_blog_creation');

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.