/** * Output notification page * @since 2.3 */ public function notification_page() { if (!ap_is_user_page_public('profile') && !ap_is_my_profile()) { ap_get_template_part('not-found'); return; } global $ap_notifications; $ap_notifications = ap_get_user_notifications(); ap_get_template_part('user/notification'); }
/** * Add user dropdown and notification menu * @param string $o Menu html. * @param object $item Menu item object. * @param integer $depth Menu depth. * @param object $args Menu args. * @return string */ public function walker_nav_menu_start_el($o, $item, $depth, $args) { if (!is_user_logged_in() && (in_array('anspress-page-profile', $item->classes) || in_array('anspress-page-notification', $item->classes))) { $o = ''; } if (in_array('anspress-page-profile', $item->classes) && is_user_logged_in()) { $menus = ap_get_user_menu(get_current_user_id()); $active_user_page = get_query_var('user_page') ? esc_attr(get_query_var('user_page')) : 'about'; $o = '<a id="ap-user-menu-anchor" class="ap-dropdown-toggle" href="#">'; $o .= get_avatar(get_current_user_id(), 80); $o .= '<span class="name">' . ap_user_display_name(get_current_user_id()) . '</span>'; $o .= ap_icon('chevron-down', true); $o .= '</a>'; $o .= '<ul id="ap-user-menu-link" class="ap-dropdown-menu ap-user-dropdown-menu">'; foreach ($menus as $m) { $class = !empty($m['class']) ? ' ' . $m['class'] : ''; $o .= '<li' . ($active_user_page == $m['slug'] ? ' class="active"' : '') . '>'; $o .= '<a href="' . $m['link'] . '" class="ap-user-link-' . $m['slug'] . $class . '">'; $o .= esc_attr($m['title']) . '</a>'; $o .= '</li>'; } $o .= '</ul>'; } elseif (in_array('anspress-page-notification', $item->classes) && is_user_logged_in()) { $o = '<a id="ap-user-notification-anchor" class="ap-dropdown-toggle ' . ap_icon('globe') . '" href="#">' . ap_get_the_total_unread_notification(false, false) . '</a>'; global $ap_notifications; ob_start(); $ap_notifications = ap_get_user_notifications(array('per_page' => 10)); ap_get_template_part('user/notification-dropdown'); $o .= ob_get_clean(); } return $o; }