Page 1 of 1

hide protected pages link from the nav

PostPosted: May 1st, 2011, 5:11 pm
by maxim
Hi,

before I bury myself in the API scripting and Thesis customization - just wanted to know if it's possible to hide the links to protected pages from the nav. My client wants to have his employees access certain areas of the site which are not accessible to unregistered users. There are no payments required. If this is not the right plug-in to use I'm open to suggestions!

Along with that - is there a way to remove the registration link from the login page?

Thanks!

Max

Re: hide protected pages link from the nav

PostPosted: May 1st, 2011, 7:16 pm
by Cristián Lávaque
Hi Max. :)

You can close free registrations, which will remove the link to the registration page from the login one. WP Admin -> s2Member -> General Options -> Open Registration / Free Subscribers

To hide protected pages from the navigation, take a look at the advanced query conditionals. WP Admin -> s2Member -> API / Scripting -> Advanced Query Conditionals

I hope that helps.

Re: hide protected pages link from the nav

PostPosted: May 2nd, 2011, 7:28 am
by camillemm
I had to change my theme to get such a navigation - the previous one was very complicated as comics template. I don't know if there is a simple solution but as the next-previous function does not manage multiple categories well, I created one navigation for non-members (with a public category) and another one for members including private category.

Re: hide protected pages link from the nav

PostPosted: June 5th, 2011, 2:11 pm
by LarsW
Hi Christián,
I need to hide protected pages from the Nav when not logged in but I don't understand which code I need to use of them and where to paste it on my site? Now it looks messy with ALL pages showing to all people coming to the blog in the Nav and when clicked on they redirect to membership.
Regards / Lars

Re: hide protected pages link from the nav

PostPosted: June 6th, 2011, 3:25 am
by Cristián Lávaque
To hide protected pages from the navigation, take a look at the advanced query conditionals. WP Admin -> s2Member -> API / Scripting -> Advanced Query Conditionals

In addition, there are two special functions that can be applied by theme authors before making custom queries: attach_s2member_query_filters(), detach_s2member_query_filters(). These can be used before and after a call to query_posts() for example. s2Member will automatically filter all protected content ( not available to the current User/Member ).


Look at examples 1 and 2 in that panel.

You'd use this in your template where the pages navigation is.

Re: hide protected pages link from the nav

PostPosted: June 7th, 2011, 4:57 pm
by LarsW
Hi Christían,
Thanks for your quick reply but I still don't get out what to put in for take the protected pages away from the Nav:

Example #1: Full access for anyone that is logged in.

Code: Select all
<?php if(is_user_logged_in()){ ?>
    Content for anyone that is logged in, regardless of their Membership Level.
<?php } else { ?>
    Some public content.
<?php ?>


What should I put in the first "Content for anyone.." If I want to show the protected pages in the Nav e.g. page 12,15?
And what should I write in the second part "Some public.." that only should show the unprotected pages?

Take care / Lars

Re: hide protected pages link from the nav

PostPosted: June 8th, 2011, 10:21 pm
by fcp2011
Lars,

This needs to be custom programed into your theme. I have a guy that did mine for me. I set up 5 different menus and added the pages I wanted based on each membership type. Then, I registered the menus in wordpress. Then the guy put the code in the wordpress that reads the cookie that s2member sets when the user logs in and posts that nav bar.

Is this what you want or envisioned? If so, email PM for the guys info.

Re: hide protected pages link from the nav

PostPosted: June 8th, 2011, 10:23 pm
by fcp2011
For instance, here is the code that is in my header file:

Code: Select all
<div class="nav">
                <?php 
                if
(!is_user_logged_in()) {
                    if(has_nav_menu('main-menu')) {
                        wp_nav_menu(array(
                            'theme_location' => 'main-menu',
                            'container' => 'ul',
                            'walker' => new UDS_Menu_Walker
                            
));
                    } else {
                        wp_nav_menu(array(
                            'container' => 'ul'
                        ));
                    }
                } else {
                    if(has_nav_menu('primary-level'.S2MEMBER_CURRENT_USER_ACCESS_LEVEL)) {
                        wp_nav_menu(array(
                            'theme_location' => 'primary-level'.S2MEMBER_CURRENT_USER_ACCESS_LEVEL,
                            'container' => 'ul',
                            'walker' => new UDS_Menu_Walker
                            
));
                    } else {
                        wp_nav_menu(array(
                            'container' => 'ul'
                        ));
                    }
                }
                ?>
            </div>

Re: hide protected pages link from the nav

PostPosted: June 10th, 2011, 3:30 pm
by LarsW
Thanks for your reply. But I don't know why all seems to be so difficult. Normally I use DAP (Digital Access Pass) and it is a membership plugin that is so easy to use. I am testbuilding a site for a non profit organization (with nearly zero budget). They have office in 5 cities and there is one web responsible for each city, and then 1 webmaster.

I built a standard WP-site that worked perfect with what should be presented and what was for members for each place. BUT, since it get around 120 pages and growing it is no good for handling in an easy way for the pages since it is for 5 places with each responsible for theirs and then main pages that is handled by the central webmaster.

DAP can easily handle the 10 levels of members (around 400) and show on the same URL the different Nav-tabs depending of the member that is logged in. There is no payment for any level and the members are set manual to different levels when they are ready with the knowledge for each.

BUT for making it much easier for the different sites (web-responsible) to reach only their pages and posts I tested WP Network and that is great for handling this BUT then DAP can't work in WP Multisite, It can hide and show the right pages BUT they don't protect them and they can be reach if you know the different URL (don't know if it's a kind of virtual pages/blog's). It is working with 6 blogs joined in MU.

So I was happy to reach s2Member when surfing looking for a Multisite Network membership plugin, BUT it still seems to be very hard to use and a lot of coding (DAP was nearly zero coding). So now I don't know if I will continue to try learning s2Member or try to find another more user friendly plugin.

Regards / Lars

Re: hide protected pages link from the nav

PostPosted: June 11th, 2011, 10:00 am
by fcp2011
Having been in a similiar situation as you, I can tell you there aren't any perfect matches. At some point, customization is almost always necessary as no plugin can meet everyone's needs. The cool thing about wordpress is that it is very well supported and there are some wonderful programers out there that can make things happen relatively cheap. Good luch on your venture. WP-Member may work for you, but I don't know of any plugin that hides the nav bar for you as of WP V3.0.

Re: hide protected pages link from the nav

PostPosted: June 11th, 2011, 3:21 pm
by LarsW
Yes, I can understand that there is need for modification and some programming. The problem is that my need seems to be so basic (and yes DAP Digital Access Pass) handles it perfectly BUT only if I use a standard blog NOT if I use Multisite then it don't protect the site.

There is need only for 2 choices (and no free join, the admin set up each user as member and no cost).

One part is public to all and s2Member handle that. The second and last part is WHEN I put a page as member this gives now that page is still showing up on the public Nav-bar.

There is need only for Public Nav-bar and member NAV-bar (= protected page) and ALL pages that is protected should NOT show up when not logged in as member and also when logged in the public Nav-bar shouldn't show up.

It seems so basic so I don't understand why there isn't such plugin?

Re: hide protected pages link from the nav

PostPosted: June 13th, 2011, 11:06 pm
by Cristián Lávaque
Lars, that is planned for a future release and Jason just bumped its priority in the to-do list. I hope it'll be available soon. :)

Re: hide protected pages link from the nav

PostPosted: June 27th, 2011, 3:41 pm
by LarsW
Hi Cristián,
I am tight on schedule for a version to be ready start August so I need to make a good working version asap.
Do you think there is a Beta-version that include that as I can test.

Then you also have me tweak and see if there is any problem, must be ready with the Multisite and this is one of the last pieces that I miss. Otherwise I need to look for other membership script that can handle the problem.

Take care / Lars

Re: hide protected pages link from the nav

PostPosted: June 28th, 2011, 12:16 am
by Cristián Lávaque
I'll ask Jason, but in the meantime, do these related threads help you in any way?

viewtopic.php?f=4&t=10298
viewtopic.php?f=4&t=10273#p21608

Re: hide protected pages link from the nav

PostPosted: June 28th, 2011, 12:31 am
by Cristián Lávaque
I just confirmed that there isn't something ready to beta test for this yet.

Re: hide protected pages link from the nav

PostPosted: June 28th, 2011, 8:34 am
by LarsW
Thanks Christián I will check if I can use those threads. (But I hope that the beta is coming soon and that I get a chance to test because it make it much easier).

Re: hide protected pages link from the nav

PostPosted: June 28th, 2011, 2:44 pm
by Cristián Lávaque
Yeah, I agree it'll be much easier.