Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Latest Activity' code doesn't display anything (Trac #1198) #1198

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 4 comments
Closed

'Latest Activity' code doesn't display anything (Trac #1198) #1198

elgg-gitbot opened this issue Feb 16, 2013 · 4 comments

Comments

@elgg-gitbot
Copy link

Original ticket http://trac.elgg.org/ticket/1198 on 39658959-02-12 by trac user munkee, assigned to unknown.

Elgg version: 1.6

On a blank fresh installation of elgg 1.6 the pre-login screen comes with a standard bit of code which should display all the publicly available 'latest Activity' within the site, it doesnt.

The code is in : elgg/dashboard/latest.php

// Load the front page
    global $CONFIG;
    $title = elgg_view_title(elgg_echo('content:latest'));
    set_context('search');
    $content = list_registered_entities(0,10,true,false,array('object','group'));
    set_context('latest');
    $content = elgg_view_layout('two_column_left_sidebar', '', $title . $content);
    page_draw(elgg_echo('content:latest'), $content);

I've been using the same code to display this from elgg 1.2
Thanks,

@elgg-gitbot
Copy link
Author

cash wrote on 39659205-06-19

Works fine for me on a fresh install of 1.6 (though you are pointing to the wrong file. The login screen page is index.php not dashboard/latest.php.)

@elgg-gitbot
Copy link
Author

cash wrote on 39704226-07-29

I was able to reproduce. Here is the logic that is breaking down in get_entities():

            foreach($subtype as $typekey => $subtypearray) {
                foreach($subtypearray as $subtypeval) {
                    $typekey = sanitise_string($typekey);
                    if (!empty($subtypeval)) {
                        if (!$subtypeval = (int) get_subtype_id($typekey, $subtypeval))
                            return false;
                    } else {
                        // todo: Setting subtype to 0 when $subtype = '' returns entities with
                        // no subtype.  This is different to the non-array behavior
                        // but may be required in some cases.
                        $subtypeval = 0;
                    }
                    if (!empty($tempwhere)) $tempwhere .= " or ";
                    $tempwhere .= "(type = '{$typekey}' and subtype = {$subtypeval})";
                }

If get_subtype_id() returns zero, the function immediately returns. The subtypes passed in are obtained from the CONFIG object while they are being checked against the subtype table. If a plugin registers an entity type but none exist yet, there is no subtype table entry and get_entities fails.

When get_subtype_id fails, it should skip the subtype rather than failing completely.

@elgg-gitbot
Copy link
Author

cash wrote on 39938547-01-07

promoting this one

@elgg-gitbot
Copy link
Author

cash wrote on 39954965-11-03

This works now with the latest from svn because a single subtype that doesn't exist no longer returns FALSE. A todo item in there says there is still the possibility of breaking this again though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant