Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
2.2k views
in Themes by

Some users already asked how to use the on-site-notifications plugin together with the new snow flat theme. Problem is that the (N) notification icon is only be visible when clicking on the avatar. However, they want it next to the avatar: http://www.question2answer.org/qa/40528/to-display-on-site-notifications-plugin-somewhere-else

I have seen that the theme has one public function nav_user_search() that is adding the avatar and the user data into a dropdown. Can somebody help me out and advice how i can "access"/extend or even change this function using the plugin?

 

PS: I think it is not a good idea to hide the buttons under the admin image. E.g. if a user wants to check his points, he has to click the avatar first. If a user wants to see his updates, he has to click the avatar first etc.

Q2A version: 1.7 beta

1 Answer

+2 votes
by
Does this do the trick?
 
public function nav_user_search() {
    qa_html_theme_base::nav_user_search();
    echo '<span style="float: right; margin-right: 5px">[N]</span>';
}
 
 
Of course, change the CSS to whatever you need. Actually, you'll have to change it to support all media queries.
 
Additionally, as this will change your HTML structure this might break the way it currently looks in other themes. I would advice against changing the HTML structure and in favor of only changing CSS when switching between themes.
 
Plan B would be to move the [N] using jquery... that way you'll be dynamically modifying the DOM while keeping the original HTML intact... kind of dirty, if you asked me.
 
As a side note, I also find it annoying having to make a click to see my points :@
by
I think I will wait and guess that more users will ask for showing points and updates immediately and not only by clicking. @jatin.soni: Please consider getting the userdata next to the avatar... not only better from usability, but also good for the plugin as it will work then =)

PS: Thanks again pupi for your feedback ;)
by
Thanks. Anyway, this Snow Flat branch or fork (to call it some way) is now part of Q2A itself so it is not jatin who decides that but rather Scott
by
Is sth like that eligible to post it as issue in the repo?
by
Well, it is not strictly related to coding and is not a bug either. It is much closer to a feature request,  IMO. So I would say it shouldn't
by
@kia, I will try to fix this in next update. However, my idea behind this is to keep more room for mobile. The logo itself take some space in the center. If I place point outside of avatar that will looks weird and misaligned on desktop, probably on mobile too. Let me see what best I can fits it
by
I am using CSS now as suggested by pupi1985. Giving the (N) an absolute position and bringing it out of the drop down div.
by
Ah, as I see now, there is no "only CSS" solution, as the (N)otification icon is within the div that gets hidden by the snowflat theme... i try something else.
by
It is not possible to fix this only using CSS. You'll have to change the HTML for sure (that's what the "nav_user_search" function I've added does) OR maybe change the DOM dynamically (plan B stated above)
by
Yep, jquery is my friend:     $("#osnbox").detach().appendTo(".qam-account-items-wrapper"); to get the box out of the drop down :)
...