Small suggestion to increase compatibility.

robobeau - May 18, 2009 - 20:37
Project:Public Preview
Version:5.x-1.0
Component:Code
Category:feature request
Priority:minor
Assigned:Unassigned
Status:needs review
Description

I'm not sure if this is a problem on the Drupal 6 version, but on D5, the "public_preview_perm()" function could benefit from a small tweak.

On line 14, I replaced "$t->name" with "$t->type".

$perms = array_map( create_function('$t', 'return "preview ".strtolower($t->type)." content";'), node_get_types());

The reason for this was because a few modules on my site, which produce new node types, had different naming conventions for both Name and Type, so line 36 kept crapping out on certain node types, like "aggregation_item" (a.k.a Aggregation Item), resulting in an Access Denied.

$access = user_access('preview '.strtolower($node->type).' content');

I hope this helps!

 
 

Drupal is a registered trademark of Dries Buytaert.