Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to add profilr in bbprees?


  • rsbthebest
    Participant

    @rsbthebest

    I want to add profilr like one here where user can enter some details and it shows all its replies and topics. How to do that?

Viewing 1 replies (of 1 total)

  • Robin W
    Moderator

    @robin-w

    That is quite complicated.

    However this will add ‘edit profile’ to you menu if you put it in your function file !

    // Filter wp_nav_menu() to add profile link
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
    function my_nav_menu_profile_link($menu) { 	
    	if (is_user_logged_in()) {
    		$current_user = wp_get_current_user();
    		$user=$current_user->user_login ;
    		//Lower case everything
    		$user = strtolower($user);
    		//Make alphanumeric (removes all other characters)
    		$user = preg_replace("/[^a-z0-9_\s-]/", "", $user);
    		//Clean up multiple dashes or whitespaces
    		$user = preg_replace("/[\s-]+/", " ", $user);
    		//Convert whitespaces and underscore to dash
    		$user = preg_replace("/[\s_]/", "-", $user);
    		$profilelink = '<li><a href="/forums/users/' . $user . '/edit">Edit Profile</a></li>';
    		$menu = $menu . $profilelink;
    		return $menu;
    	
    }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.