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.

Using %%CURRENT_USER_LOGIN%% in a function

Home Forums Community Forum Using %%CURRENT_USER_LOGIN%% in a function

This topic contains 2 replies, has 2 voices. Last updated by  Eduan 4 years, 6 months ago.

Topic Author Topic
Posted: Tuesday Jun 19th, 2012 at 5:04 am #16848

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Thursday Jun 21st, 2012 at 10:07 am #17128

Unfortunately I didn’t get a response to this with a quick fix, but I wanted to help out anyone with a similar query by posting the answer I came up with.

It’s not difficult, it’s just a little outside my comfort zone and I must’ve got the syntax wrong first time, as I swear I tried this once already.

add_filter( 'wp_nav_menu_items', 'add_member_link', 10, 2 );

function add_member_link( $items, $args ) {

    if (is_user_logged_in() && $args->theme_location == 'members') {
        $items .= '<li class="menu-item menu-item-type-post_type menu-item-object-page"><a href="http://www.andyogden.co.uk/members/'.S2MEMBER_CURRENT_USER_LOGIN.'">Member Area</a></li>';
    }
    return $items;

Hope someone finds this useful, especially beginners like me!

Posted: Friday Jun 22nd, 2012 at 11:30 am #17196
Eduan
Username: Eduan
Moderator

Hello Andy,

Thanks for the useful tip. :)

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

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

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.