Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Notification Link in default.master.tpl

phreakphreak Vanilla*APP (White Label) & Vanilla*Skins Shop MVP

Hi all,

Right now i have a link in my header of a mobile theme that displays the username and the number of new notifications next to it.

Username (3)

{profile_link}

This links to the profile-page. But it would be smarter in its usability if it would link to the notifications page. Is there some smarty option like for the profile?

for example something like

{notification_link}

Thanx for info.

  • VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
  • VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla

Comments

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Wie der Zufall so will... I had "extracted" that notification part for custom theme (which never left the early stages) and where I'd like to see some notification link. Here is /themes/MyTheme/SmartyPlugins/function.notifications.php

    <?php defined('APPLICATION') or die();
    
    function smarty_function_notifications($params, &$smarty) {
        /*
       $Wrap = GetValue('wrap', $params, 'li');
       return Gdn_Theme::Link('discussions',
          GetValue('text', $params, T('Discussions')),
          GetValue('format', $params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
          */
    
        $Session = Gdn::Session();
        if (!$Session->IsValid()) {
            return;
        }
        $User = Gdn::Session()->User;
        $CountNotifications = $User->CountNotifications;
        $CNotifications = '';
        if (is_numeric($CountNotifications) && $CountNotifications > 0) {
            $CNotifications = '<span class="Alert">'.$CountNotifications.'</span>';
        }
    
        echo '<span class="ToggleFlyout" rel="/profile/notificationspopin">';
        echo Anchor(T('Notifications').$CNotifications, UserUrl($User), 'FlyoutButton', array('title' => T('Notifications')));
        echo Sprite('SpFlyoutHandle', 'Arrow');
        echo '<div class="Flyout FlyoutMenu"></div></span>';
    
    }
    

    In /themes/MyTheme/class.mythemethemehooks.php add

        public function gdn_smarty_init_handler ($Sender) {
            $Sender->plugins_dir[] = dirname(__FILE__).DS.'SmartyPlugins';
        }
    
  • Options
    hgtonighthgtonight ∞ · New Moderator

    There is actually some commented code in the profile controller that will render the notification page if notifications exist and the activity page if not.

    I just find it interesting that the code is laying dormant.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    @hgtonight said:
    There is actually some commented code in the profile controller that will render the notification page if notifications exist and the activity page if not.

    I just find it interesting that the code is laying dormant.

    maybe its like a 17 year cicada.,

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    I prefer the "go to notifications if you have some, go elsewhere if you don't" especially on mobile.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options
    peregrineperegrine MVP
    edited January 2015

    @hgtonight said:

    I just find it interesting that the code is laying dormant.

    @peregrine said:
    maybe its like a 17 year cicada.,

    in case you missed this - couldn't resist posting.

    https://www.youtube.com/watch?v=oDSn5l8_97E

    and a timeline when dormancy ends... with milestones. :) a cicada github,

    http://www.cicadamania.com/where.html

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    https://www.youtube.com/watch?v=MN9wyuZfexw

    Saw them live in Munich - it was gorgeous!

Sign In or Register to comment.