WordPress.org

Ready to get started?Download WordPress

Forums

Members Area/Login (1 post)

  1. tmontague
    Member
    Posted 9 years ago #

    I'm new to wordpress and trying to customize it to my needs. This one thing is that I'd like to let members signup/register through wordpress and then have a profile in which they can edit. All this happening without giving the member any rights to post, only to comment and have a profile. Now I have hack some of the wordpress code in 2 functions that control the register and login/logout links.


    --> In includes/template-functions-general.php about line 27
    There is wp_loginout function. I hacked it to be this:

    function wp_loginout() {
    global $user_level;
    get_currentuserinfo();

    // BOF --> Login/Logout Mod
    // if (0 == $user_level) :
    if ('' == $user_level) :
    // EOF --> Login/Logout Mod
    $link = '<a href="' . get_settings('siteurl') . '/wp-login.php">' . __('Login') . '</a>';
    else :
    $link = '<a href="' . get_settings('siteurl') . '/wp-login.php?action=logout">' . __('Logout') . '</a>';
    endif;

    echo apply_filters('loginout', $link);
    }

    Then right below wp_loginout function is wp_register and I hacked to be:

    function wp_register( $before = '
    <li>', $after = '</li>
    ' ) {
    global $user_level;

    get_currentuserinfo();

    // BOF --> Login/Logout Mod
    // if (0 == $user_level && get_settings('users_can_register') ) :
    if ('' == $user_level && get_settings('users_can_register') ) :
    $link = $before . '<a href="' . get_settings('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after;
    elseif (0 == $user_level && get_settings('users_can_register') ) :
    $link = $before . '<a href="' . get_settings('siteurl') . '/wp-admin/profile.php">' . __('User Info') . '</a>' . $after;
    // EOF --> Login/Logout Mod
    elseif (0 == $user_level && !get_settings('users_can_register') ) :
    $link = '';
    else :
    $link = $before . '<a href="' . get_settings('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;
    endif;

    echo apply_filters('register', $link);
    }

    I have tested this and it works great. The problem was that the login/logout link wasn't showing a '0' user to be loged in and register wasn't showing 'Site Admin' so I changed it to show logout and 'User Info' on '0' users.

    My question is this safe code? will it open up any holes in the login/logout/register functions? I would be great if you didn't have to hack the core code of wordpress and could just use a plugin. Also to have a Members List so all everyone can see info about everyone else. Any help? Thanks,

    Thomas

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.