latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

About: Roland Kedikian

Sorry, I've not written a description yet. I'll get to it soon!


Topics I'm Subscribed To

Viewing topic 1 (of 1 total)
Topic Count Last Reply
Viewing topic 1 (of 1 total)

Topics I've Started

Viewing topic 1 (of 1 total)
Topic Count Last Reply
Viewing topic 1 (of 1 total)

My Latest Replies (From Various Topics)

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Thursday Jul 26th, 2012 at 9:48 pm #20353

here is what I learned and how I fixed.
the pro login widget checks only if a user is a member of the wordpress network. It does not check if a user is a member of the current blog. So here is how I came up with a solution without changing any of the code of the s2member.

I placed the bellow in the sidebar.php for my theme

<?php 
    if(is_user_logged_in()) {   										// check if the user is logged in because he is a member of the network
		global $current_user;
		get_currentuserinfo();
		if ( is_user_member_of_blog( $current_user->ID ) ) { 			// check if this user is a member of this blog
			echo s2member_pro_login_widget();							// if he is, show the login box which will show the profile links and gavatar since user is logged in.
		} else {
			echo 'You are NOT a member of this blog go to your blog.';	// if he is not, let him know to go back to the blog where he is a member of
			$dc_blogs = get_blogs_of_user( $current_user->id );			// get all the blogs he is a member of
			if($dc_blogs) {
				foreach ( $dc_blogs as $dc_blog ) {						// list a nice link for the blogs he is a member of
					echo '<li><a href="http://' . $dc_blog->domain . $dc_blog->path .'">' .  $dc_blog->blogname . '</a></li>';
				}
			}
		}
	}
    else if(is_user_not_logged_in()) 									// if user not logged in, show the login box
		echo s2member_pro_login_widget();
?>		
		

let me know if you guys have a more elegant solution.
Always looking for more efficient code.

Viewing 1 replies (of 1 total)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.