Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba

Difficulty with widget and login via admin


Go to End
Reply


3 Posts   1568 Views

Avatar
SilverRay

Community Member, 167 Posts

11 November 2010 at 6:06pm

Edited: 11/11/2010 7:53pm

Hi,

I have SilverStripe 2.4.2 running, with the blog module version 0.4.1. I want to show, let's say, the TagCloudWidget on all pages instead of only the blog section. So as per http://doc.silverstripe.org/widgets I disable the whole widget thingie from BlogTree.php etc. and put the following in Page.php (controller):

function MyTagCloudWidget() {
	$widget = new TagCloudWidget();
	return $widget->renderWith('WidgetHolder');
}

I use $MyTagCloudWidget on Page.ss to show the widget. This works, but when I want to logout of the CMS I get an error:

[User Error] Uncaught Exception: Object->__call(): the method 'data' does not exist on 'Security'
GET /Security/login?BackURL=%2Fadmin

Line 724 in /Applications/MAMP/htdocs/sapphire/core/Object.php
Source

715 				
716 				default :
717 					throw new Exception (
718 						"Object->__call(): extra method $method is invalid on $this->class:" . var_export($config, true)
719 					);
720 			}
721 		} else {
722 			// Please do not change the exception code number below.
723 			
724 			throw new Exception("Object->__call(): the method '$method' does not exist on '$this->class'", 2175);
725 		}
726 	}
727 	
728 	// -----------------------------------------------------------------------------------------------------------------
729 	
730 	/**

Trace

    * Object->__call(data,Array)
    * Security->data()
      Line 47 of BlogTree.php
    * BlogTree::current()
      Line 50 of TagCloudWidget.php
    * TagCloudWidget->TagsCollection()
      Line 369 of ViewableData.php
    * ViewableData->obj(TagsCollection)
      Line 6 of .cache.Applications.MAMP.htdocs.themes.mytheme_blog.templates.TagCloudWidget.ss
    * include(/Applications/MAMP/htdocs/silverstripe-cache/.cache.Applications.MAMP.htdocs.themes.mytheme_blog.templates.TagCloudWidget.ss)
      Line 420 of SSViewer.php
    * SSViewer->process(TagCloudWidget)
      Line 342 of ViewableData.php
    * ViewableData->renderWith(Array)
      Line 64 of Widget.php
    * Widget->Content()
      Line 369 of ViewableData.php
    * ViewableData->obj(Content,,,1)
      Line 446 of ViewableData.php
    * ViewableData->XML_val(Content,,1)
      Line 5 of .cache.Applications.MAMP.htdocs.themes.mytheme_blog.templates.WidgetHolder.ss
    * include(/Applications/MAMP/htdocs/silverstripe-cache/.cache.Applications.MAMP.htdocs.themes.mytheme_blog.templates.WidgetHolder.ss)
      Line 420 of SSViewer.php
    * SSViewer->process(TagCloudWidget)
      Line 342 of ViewableData.php
    * ViewableData->renderWith(WidgetHolder)
      Line 49 of Page.php
    * Page_Controller->MyTagCloudWidget()
      Line 369 of ViewableData.php
    * ViewableData->obj(MyTagCloudWidget,,,1,)
      Line 827 of ViewableData.php
    * ViewableData_Customised->obj(MyTagCloudWidget,,,1)
      Line 446 of ViewableData.php
    * ViewableData->XML_val(MyTagCloudWidget,,1)
      Line 53 of .cache.Applications.MAMP.htdocs.themes.mytheme.templates.Layout.Page.ss
    * include(/Applications/MAMP/htdocs/silverstripe-cache/.cache.Applications.MAMP.htdocs.themes.mytheme.templates.Layout.Page.ss)
      Line 420 of SSViewer.php
    * SSViewer->process(ViewableData_Customised,Zend_Cache_Frontend_Output)
      Line 411 of SSViewer.php
    * SSViewer->process(ViewableData_Customised)
      Line 342 of ViewableData.php
    * ViewableData->renderWith(Array)
      Line 403 of Security.php
    * Security->login(SS_HTTPRequest)
      Line 193 of Controller.php
    * Controller->handleAction(SS_HTTPRequest)
      Line 137 of RequestHandler.php
    * RequestHandler->handleRequest(SS_HTTPRequest)
      Line 147 of Controller.php
    * Controller->handleRequest(SS_HTTPRequest)
      Line 281 of Director.php
    * Director::handleRequest(SS_HTTPRequest,Session)
      Line 124 of Director.php
    * Director::direct(/Security/login)
      Line 127 of main.php

This on a local MAMP install, but the same happens on a 'real' server. If I remove the $MyTagCloudWidget call, I can login again. Any ideas?

Thanks!

Edit: I seem to be able to solve it by using a separate Security_login.ss template, but still I would like to know why the above will happen without such thing. It happens with a vanilla install too, using the BlackCandy theme...

Avatar
iON creative

Community Member, 42 Posts

2 November 2011 at 7:35pm

Hi there - I'm having exactly the same issue - did you ever resolve this other than a separate Security_login.ss file?

Many thanks,

Jayne

Avatar
klikhier

Community Member, 150 Posts

12 October 2012 at 8:15pm

I've worked around this by changing line 54 in TagCloudWidget.php. I have just one BlogHolder on my website, so for me this did the trick.

//$container = BlogTree::current();
$container = DataObject::get_one('BlogHolder');