PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Welcome Page, Replacement Codes and WordPress Navigation

s2Member Plugin. A Membership plugin for WordPress®.

Welcome Page, Replacement Codes and WordPress Navigation

Postby BobTabor » June 23rd, 2011, 5:17 pm

Hi again,

I've created a Welcome page scheme that uses replacement codes. So:

http://members.learnvisualstudio.net/welcome-%%current_user_level%%

Produces:

http://members.learnvisualstudio.net/welcome-0
http://members.learnvisualstudio.net/welcome-1
etc.

I've envisioned the "welcome" page as the "members' home" page, and want to create a link in navigation to get back to this page. However, having tried to create a custom menu option in WordPress' menu using the replacement code, I see that is not possible.

(1) Can you help me determine what my options are?

(2) Am I thinking of the "welcome" page all wrong? I definitely need to display different info to different users after login, but I also need them to be able to get BACK there.

Thanks!
Bob
User avatar
BobTabor
Experienced User
Experienced User
 
Posts: 84
Joined: April 28, 2011

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby Cristián Lávaque » June 23rd, 2011, 9:50 pm

Well, you can use the constant for the user's level S2MEMBER_CURRENT_USER_ACCESS_LEVEL.

Code: Select all
if (is_user_logged_in())
    echo '<a href="/welcome-', S2MEMBER_CURRENT_USER_ACCESS_LEVEL, '">Members Home</a>';
 
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby BobTabor » June 24th, 2011, 9:45 am

Ok, that's cool ... but is there no way to get that injected into WordPress' menu? (See image ... I'm trying to get it in there)
Attachments
Screen shot 2011-06-24 at 9.43.36 AM.png
Tried the custom link w/ replacement code as pictured but that didn't work.
User avatar
BobTabor
Experienced User
Experienced User
 
Posts: 84
Joined: April 28, 2011

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby BobTabor » June 24th, 2011, 10:48 am

Ok this is kind of what I'm looking for:

viewtopic.php?f=4&t=10236&p=21366

... I would just add to Jason that, if you could, optionally allow to show / hide individual menu options BY MEMBERSHIP LEVEL. In one case, I want to show the appropriate "Home" link in the menu using S2MEMBER_CURRENT_USER_ACCESS_LEVEL (authorized). In another case, I want to show ALL links in the menu based on whether the user is logged in / (authenticated) or not. Thanks!

Any good resources on modifying menus in themes? I'm off to search for that now.
User avatar
BobTabor
Experienced User
Experienced User
 
Posts: 84
Joined: April 28, 2011

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby BobTabor » June 24th, 2011, 11:10 am

Solved:

(1) Open up the functions.php file FOR YOUR GIVEN THEME to edit
(2) Add this function at the very bottom (before the closing ?> ):

Code: Select all

    
// BOB ADDED THIS!  Adds the correct member level member home page!
    
function new_nav_menu_items($items) {
    
        if (
is_user_logged_in())
            
$homelink '<li><a href="/welcome-' S2MEMBER_CURRENT_USER_ACCESS_LEVEL.'">Members Home</a></li>';

        
$items $homelink $items;
        return 
$items;
    }
    
add_filter'wp_nav_menu_items''new_nav_menu_items' );
 


For more information, see:

http://wpfirstaid.com/tag/wp_nav_menu/
User avatar
BobTabor
Experienced User
Experienced User
 
Posts: 84
Joined: April 28, 2011

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby Cristián Lávaque » June 24th, 2011, 12:46 pm

Glad you solved it, Bob. Thanks for sharing the solution. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby cassel » June 26th, 2011, 3:02 pm

This is probably just what i need although i want it conditional to a Custom Capability package.
Would someone be nice enough to point me to what part needs editing for it (i am a little confused with what all those mean):
- navigation tab to hide: forum
- link to that page: mydomain/forum-2
- ccap: forum
Only those who will have purchased one package including "forum" as part of the ccap should see and access that page.
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby Cristián Lávaque » June 26th, 2011, 7:26 pm

See the conditional check is_user_logged_in()? You'd change that to current_user_can('access_s2member_ccap_forum'). In the next line you edit the link.

I hope that helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby cassel » June 26th, 2011, 7:28 pm

Thanks! going to try it now!
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby cassel » June 26th, 2011, 7:59 pm

Almost there (sorry i am dense). I changed the conditional but when you say "In the next line you edit the link", i can do that, however, this line:

$items = $homelink . $items;

In Bob's example, he refers to the home page, is that previous line pointing specifically to the home page? Do i have to change it for another page/tab in the navigation?
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby cassel » June 26th, 2011, 8:11 pm

I am getting an error pointing to this line:
add_filter( 'wp_nav_menu_items', 'new_nav_menu_items' );

Was i supposed to edit it too somehow?
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby Cristián Lávaque » June 26th, 2011, 8:30 pm

By "next line" I meant the very next one after the if condition, the one that starts with $homelink =. The line you quoted is where you concatenate your new nav item to the other ones.

I'm not sure about the error, maybe you want to ask your theme's developer in case his theme works differently for this kind of thing.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby cassel » June 26th, 2011, 8:40 pm

hum... ok. Checking again.
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby presson » September 2nd, 2011, 4:36 pm

What ended up happening cassel? I have added some of these codes to a data management solution so that if needed I can go back via ediscovery and overlook some of what has gone on in the past. You should contact me and I will share with you just how the process works. Have you ever heard of StoredIQ? They are an information governance tech group.
Last edited by presson on September 22nd, 2011, 4:18 pm, edited 1 time in total.
User avatar
presson
Registered User
Registered User
 
Posts: 4
Joined: August 30, 2011

Re: Welcome Page, Replacement Codes and WordPress Navigation

Postby cassel » September 2nd, 2011, 4:58 pm

I ended up not using that coding, but instead, redirecting to the page according to the ccaps of the user clicking on it. So now, i have two pages:
- one page that is a sales pitch, with all the selling blahblah, NO breadcrumbs and NO navigation
- one page with the actual links to the class videos, with the breadcrumbs and navigation

If you go to the section in the navigation, you will go here:
http://scrapbookcampus.com/register-bas ... -with-psp/

But if you are already registered for that course, it will direct you to this page instead:
http://scrapbookcampus.com/welcome-to-t ... ng-course/

It works for me.

Here is the thread that helped me: viewtopic.php?f=4&t=14376&hilit=redirect
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 2 guests

cron