Ticket #1198 (closed confirmed defect: fixed)

Opened 7 months ago

Last modified 3 months ago

'Latest Activity' code doesn't display anything

Reported by: munkee Owned by:
Priority: high Milestone: Elgg 1.5
Component: Core Version: 1.6
Severity: major Keywords:
Cc: marcus, brettp, dave

Description

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,

Change History

Changed 7 months ago by cash

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.)

Changed 6 months ago by cash

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.

Changed 3 months ago by cash

  • priority changed from minor to major
  • type changed from unconfirmed defect to confirmed defect

promoting this one

Changed 3 months ago by cash

  • status changed from new to closed
  • resolution set to fixed

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...

Note: See TracTickets for help on using tickets.