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

Once somebody requested that the order of the question buttons / answer buttons should not be:

   for admin: [edit] [flag] [close] [hide] [answer] [comment]
   and for users: [flag] [answer] [comment]

But rather a more consistent order:

   for admin: [answer] [comment] [edit] [flag] [close] [hide]
   and for users: [answer] [comment] [flag]

I changed the core file qa-page-question-view.php to reposition the buttons. It is easy.

@gidgreen: Maybe you consider this.

Q2A version: 1.6.1

2 Answers

+2 votes
by
selected by
 
Best answer

So, according to gidgreen's answer:

    class qa_html_theme extends qa_html_theme_base
    {    
        function form_buttons($form, $columns)
        {
            $keys=array('answer','comment','edit','flag','close','hide');
            if (isset($form['buttons']))
                qa_html_theme_base::form_reorder_buttons($form, $keys);
            qa_html_theme_base::form_buttons($form, $columns);
        }
    }
I tried this code in my custom theme and it change the button orders.
by
Perfect, thanks a lot for this code snippet.
+2 votes
by

See the form_reorder_buttons(...) theme function - makes it easy to do this in a custom theme.

by
OK it looks like the more opinions the more button orders...
So, best would be a plugin to set the button order as
it depends on the theme and preferences what fits bests...

I would prefer for questions:
[flag][comment] [answer]
and for answers
[flag] [reply]

In my theme the buttons are floated to the right,
answer and reply are green buttons lined up nicely on the right qa-main border, while the others are textlinks.

The order for admin is not so important for me..
by
For sure you have heard about the golden rule of consistency that each navigation element should really be at the same place. As soon as Gidgreen adds new buttons (see question) the answer and flag button lost their position.

I am quite certain that I am right with my suggestion ;)
by
Nope, never heard about that rule, even google search does not give me a clear result regarding the golden rule of consistency and navigation elements. Will search deeper.

Now it gets more clear, why You think that this change should be done. Thank You for answering me.

However, I would hope, that if gidgreen adopts Your right suggestion, that at the same time a plugin or switch in core will be available, so one can maintain the old order of buttons without rewriting the core files again.

By the way, I am sure that You are right with Your suggestion, I just wanted to understand, WHY you was asking for that design breaking change.

Now I know it, thank You so far.
by
you are welcome, enjoy your day :)

PS: The "plugin" you would need is mentioned in gidgreen's answer: Use a custom theme and override form_reorder_buttons(...)
...