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: Andy White

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


My Favorite Topics

Viewing 2 topics - 1 through 2 (of 2 total)
Topic Count Last Reply
Tag page listing all posts

By:  Andy White in: Community Forum

voices: 2
replies: 11

4 years, 9 months ago  Raam Dev

Doing things with menus based on member level

By:  Andy White in: Community Forum

voices: 3
replies: 15

4 years, 10 months ago  Cristián Lávaque

Viewing 2 topics - 1 through 2 (of 2 total)

Topics I'm Subscribed To

Viewing 3 topics - 1 through 3 (of 3 total)
Topic Count Last Reply
S2 Member apparently killing my load times

By:  Andy White in: Community Forum

voices: 3
replies: 6

4 years, 6 months ago  Cristián Lávaque

Tag page listing all posts

By:  Andy White in: Community Forum

voices: 2
replies: 11

4 years, 9 months ago  Raam Dev

Doing things with menus based on member level

By:  Andy White in: Community Forum

voices: 3
replies: 15

4 years, 10 months ago  Cristián Lávaque

Viewing 3 topics - 1 through 3 (of 3 total)

Topics I've Started

Viewing 3 topics - 1 through 3 (of 3 total)
Topic Count Last Reply
S2 Member apparently killing my load times

By:  Andy White in: Community Forum

voices: 3
replies: 6

4 years, 6 months ago  Cristián Lávaque

Tag page listing all posts

By:  Andy White in: Community Forum

voices: 2
replies: 11

4 years, 9 months ago  Raam Dev

Doing things with menus based on member level

By:  Andy White in: Community Forum

voices: 3
replies: 15

4 years, 10 months ago  Cristián Lávaque

Viewing 3 topics - 1 through 3 (of 3 total)

My Latest Replies (From Various Topics)

Viewing 16 replies - 1 through 16 (of 16 total)
Author Replies
Author Replies
Posted: Tuesday Jun 26th, 2012 at 4:10 am #17498
Andy White
Username: 58twelve

Thanks Cristian.

Posted: Monday Jun 25th, 2012 at 12:20 pm #17387
Andy White
Username: 58twelve

Thanks Kati. I totally missed that thread. Have tried the s2-hack option. NOt sure if it’s had any effect, but we’ll see. Thanks for the pointer.

Posted: Thursday Mar 15th, 2012 at 6:39 pm #8294
Andy White
Username: 58twelve

I have asked a couple of people to kick the tag section hard and they confirm it works. Sweet! Thanks for inspiring the thought processes!

Posted: Wednesday Mar 14th, 2012 at 5:54 pm #8169
Andy White
Username: 58twelve

I think I have done it!! Posting in case I have (it seems to work) and it is useful for someone else…

Using the ‘Member’ tag (this will rely on user discipline to hold-up) I have combined a few things:

Set up a tag.php, tag-subscriber.php and tag-member.php template.

tag.php has the following:

<?php get_header(); ?>

	<?php
	if (current_user_can('access_s2member_level1')) { get_template_part( 'tag', 'member' ); }  
	elseif (is_user_logged_in()) { get_template_part( 'tag', 'subscriber' ); } 
	?>
	
<?php get_footer(); ?>

Then the two other templates contain the loop pulling the content as I want it, but the tag-subscriber.php template has the following:

<?php while ( have_posts() ) : the_post();
if (has_tag('Member') ) continue; 
?>

As far as I can tell, as long as all L1 member resources include the tag ‘Member’ then they will be passed over when the tag archive is generated for a Subscriber. Like I said, the person inputting will have to be disciplined, but from teh testing I have done, it seems to work.

What do you think Raam: am I up another blind alley or may this hold up in the real world?

Thanks

Andy

Posted: Wednesday Mar 14th, 2012 at 4:37 pm #8161
Andy White
Username: 58twelve

Hi Raam

Did you see my post re trying to filter based on an additional tag of Subscriber or Member. Could that work, and if so, how?

Thanks

Andy

Posted: Wednesday Mar 14th, 2012 at 4:08 pm #8156
Andy White
Username: 58twelve

Right, I am trying another approach, but hitting the same difficulties. I thought that if I allow free tagging but insist that either the ‘Subscriber’ tag or ‘Member’ tag is added then I should be able to restrict the tag archive display based on that, but I am still getting all of the posts listed – even the ones that can’t actually be accessed.

How can I get a post that may have multiple tags, but one of which is ‘Member’ not to show up in the listing on the tag archive page that is seen by a Subscriber?

I’m sure it must be do-able, but the examples in the API/Scripting don’t seem to work for this – although I am probably doing something wrong in applying them.

I tried the example 4 you suggested in the loop and outside the loop (can you tell I was not sure how to apply it :-) ) and nothing happened, and I didn’t know what needed changing from the raw example, or what to change it to if it did.

Any help much appreciated.

thanks

Andy

Posted: Wednesday Mar 14th, 2012 at 3:42 pm #8153
Andy White
Username: 58twelve

Scratch that. Success was shortlived. ALl that is doing is listing all posts in that category and not showing the tag archive at all :-(

Posted: Wednesday Mar 14th, 2012 at 3:38 pm #8152
Andy White
Username: 58twelve

Hi Raam

Thanks so much for helping me out. I couldn’t get that example working – not sure what I was doing wrong, but it got me thinking so I had a dig around and I appear to have come up with something that seems to work as far as my testing is showing so far…

<?php 
if (current_user_can('access_s2member_level1')) {
query_posts('showposts=10&cat=1,6,7,8,9,10,11,12,13,14,15,16'); }
		
elseif (is_user_logged_in()) { 
query_posts('showposts=10&cat=1,6,7,8,9'); }
?>

My knowledge is pretty limited, but I just applied a bit of (what was in my view, at least) logic and it seems to be filtering the tag listing in accordance with membership rights. Does that sound right to you?

Thanks again! I’d be really grateful if you can tell me if that’s a robust solution, or not, or whether I need to rethink as it isn’t as robust as it seems to be.

Andy

Posted: Friday Mar 9th, 2012 at 7:24 am #7719
Andy White
Username: 58twelve

Ok, I am answering my own question here:

Just used your code in the template and the super-admin sees the right stuff now. I guess I was restricting it by being level specific in my conditional where yours is more open – with the whole can_access thing going on instead of s2member_level thing that I had going on. Good piece of learning for me there – thanks!

Out of interest, what level is a super-admin?

Thanks for getting me out of this dead end Cristian and Cassell – very much appreciated.

Andy

Posted: Friday Mar 9th, 2012 at 7:20 am #7718
Andy White
Username: 58twelve

Thanks for the code Cristian – much neater! I am learning so much in such a short space of time on this project. Properly awesome!

I have nailed the issue. It’s to do with Super-Admin. I created a new user and gave them super-admin on all the sites in the network. Then took super admin off me. Once I did that it all worked for me, but the new super admin gets the ‘you can’t access this’ message.

I am guessing this is to do with my lack of knowledge re network setups, but have I done something wrong?

Thanks for your help!

Andy

Posted: Friday Mar 9th, 2012 at 1:53 am #7692
Andy White
Username: 58twelve

Like you, I have limited knowledge in all of this, but as far as I know the reason the } is followed by a closing of the php statement is that non-php code follows, so you have to close it, put in your html then open a new <?php until you get to the next lot of html.

I think that because I am using all php functions I am OK without doing that.

The conditional itself is working great, it's just not functioning for existing users – it's as if it is not recognizing the S2 Member levels.

I have a meeting this morning but after that I am going to see if assigning a different level to an existing user has any effect to try and isolate if it is just a database thing with membership assignments that needs nudging to change or if it is connected to the user itself. I am hoping not to need to delete and recreate users!

If any of the devs can throw some light on this before I have to do anything drastic, that'd be much appreciated, an in the meantime, once again, thanks for all your input, Cassell

Andy

Posted: Thursday Mar 8th, 2012 at 3:56 pm #7648
Andy White
Username: 58twelve

Yeah – I have tried it with another user. Same result.

They are spaces, but they don’t seem to affect it running. I usually put them in to help me follow what’s going on, but that may well be the wrong thing to do?

Posted: Thursday Mar 8th, 2012 at 3:03 pm #7641
Andy White
Username: 58twelve

Thanks Cassell. I really appreciate your help. I have the conditional working perfectly now, but only for new users. Despite my user list showing me as a level 4 member, with this conditional I get the ‘you can’t access this’ message. Yet, for a new user I set up at L4 they see what they should see, as does a user I set up at L1. If Christian or Raam can help ith highlighting what I am doing wrong there, that’d be fantastic.

Cassell, once again, thanks for steering me in the right direction and taking the time to respond. For anyone who may be interested, here is te conditional that now works:

<?php if (current_user_is("s2member_level4")){
     wp_nav_menu (array ("theme_location" => "resources-level-1"));
     wp_nav_menu (array ("theme_location" => "resources-level-2"));
	 } 
 	
 	else if (current_user_is("s2member_level3")){
     wp_nav_menu (array ("theme_location" => "resources-level-1"));
     wp_nav_menu (array ("theme_location" => "resources-level-2"));
	} 
 
 	else if (current_user_is("s2member_level2")){
     wp_nav_menu (array ("theme_location" => "resources-level-1"));
     wp_nav_menu (array ("theme_location" => "resources-level-2"));
	 } 
 
 	else if (current_user_is("s2member_level1")){
     wp_nav_menu (array ("theme_location" => "resources-level-1"));
     wp_nav_menu (array ("theme_location" => "resources-level-2"));
	} 
 	
 	else if (current_user_is("s2member_level0")){
     wp_nav_menu (array ("theme_location" => "resources-level-1"));
 	}
 	
 	else { ?>
    You can't access this
 	<?php } 
 ?>

This was executed after first following the instructions here: http://www.primothemes.com/forums/viewtopic.php?t=707&p=54152 to register the menus.

I can’t figure out why I am having issues with existing users, though. So, any help from anyone with that would be much appreciated.

Cheers

Andy

Posted: Thursday Mar 8th, 2012 at 2:49 pm #7638
Andy White
Username: 58twelve

Now here’s a twist. Created a new user with L4 and that user sees what they should see. It seems to be with existing members that I am having the issue. Weird. Any thoughts?

Posted: Thursday Mar 8th, 2012 at 2:30 pm #7636
Andy White
Username: 58twelve

Thanks Cassell. I thought I’d cracked it when I followed your link, but I must be doing something very wrong.

My S@ Member level is 4, but I get the ‘else’ result when I try this:

<?php if (current_user_is("s2member_level4")){
    wp_nav_menu (array ("theme_location" => "resources-level-2"));
 } 
	
	else if (current_user_is("s2member_level3")){
    wp_nav_menu (array ("theme_location" => "resources-level-2"));
} 

	else if (current_user_is("s2member_level2")){
    wp_nav_menu (array ("theme_location" => "resources-level-2"));
 } 

	else if (current_user_is("s2member_level1")){
    wp_nav_menu (array ("theme_location" => "resources-level-2"));
} 
	
	else if (current_user_is("s2member_level0")){
    wp_nav_menu (array ("theme_location" => "resources-level-1"));
	}
	
	else { ?>
   You can't access this
	<?php } 
?>

I know you said you aren’t a tech, but you are doing a great job of helping me out, so if you have anything you can throw on why this isn’t working, it’d be much appreciated :-)

Thanks for your help!

Andy

Posted: Thursday Mar 8th, 2012 at 1:49 pm #7632
Andy White
Username: 58twelve

Hi Cassell

Thanks for stepping in!

That is something I wondered about doing – I thought maybe I was trying to be too clever using the wp_navs, but I still couldn’t find anywhere how to set the conditional based on member level.

I’m guessing if I could get the conditional to work for teh way you suggested it ought to work for the alternative, but I am utterly stumped.

How did you make the conditional work?

Viewing 16 replies - 1 through 16 (of 16 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.