Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+8 votes
754 views
in Q2A Core by

Just a hint how I would simplify the navigation on top for each logged in user:

Instead of:

(30,450 points)

 

I would merge "My Account" into the user's page, for this example "echteinfachtv (Kai)".

In other words, clicking on my username brings me to: http://question2answer.org/qa/user/echteinfachtv+%28Kai%29 ("My details") which is the same page as "My Account", but there I cannot edit. Why not put an obvioius "edit my data" button on this page?

Furthermore, "My favorites" (at My Account) can be put as a subnavigation at the user page.

Reducing the navigation like that would make it much easier to understand.

Kai

 

The new navigation would be:

(30,450 points)

 

Q2A version: 1.6
by
yep, I hope gidgreen will have a look to the screenshots I posted below. That would be a better solution.
by
Please take a look at the way it's done now on http://www.question2answer.org/qa/ and let know if that works for you.
by
it seems to work. Different from my proposal, I see no edit button on the profile page but the "my account" sub-menu that brings my to the edit form.
by
The edit button is below the form - this is how all Q2A forms work, at least for now :)

3 Answers

+2 votes
by
edited by

All right, here are the things you have to change (should work with q2a v1.5.4 and 1.6 / 1.6.1):

1. modify qa-page-user.php to output "edit profile" button on user's profile page:

Insert after line:
qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'users/add_user_x_favorites', $handle));

This code:

if($userid == qa_get_logged_in_userid()) {
         $qa_content['custom_btn']='<a class="yourbuttoncss" style="position:absolute;top:50px;right:0;" href="../account">Edit Profile</a>';
}

 

2. Add subnavigation "favorites" to user's profile page

Using an advanced theme, add the blue code block to an override of nav_main_sub():

function nav_main_sub() {
    $this->output('custom stuff');
    $this->nav('main');
    $this->nav('sub');

// add subnavigation 'favorites' to user page
if($this->template=='user') {
    $myhandle = basename( qa_path_html(qa_get_logged_in_handle()) );
    $myurl = strtok($_SERVER['REQUEST_URI'],'?');
    if($myurl == '/user/'.$myhandle){
        $this->content['navigation']['sub']['favorites'] = array(
                'label' => qa_lang_html('misc/nav_my_favorites'),
                'url' => qa_path_html('favorites'),
        );
    }
}

}

3. Remove "My Account" link from navigation on top (link is not needed anymore)

Open your theme's CSS file, and add: .qa-nav-user-account {display:none}

 

4. {Remove] subnavigation on favorites and account page (is optional, must be improved)

Instead of removing the subnav, I actually would like to display the same subnavigation as on the user's profile page, but don't know yet how to. That's why I removed the subnav for now by using CSS: .qa-template-account .qa-nav-sub, .qa-template-favorites .qa-nav-sub {display:none}

 

DONE!

.qa-nav-user-account {display:none}
.qa-nav-user-account {display:none}
.qa-nav-user-account {display:none}
.qa-nav-user-account {display:none}
.qa-nav-user-account {display:none}
by
edited by
Regard n°1: If you use a plugin that uses the URL with a parameter, such as the badges plugin with /username?tab=badges

then the edit button will appear on this site as well, to prevent this, change the if from n°1 to:

    if($userid == qa_get_logged_in_userid() && !strpos(@$_SERVER[REQUEST_URI], '?')) {
...
+2 votes
by
edited by

Here are some screenshots of the result in snow theme:

"My account" got removed:

mockup1

 

Edit button added:

s2

0 votes
by
It's quite a sensible idea, but is quite a major code change, so not really suitable for a minor update. Perhaps in Q2A 1.7 :)
by
edited by
Well, the code change above I did within 5 min ;)

If you do it, our q2a developers and forum users will love it :-)
by
Do you mean you just added an edit button that takes the user to the account page, rather than allowing all the editing within the user page. Yes, that would be easier...
by
I mean n°1, 2 and 3 as stated in my other answer above =)
I counted 13 lines PHP and 1 line CSS ;-)
by
You can also see the new version in the screenshot: http://www.question2answer.org/qa/?qa=blob&qa_blobid=3341497590198499141
by
Thanks for implementing it in v1.6.3 (!)
...