Inbox Not Displaying

I know this question may be too general, but any direction will be appreciated.  I have been heavily modifying Elgg 1.8 for a particular site, and somewhere along the line I broke the inbox.  The only part of the Messages mod that does not work is the inbox -- you can compose messages, and when you have a message to be read the indicator show it.  But when you click on the envelope icon to go to

the page resolves instead to

I suspect it may be because some of my custom code deals with determining page owners instead of the logged in user.  But much tweaking and testing has not yielded a resolution.

Just generally, what sort of things should I be looking for to make the inbox display?  What would block it such that it goes to the default page instead?

Thanks in advance for any ideas.



  • If you must modify core, I strongly suggest using a custom branch in git. This makes it easier to compare your code with official releases, and perform upgrades by merging core team commits.

    If your custom branch were on github, e.g., we'd be able to easily see via the web exactly what you changed, and that's probably what we're going to need to help you.

  • Let's say your code is in /var/www/mysite/. Install git, open terminal and do this:

    cd ~
    git clone
    cd Elgg
    git checkout 1.8.5    (or whichever tag matches what you're running)

    Now you can generate a diff:

    diff -ru . /var/www/mysite

    To put your changes on a branch:

    git checkout -b mysite
    cp -R /var/www/mysite/* .
    git add .
    git commit -m 'mysite alterations'
  • Thanks for your input.  I actually have been making most modifications in a common functions file that I call in plugins I have been developing for this site.  The only changes in core code I have been making have been to either show a panel with a graphic and some text in the sidebar or header, or to suppress functions for some users.  For example some users can't initiate their own blogs but can see and post on friends' blogs.

    I tried adding my code file by file to a fresh Elgg installation yesterday and it looked like a call to page_owner_entity() was causing the problem.  I need to know the page owner when displaying their blogs or other pages to know which graphic to display and what level of access their page should have for the various features.

    So at this stage I am not looking for a programming philosophy so much as what specific kind of code to look for that could be confusing Elgg into thinking the Inbox isn't there to display.

    For example I based a number of the plugins for this site on a plugin that displays tabs.  That plugin displays specific tab content using files named tab1.php, tab2.php, etc.  I didn't think any of these plugins would know about eachother, but plugin B was finding and displaying the tab files from Plugin A instead of its own tab files.  The solution was to give the tab#.php files different file names in each plugin.  There must be some solution like that for this Inbox issue.

    Thanks again,


  • It is definitely an issue with calls to elgg_get_page_owner_entity() in the messages plugin.  For instance, in inbox.php

    Evidently elgg_get_page_owner_entity() is not sensing the page owner, so the error handling code is telling Elgg to go to the home page instead.  I tried this to confirm:

    $page_owner = elgg_get_page_owner_entity();
    // if I remove the error handling code below it displays an empty inbox (and doesn't know who the owner is.

    if (!$page_owner) {

    Alternatively if I replace the call to elgg_get_page_owner_entity() with this line:

    $page_owner = $_SESSION[ 'user' ];

    it knows the inbox belongs to the logged in user, but does not see waiting messages for that user (in my test two messages are waiting).  Likewise sent.php does not see sent messages.

    Any idea why that would happen?


    Or does anyone know of an alternate internal messaging plugin?



  • Sorry, but when I try your example by replacing

    $page_owner = elgg_get_page_owner_entity();


    $page_owner = $_SESSION[ 'user' ];

    I still get the inbox with messages shown correctly. I don't know what exactly you have modified elsewhere but I think you might be looking in the wrong direction when blaming elgg_get_page_owner_entity().

    Can't you simply compare your modified code with the original code to see what exactly you have changed? What's with the menu entry for the topbar icon. Does it include

    'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username,

    to get to the inbox? In the original message plugin it's in start.php in the function messages_notifier().

  • I am not blaming it, I am experimenting to see why the plugin isn't displaying some of its pages in my installation.  I did not modify the messages plugin at all, not one line.  But when I noticed the inbox not showing I experimented and found that elgg_get_page_owner_entity() was not getting an owner, even though the URL (menu item) was correct, the one you asked me about, 'href' => 'messages/inbox/' . elgg_get_logged_in_user_entity()->username, is the URL the menu item is using.  I do know what I have modified, but I cant find anything in it that would cause this issue.

    Using the $_SESSION call did give me a way to see it working, though I know that is not what should be used.  It was simply an experiment to see if I could get the inbox page to display (it did).  But when it displayed it did not show inbox messages.  All other plugins are working correctly, so I am trying to understand how the messages mod works to track the problem.  I am continuing to experiment, but any ideas about what direction to look in will be appreciated.  Thanks.