Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of John Hart
    John Hart
    Participant

    @struth

    I was quietly hoping you would figure this out, well done Lars.

    Will test it out in adminbarbegone tomorrow, looks good, Thanks for being open with you code and posting, this will help me alot. I couldn’t get this code to redirect not logged in users to the registration page but then, I’m a n00b with php; lol

    s2Members uses ! a lot in short code
    [s2If !is_user_logged_in()]if user is not logged in show this [/s2If]

    @paintermommy might find s2Members quite useful at soulwomansanctuary but it looks like she has sorted it out

    Next I need to work on an admin page to switch functions on and off, should be fun but I keep getting side tracked with responsibilities.

    Avatar of John Hart
    John Hart
    Participant

    @struth

    I just hijacked Mr Jacoby code:

    add_action('after_setup_theme', 'remove_admin_bar');     // remove admin bar for users
    
    function remove_admin_bar() {
    if (!current_user_can('administrator') && !is_admin()) {
      show_admin_bar(false);
    }
    }
    
     function redirect2profile(){
    	include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    	if($_SERVER['REQUEST_URI'] == '/profile/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){     //show buddypress user profile page
    		global $current_user;
    		wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/profile/'); 
    		exit();
    	}
     }
    add_action('init', 'redirect2profile');
    
    ?>

    Into a plugin for those who don’t know how, or just don’t want to add this code to the functions.php file. you can download it HERE

    Removes the admin bar for all users except Administrators and gets “global $current_user;” profile to a page you create called Profile as described by jackreichert

    I’ve said it before but I’m going to say it again – you’re a genius Mr Jacoby

    Avatar of John Hart
    John Hart
    Participant

    @struth

    @jackreichert your a bloody genius Mr Jacoby, buddyPress just gets better & then some, thanks you mate!

    Do you mind if I include your code in my “n00bish” wp plugin:

    function redirect2profile(){
    include_once( ABSPATH . ‘wp-admin/includes/plugin.php’ );
    if($_SERVER['REQUEST_URI'] == ‘/profile/’ && is_plugin_active(‘buddypress/bp-loader.php’) && is_user_logged_in()){
    global $current_user;
    wp_redirect( get_bloginfo(‘url’) . ‘/members/’. $current_user->user_login . ‘/profile/’);
    exit();
    }
    }
    add_action(‘init’, ‘redirect2profile’);

    I’m just beginning my journey into php & I’ve always wanted to write a toolbox for wp and buddy, you gotta start somewhere : )

    PS:Do I credit you in the plugin as a contributor?

    Best Regards
    John Hart

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