# Forums | Mahara Community

## Developers / I am going nuts here.

Account deleted
Posts: 112

14 March 2010, 18:58

Hi,

I really hate posting questions here but, I have been trying to fix this issue all day. The notifications stick and all I see is the Loading.... message. Yesterday it worked fine and today it decides it doesn't want to. There are no error logs, doe anyone know where to look to fix this issue?

Thanks so much:)

Account deleted
Posts: 112
##### Re: I am going nuts here.

15 March 2010, 16:06

Hello all,

Sometimes I read my post over and I see how bad my brain is fried on certain days when I look at my spelling.  Anyways, I wanted to clear a few things up with this issue. I haven't modified the notifications or any of the pieforms that would cause this issue.

Account deleted
Posts: 228
##### Re: I am going nuts here.

15 March 2010, 16:52

Can you install the firefox extension firebug, and watch the xmlhttprequests and have a look at what the request and response says?

Account deleted
Posts: 112
##### Re: I am going nuts here.

15 March 2010, 20:39

I am not real familiar with firebug and I'll just post the information. It seems to be working fine. So, I am not sure.

This was from the post.

 Parametersapplication/x-www-form-urlencoded limit 10 offset 0 sesskey M5vGngXfpYTWQIAP type all
 Source offset=0&limit=10&type=all&sesskey=M5vGngXfpYTWQIAP

This was from the response.

define('INTERNAL', 1);define('JSON', 1);require(dirname(dirname(dirname(__FILE__))) . '/init.php');json_headers();$markasread = param_integer('markasread', 0);$delete     = param_integer('delete', 0);$quiet = param_integer('quiet', 0);if ($markasread) {    $count = 0; db_begin(); try { foreach ($_GET as $k =>$v) {            if (preg_match('/^unread\-(\d+)$/',$k,$m)) { set_field('notification_internal_activity', 'read', 1, 'id',$m[1], 'usr', $USER->get('id'));$count++;            }        }    }    catch (Exception $e) { db_rollback(); json_reply('local', get_string('failedtomarkasread', 'activity') . ': ' .$e->getMessage());    }    db_commit();    if ($quiet) { json_reply(false, null); } json_reply(false, array('message' => get_string('markedasread', 'activity'), 'count' =>$count));}else if ($delete) {$count = 0;    db_begin();    try {        foreach ($_GET as$k => $v) { if (preg_match('/^delete\-(\d+)$/',$k,$m)) {                delete_records('notification_internal_activity', 'id', $m[1], 'usr',$USER->get('id'));                $count++; } } } catch (Exception$e) {        db_rollback();        json_reply('local', get_string('failedtodeletenotifications', 'activity') . ': ' . $e->getMessage()); } db_commit();  safe_require('notification', 'internal'); json_reply(false, array( 'message' => get_string('deletednotifications', 'activity',$count),        'count' => $count, 'newunreadcount' => call_static_method(generate_class_name('notification', 'internal'), 'unread_count',$USER->get('id'))    ));}// normal processing$type = param_alphanum('type', 'all');$limit = param_integer('limit', 10);$offset = param_integer('offset', 0);$userid = $USER->get('id');if ($type == 'all') {    $count = count_records('notification_internal_activity', 'usr',$userid);    $sql = 'SELECT a.*, at.name AS type,at.plugintype, at.pluginname FROM {notification_internal_activity} a  JOIN {activity_type} at ON a.type = at.id WHERE a.usr = ? ORDER BY ctime DESC';$records = get_records_sql_array($sql, array($userid), $offset,$limit);} else if ($type == 'adminmessages' &&$USER->get('admin')) {    $count = count_records_select('notification_internal_activity', 'usr = ? AND type IN ( SELECT id FROM {activity_type} WHERE admin = ?)',  array($userid, 1));    $sql = 'SELECT a.*, at.name AS type,at.plugintype, at.pluginname FROM {notification_internal_activity} a  JOIN {activity_type} at ON a.type = at.id WHERE a.usr = ? AND at.admin = ? ORDER BY ctime DESC';$records = get_records_sql_array($sql, array($userid, 1), $offset,$limit);}else {    $count = count_records_select('notification_internal_activity', 'usr = ? AND type = ?', array($userid,$type));$sql = 'SELECT a.*, at.name AS type,at.plugintype, at.pluginname FROM {notification_internal_activity} a        JOIN {activity_type} at ON a.type = at.id        WHERE a.usr = ? AND a.type = ?';    $records = get_records_sql_array($sql, array($userid,$type), $offset,$limit);}if (empty($records)) {$records = array();}$data = array();$star = $THEME->get_url('images/star.png');$unread = get_string('unread', 'activity');foreach ($records as &$r) {    $r->date = format_date(strtotime($r->ctime));    $section = 'activity'; if (!empty($r->plugintype)) {        $section =$r->plugintype . '.' . $r->pluginname; }$r->type = get_string('type' . $r->type,$section);    $r->message = clean_html(format_whitespace($r->message));}$activity = array( 'count' =>$count,    'offset' => $offset, 'limit' =>$limit,    'data'   => $records, 'star' =>$star,    'unread' => $unread,);echo json_encode($activity);?>

Account deleted
Posts: 228
##### Re: I am going nuts here.

16 March 2010, 2:48

ok, that's bizarre.  The script that handles the xmlhttprequest is sending back the php source code, rather than the processed data.

This could either be an apache misconfiguration, which I doubt if it's only happening on the notifications page, or the <?php tag could maybe have been removed from the top of that page?  It's account/activity/index.json.php

Account deleted
Posts: 112
##### Re: I am going nuts here.

16 March 2010, 19:34

OMG,

I think it's time to take a break from coding. I spent a whole day looking into the notifications files and I never noticed that the <?php tag was missing. I can't literally stop laughing at myself.

Now, I have more question concerning the notifications. When any user receives a new message the message stats it's read. I have downloaded mahara and compared those with my php files that pertain to the notifications. They both are identical and can't seem to find why this is happening? I wish I had a error log for this but, there isn't one. Would make it a lot easier to find the issue.  Do you have a guess to why this might happen?

Account deleted
Posts: 228
##### Re: I am going nuts here.

17 March 2010, 3:07

If I recall correctly, when an activity noficiation is sent via some other notification plugin than internal (email or email digest), it also adds it to the activity log, but marks it as read.  Could it be the preferences on your local install?

Having said that I'm not sure that's working since I have 544 unread messages on mahara.org and I'm pretty sure that can't all be stuff I haven't had emails about.

Account deleted
Posts: 112
##### Re: I am going nuts here.

18 March 2010, 22:29

Well, the auto installer installed it. I have looked through the files for a setting but, didn't see anything. Maybe I over looked it.
8 results