Codoforum related discussions
Notification logic in Codoforum

Mouse over issue:

When mouse hovers the notification panel, the text "Notifications" overlays the preference button.
557b01d6f2603.jpg

All notifications are disappeared after 1 click

Example:

  • We have some notifications (> 2).
  • We click on the notify button, then click on a link.
  • We want to read other notifications.
  • We click on the notify button again.
  • All notification were disappeared.
  • We MUST click on the show all to view.

smile

Can you compare Codoforum notification with Facebook notification?

Facebook keeps the un-clicked links and a numbers of links. It is more convenient for us.

#### Mouse over issue: When mouse hovers the notification panel, the text "**Notifications**" overlays the **preference** button. ![557b01d6f2603.jpg](serve/attachment&path=557b01d6f2603.jpg) #### All notifications are disappeared after 1 click Example: - We have some notifications (> 2). - We click on the **notify button**, then click on a link. - We want to read other notifications. - We click on the notify button again. - All notification were disappeared. - We MUST click on the **show all** to view. (doh) Can you compare Codoforum notification with Facebook notification? Facebook keeps the un-clicked links and a numbers of links. It is more convenient for us.
NguoiAnPhu.com Powered by Codoforum 4.3 (https://github.com/nguoianphu/codoforums-vietnam).
edited Jun 12 '15 at 5:13 pm

@adesh , @admin
Didn't you upgrade this forum to v3.3.1? I still get the Sticky and front_page error when posting a new topic. smile

@adesh , @admin Didn't you upgrade this forum to v3.3.1? I still get the Sticky and front_page error when posting a new topic. :(
NguoiAnPhu.com Powered by Codoforum 4.3 (https://github.com/nguoianphu/codoforums-vietnam).

Hi,

Facebook keeps the un-clicked links and a numbers of links. It is more convenient for us.

Is that so ?
We will then make it like facebook notifications.

Didn't you upgrade this forum to v3.3.1? I still get the Sticky and front_page error when posting a new topic. smile

No..I guess it slipped off our mind.
We have now upgraded.

Hi, >Facebook keeps the un-clicked links and a numbers of links. It is more convenient for us. Is that so ? We will then make it like facebook notifications. >Didn't you upgrade this forum to v3.3.1? I still get the Sticky and front_page error when posting a new topic. smile No..I guess it slipped off our mind. We have now upgraded.
Necessity is the mother of all inventions!

@admin @adesh1414127033
Will you implement this?

I found this code and asked myself why the $wantOnlyUnread doesn't work? smile

codo331\codoforum\sys\CODOF\Forum\Notification\Notifier.php

Line 242

    /**
     * Note: Marks fetched notifications as read
     * @param bool $wantOnlyUnread fetch only unread(true) or all notifications(false)
     * @param int $take no. of rows to fetch
     * @return array
     */
    public function get($wantOnlyUnread = false, $take = 10, $orderBy = 'desc', $offset = 0) {

        $sql = \DB::table(PREFIX . 'codo_notify AS n')
                ->join(PREFIX . 'codo_notify_text AS t', 't.id', '=', 'n.nid')
                ->select('n.type', 't.data', 'n.created', 'n.is_read')
                ->where('n.uid', '=', \CODOF\User\CurrentUser\CurrentUser::id());

        if ($wantOnlyUnread) {

            $sql->where('n.is_read', '=', '0');
        }

You initialize $wantOnlyUnread = failse to get all notifications. But if you check this forum, it doesn't get all notifications. smile

If I insert a new line to re-set its value, it works.

        $wantOnlyUnread = false;
        if ($wantOnlyUnread) {

            $sql->where('n.is_read', '=', '0');
        }
@admin @adesh1414127033 Will you implement this? I found this code and asked myself why the **$wantOnlyUnread ** doesn't work? :x codo331\codoforum\sys\CODOF\Forum\Notification\Notifier.php Line 242 ``` /** * Note: Marks fetched notifications as read * @param bool $wantOnlyUnread fetch only unread(true) or all notifications(false) * @param int $take no. of rows to fetch * @return array */ public function get($wantOnlyUnread = false, $take = 10, $orderBy = 'desc', $offset = 0) { $sql = \DB::table(PREFIX . 'codo_notify AS n') ->join(PREFIX . 'codo_notify_text AS t', 't.id', '=', 'n.nid') ->select('n.type', 't.data', 'n.created', 'n.is_read') ->where('n.uid', '=', \CODOF\User\CurrentUser\CurrentUser::id()); if ($wantOnlyUnread) { $sql->where('n.is_read', '=', '0'); } ``` You initialize **$wantOnlyUnread ** = failse to get all notifications. But if you check this forum, it doesn't get all notifications. x( If I insert a new line to re-set its value, it works. ``` $wantOnlyUnread = false; if ($wantOnlyUnread) { $sql->where('n.is_read', '=', '0'); } ```
NguoiAnPhu.com Powered by Codoforum 4.3 (https://github.com/nguoianphu/codoforums-vietnam).

Nervermind, I found them.

codo331\codoforum\routes.php

Line 310 should set to false.

   dispatch_get('Ajax/notifications/new', function() {

        if (Request::valid($_GET['_token'])) {

            $notifier = new \CODOF\Forum\Notification\Notifier();

            if (isset($_GET['time']) && $_GET['time'] > 0) {

                $time = $_GET['time'];
            } else {

                $time = time();
            }

            $events = $notifier->get(true);

            if (!empty($events)) {

                $lastEventTime = $events[0]['created'];
                $time = $lastEventTime;
            }

            $notifications = $notifier->getFormattedForInline($events);
            echo json_encode(
                    array(
                        "events" => $notifications,
                        "time" => $time
                    )
            );
        }
    });
Nervermind, I found them. codo331\codoforum\routes.php Line 310 should set to false. ``` dispatch_get('Ajax/notifications/new', function() { if (Request::valid($_GET['_token'])) { $notifier = new \CODOF\Forum\Notification\Notifier(); if (isset($_GET['time']) && $_GET['time'] > 0) { $time = $_GET['time']; } else { $time = time(); } $events = $notifier->get(true); if (!empty($events)) { $lastEventTime = $events[0]['created']; $time = $lastEventTime; } $notifications = $notifier->getFormattedForInline($events); echo json_encode( array( "events" => $notifications, "time" => $time ) ); } }); ```
NguoiAnPhu.com Powered by Codoforum 4.3 (https://github.com/nguoianphu/codoforums-vietnam).
153
4
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft