• chrism878

    (@chrism878)


    this plug in is great, but lacked notifications support… it was simple to add, and i added support for another tag.

    to do:
    1.
    find
    $groupcount = groups_get_total_group_count();
    under that add
    $notificationscount = bp_notifications_get_unread_notification_count();
    OPTIONAL add
    $totalunread = $msgcount + $notificationscount;

    2.
    a few lines down find
    $item->title = str_ireplace("%groupcount%", $friendcount, $item->title);
    under that add
    $item->title = str_ireplace("%notificationscount%", $notificationscount, $item->title);
    OPTIONAL add
    $item->title = str_ireplace("%totalunread%", $totalunread, $item->title);

    3.
    a few lines down find
    $item->title = str_ireplace("%(groupcount)%", ($groupcount > 0) ? '('.$groupcount.')' : '', $item->title);
    under that add
    $item->title = str_ireplace("%(notificationscount)%", ($notificationscount > 0) ? '('.$notificationscount.')' : '', $item->title);
    OPTIONAL add
    $item->title = str_ireplace("%(totalunread)%", ($totalunread > 0) ? '('.$totalunread.')' : '', $item->title);

    this will add support for
    %notificationscount%
    %(notificationscount)%

    and optionally, i made this feature to support a total of unread messages and notifications using these tags

    %totalunread%
    %(totalunread)%

    https://wordpress.org/plugins/bp-direct-menus/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter chrism878

    (@chrism878)

    im sorry, i forget to say, all changes are made in this file: frontend-noajax.inc.php

    Charla

    (@webgirl)

    Cool.. will definitely check that out.

    tylertervooren

    (@tylertervooren)

    This couldn’t have come at a better time. Was just attempting to figure it out myself. Thanks! Works great!

    godavid33

    (@godavid33)

    I second this solution, I actually figured it out and posted it on buddypress forums a few days ago. Should have thought to check here first.

    Works perfectly! Thank you!

    My menu just shows the code, not the numbers, it’s like this:

    I labeled it: Messages %(unreadmessagecount)%

    And the output is exactly the same.

    I’m custom menu’s and i’m dragging the stuff from the Buddypress Direct Links 1.0.0 category.

    Where is the file: frontend-noajax.inc.php? I looked in my Cpanel -> file manager and PHP My Admin

    Toby

    (@tobyhawkins)

    Thanks for this, much appreciated.

    If anyone wants to customise the notifications count (change font-size, background colour etc) add a span with class intead of the brackets:

    $item->title = str_ireplace("%(notificationscount)%", ($notificationscount > 0) ? '<span class="myclass">'.$notificationscount.'</span>' : '', $item->title);

    DarkElement, does the menu URL field contain #bpdmcustom#?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘quick fix to add support for notifications’ is closed to new replies.