Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Pages module > edit-link > in ext.blueprints.php #205

Status Resolved
Add-on / Version
Severity Critical
EE Version

Kim Wickell

May 26, 2013

I have been having the same issues as mentioned in http://boldminded.com/support/ticket/356 and http://boldminded.com/support/ticket/188/.

When i try to edit entries in the Pages module Blueprints throws an error notice on line #205 of ext.blueprints.php.

A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 0
Filename: blueprints/ext.blueprints.php
Line Number: 205

And a message from Blueprints:

An Error Was Encountered

Please define a default template for the channel in the Pages module configuration.

Apparently Pages(v2.2) does not include the channel_id in the url and that is needed to get the current layout.

Which causes:
show_error(‘Please define a default template for the ’. $channels[$channel_id][‘channel_title’] .’ channel in the Pages module configuration.’);

To throw an error-notice.

I did not have enough time to go into it deeper but a quick-fix is to insert the snippet below on line #139 and again on line #356 in ext.blueprints.php

/* FIXME - Get the channel_id when it is left out by Pages */
if($channel_id === false AND $this->saved_channel_id === false){
 $temp_entry = $this->EE->db->where('entry_id', $entry_id)->limit(1)->get('channel_data');
 $this->saved_channel_id = $temp_entry->row()->channel_id;
 $channel_id = $this->saved_channel_id;
}else if($this->saved_channel_id !==false){
 $channel_id = $this->saved_channel_id;
}

And this one on line #73

/* FIXME - Store channel_id if not set by Pages */
private $saved_channel_id = false;

Nothing fancy but it returns the normal functionality. 😊


* Update
I read your comment below and attached 2 screenshots, one of the configuration and one of the error.
This is one of the few sites that we havent used Structure on so i cant say if Pages usually includes the channel_id.
After checking out the code in ext.blueprints.php it seems as if the channel_id parameter is necessary for it to get the right info.
The url on module=pages reads /ee-admin/index.php?S=0c1fb581fe3797963ecb7d0729d7b4b1&D=cp&C=content_publish&M=entry_form&entry_id=8.

Sadly the site is still only local so i wont be able to grant you access to it right now.
I will try to see if there is anything in the other add-ons that could cause this.

These are the Add-ons and versions currently being used.
Many of them will be replaced later with custom code.

#EE
2.6.1 Build 20130506

#Modules
Assets 2.1.3
Blueprints 2.0.6
Channel 2.0.1
Freeform 4.0.12
Low Variables 2.3.5
Member 2.1
Navee 2.2.7
Pages 2.2
Playa 4.4.3
Query 2.0
Republic Analytics 2.2.3
Rte 1.0
Seo Lite 1.4.4
Site Manager Client 0.2.3
Site Manager Server 0.2.3
Stash 2.3.6
Stats 2.0
Super Search 2.0.8
Updater 3.2.3
Wiki 2.3
Wygwam 2.7.1
Extensions
Assets 2.1.3
Blueprints 2.0.6
Continuum 0.9.1
Deviant 1.0.6
Low Seg2cat 2.8.0
Low Variables 2.3.5
Matrix 2.5.5
Navee 2.2.7
Playa 4.4.3
Republic Analytics 2.2.3
Requirejs 1.4
Rte 1.0
Stash 2.3.6
Super Search 2.0.8
Superfish Admin 0.1
System Messages 2.5
Updater 3.2.3
Wiki 2.3

#Plugins
IfElse 1.4
Low Link 1.0.0
Magpie RSS Parser 1.3.5
Switchee 2.0.6
Custom System Messages 2.5
XML Encode 1.3

#Field Types
assets 2.1.3
checkboxes 1.0
date 1.0
file 1.0
low_variables 2.3.5
matrix 2.5.5
multi_select 1.0
navee 2.2.7
playa 4.4.3
radio 1.0
relationship 1.0
rte 1.0
select 1.0
text 1.0
textarea 1.0
wygwam 2.7.1

#Accessories
Blueprints 2.0.6
Developer 1.6.2
Devotee 1.2.3
Health Check 0.1.

* Update 2
The link is constructed an line #15 in expressionengine/modules/pages/views/index.php reads:

$page['indent'].'<a href="'.BASE.AMP.'C=content_publish'.AMP.'M=entry_form'.AMP.'entry_id='.$page['entry_id'].'">'.$page['page'].'</a>',

So that explains why the publish form does not get the channel_id.

#1

BoldMinded (Brian)

Kim, that error indicates that you have not picked a default template for that channel: https://www.evernote.com/shard/s9/sh/3b159e9e-66f9-4e82-91dd-34a240b23d03/343d568003519acf786323c5358ba114

Apparently Pages(v2.2) does not include the channel_id in the url and that is needed to get the current layout.

This isn’t really the issue. I don’t think anything has changed in Pages recently, and I can recreate the error message you’re seeing when the Pages module is not configured with a default template value, as soon as I select a default value, the error goes away.

#2

Kim Wickell

Updated the issue.

#3

BoldMinded (Brian)

Line 207 of ext.blueprints.php, in version 2.0.6, is this:

else

An undefined offset error can’t occur on that line. Are you positive you’re using version 2.0.6?

Also, channel_id should be coming from the URI on the Publish page: &channel_id=X

I don’t understand “Get the channel_id when it is left out by Pages” because Pages doesn’t have anything to do with the channel_id, its a GET/POST variable that is always in the Publish page, its not Pages specific.

I would check your other add-ons to see if something is removing the channel_id. I would first look at the Deviant add-on.

#4

Kim Wickell

Sorry, i must have placed a few newlines in the file. Line #205 has: show_error(‘Please define a default template for the ’. $channels[$channel_id][‘channel_title’] .’ channel in the Pages module configuration.’);

I corrected the issue above.

When i use the links to the publish page from the entry-listing everything works ok. But the links on in the Pages screen is missing the channel_id which makes blueprints behave strange when it gets to the publish page.

I will do as you suggested and see if there is any other add-on that for any reason messes with pages.

#5

Kim Wickell

Updated the issue again.

It seems the channel_id is never a part of the link. Is there something i am missing?

#6

BoldMinded (Brian)

Kim, I see what you’re saying, and my inclination is that channel_id should be part of the Pages links (which Blueprints doesn’t touch) and is a bug with EE. It seems inconsistent of EllisLab to not use this parameter on one page, but use it on another.

#7

Kim Wickell

Yea, it seems a bit strange since other links created by Pages include it.

Thought it might be useful for someone else if they have the same problem.

#8

BoldMinded (Brian)

Kim, I’ve made a slight change to Blueprints that should fix this error if channel_id is missing. This is the only change necessary:

diff --git a/third_party/blueprints/ext.blueprints.php b/third_party/blueprints/ext.blueprints.php
index 90e38c590243725178893769b944198e8507ef0b..99c0dcb6d48f4dec08db6cd6387bc58fdd59ec4e 100644
--- a/third_party/blueprints/ext.blueprints.php
+++ b/third_party/blueprints/ext.blueprints.php
@@ -137,6 +137,18 @@ class Blueprints_ext {
         $entry_id = $this->EE->input->get_post('entry_id');
         $site_assets = false;
 
+        // If for some reason channel_id is not in $_GET/$_POST
+        if ( !$channel_id)
+        {
+            $qry = $this->EE->db->where('entry_id', $entry_id)
+                                ->get('channel_titles');
+
+            if ($qry->num_rows())
+            {
+                $channel_id = $qry->row('channel_id');
+            }
+        }
+
         // If Structure is installed, get it's data
         if (array_key_exists('structure', $this->EE->addons->get_installed()))
         {
#9

Kim Wickell

Great! Thanks alot!

Login to reply