Aug 15, 2015 16:56:36 GMT -5
Hello i have another problem/question about the forum i'm remaking.
My menu bar looks like this now:
Now i want to achieve 2 things.
1. I also added a settings button like on this forum but i'm stuck with the link i need to fill in. For me the /user/1/settings works, becasue i'm user one but for all the others it doesn't work.
Any idea what the link needs to be so it works for everyone ?
2. Another thing i want to achieve is something with the "Participated" button. When a member anwsers on a post i made, you can see there is standing "new" left of the post in the participated page.
Now i also want to have a "tip holder" or "new message" right of the participated button in my menu (just as you can see with the "My profile" button) so i can see right away that someone replied on a post i made.
I hope this 2 options are not to difficult to realize and someone can help me with this
Thanks a lot already !!,
Jens
Aug 17, 2015 14:16:01 GMT -5
The second of these I can't help you with
I tried for several days to get that functionality, but failed, so I had to abandon it.
The first however, now that I can do
What you'll need to do is put a standard link in the navigation bar as you have done (I suggest "/user", that way when it doesn't work (more on that later) then it will take the user to their own profile page by default) then intercept the
{foreach $[navigation.menu]} loop looking for the name "Settings", and when found, change the href to "/user/$[current_user.id]/settings"
This is the code I have on my forum which gives the user a notifications button, taking them to the notifications tab on their own profile.
<ul role="navigation">
{foreach $[navigation.menu]}
<li>
<a{if $[navigation.menu.active]}
class="state-active"
{/if}
{if $[navigation.menu.name] == "Notifications"}
href="/user/$[current_user.id]/notifications"
{else}
href="$[navigation.menu.href]"
{/if}
{if $[navigation.menu.accesskey]}
accesskey="$[navigation.menu.accesskey]"
{/if}
>
$[navigation.menu.name]
<!-- If notification total is greater than zero, show a bubble alert -->
{if $[navigation.menu.notification.total]}
<div class="tip-holder" onclick="window.location='$[navigation.menu.notification.href]'; return false;">
<div class="tip-number">$[navigation.menu.notification.total]</div>
<span class="tip"></span>
</div>
{/if}
</a>
</li>
{/foreach}
</ul>
Note that it goes in the navigation structure in the forum wrapper template
Now, about this failing. At the moment at least, custom themes, aside from the basic colours, aren't supported on mobile browsers. This means templates aren't supported, which means your settings button won't take you to the settings tab, but instead fall back to the users profile.
I hope this helps you! This is the culmination of many MANY hours of hair pulling, so I hope I can save you from a similar fate!
Best of luck!
Aug 17, 2015 15:12:02 GMT -5
Actually further to my previous post, I've came to the conclusion that as dynamic links don't work on the mobile site because the templates aren't supported, it's probably a lot easier to simply tack another list item onto the end of the navigation bar. That way you don't get a navigation link for it
at all on the mobile site, which is probably better than getting a link, but finding it doesn't do what you want it to do.
Just add this to the very end of the closing {/foreach} tag, right underneath it:
<li>
<a href=$[current_user.href]/settings>Settings</a>
</li>
Aug 17, 2015 16:35:58 GMT -5
Yesssssss !!!
Thanks thanks thanks for that it worked
Only have one tiny issue hhé
When i click on the settings link i indeed go to the settings page now but in my navigation the profile link is set to active instead of the settings link ?
Any idea how to solve this one ?
Thanks a lot man !!,
Jens
Aug 17, 2015 16:57:16 GMT -5
I'm pleased it worked
But I'm not sure what you mean by the profile link being set to active? I tried it on my test forum, linking the Settings navbar button to the settings pane in the current users profile. Here's what I have in my forum wrapper template, if you copy and paste that, it should work perfectly. Remember to call the custom navbar button "Settings" and link it to "/user"
<ul role="navigation">
{foreach $[navigation.menu]}
<li>
<a{if $[navigation.menu.active]}
class="state-active"
{/if}
{if $[navigation.menu.name] == "Settings"}
href="/user/$[current_user.id]/settings"
{else}
href="$[navigation.menu.href]"
{/if}
{if $[navigation.menu.accesskey]}
accesskey="$[navigation.menu.accesskey]"
{/if}
>
$[navigation.menu.name]
<!-- If notification total is greater than zero, show a bubble alert -->
{if $[navigation.menu.notification.total]}
<div class="tip-holder" onclick="window.location='$[navigation.menu.notification.href]'; return false;">
<div class="tip-number">$[navigation.menu.notification.total]</div>
<span class="tip"></span>
</div>
{/if}
</a>
</li>
{/foreach}
</ul>
Aug 17, 2015 17:20:37 GMT -5
Oww i think you understand me wrong let me explain it with the picture.
So this is my nav bar.
You can see that the "Home" button is now active, so what i mean with that is that i'm now on the "Home" page.
I use active as "a:active (css code)".
But when i click on the "Settings" button and i go to the settings page, the "Settings" button isn't showed as active but the "Profile" button is instead showed as active.
Aug 17, 2015 17:34:20 GMT -5
Oh I understand!
I didn't notice I have the same problem on my own forum, I'm guessing because the active text decoration is very subtle. I imagine it's because the URL is dynamically generated, which makes the link work, but the bit that makes the appropriate button on the navbar isn't, so it points to the profile being active, which is what the navbar linked to in the first place before we intercepted the URL and futzed with it.
I'll have a play around on my forum and see if I can get the active marked linked, too.
Aug 17, 2015 17:37:53 GMT -5
Ok, i'm glad you understand me now
Thanks a lot for helping me bro, appriciate it !!
Cheers,
Jens
Aug 17, 2015 18:21:28 GMT -5
More than happy to help! I'm busy coding my own forum, too (A pet care/info forum, if you have any pets!
) so I'm learning as I'm going, which has been quite the adventure!
On further inspection of the active links though, there doesn't appear to be a way to set this in the template, and there might not be a way full stop. Because the profile is one of the system default navbar links, it takes precedence. Also, because the profile page is the top most stack, and the settings is another layer down on a separate tab, that top most stack is the one being shown as active. There's no template for the settings tab (or any tab for that matter, only the parent window), which probably means highlighting that button on the navbar will probably need to JS coding in the header. I have no idea how feasible that is
I'll continue to look into it though, it's a learning experience
Thanks!
Chris