SocialEngine 4: PHP notice ‘Undefined variable:

Andrew - SocialEngine

There is a known issue resulting in the main.log log file being filled with a non-existent variable being used ‘$user’ (instead of the proper variable which is ‘$viewer’).

Here’s a patch for the error:

Edit the following file with the following code:

application/modules/Forum/Form/Post/Create.php

--- a/web/application/modules/Forum/Form/Post/Create.php
+++ b/web/application/modules/Forum/Form/Post/Create.php
@@ -45,7 +45,7 @@ class Forum_Form_Post_Create extends Engine_Form
     if( $allowHtml || $allowBbcode ) {
       $upload_url = "";

-      if(Engine_Api::_()->authorization()->isAllowed('album', $user, 'create')){
+      if(Engine_Api::_()->authorization()->isAllowed('album', $viewer, 'create')){
         $upload_url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action'=>'upload-photo'),'forum_photo',true);

       }
@@ -123,4 +123,4 @@ class Forum_Form_Post_Create extends Engine_Form
     $button_group->addDecorator('DivDivDivWrapper');
   }

-}
\ No newline at end of file
+}

--- a/web/application/modules/Forum/Form/Post/Quick.php
+++ b/web/application/modules/Forum/Form/Post/Quick.php
@@ -45,7 +45,7 @@ class Forum_Form_Post_Quick extends Engine_Form

       $upload_url = "";

-      if(Engine_Api::_()->authorization()->isAllowed('album', $user, 'create')){
+      if(Engine_Api::_()->authorization()->isAllowed('album', $viewer, 'create')){
         $upload_url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action'=>'upload-photo'),'forum_photo',true);

       }
@@ -112,4 +112,4 @@ class Forum_Form_Post_Quick extends Engine_Form
       'type' => 'submit',
     ));
   }
-}
\ No newline at end of file
+}

--- a/web/application/modules/Forum/Form/Topic/Create.php
+++ b/web/application/modules/Forum/Form/Topic/Create.php
@@ -53,7 +53,7 @@ class Forum_Form_Topic_Create extends Engine_Form
     if( $allowHtml || $allowBbcode ) {
       $upload_url = "";

-      if(Engine_Api::_()->authorization()->isAllowed('album', $user, 'create')){
+      if(Engine_Api::_()->authorization()->isAllowed('album', $viewer, 'create')){
         $upload_url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action'=>'upload-photo'),'forum_photo',true);

       }
@@ -125,4 +125,4 @@ class Forum_Form_Topic_Create extends Engine_Form
     $button_group = $this->getDisplayGroup('buttons');
     $button_group->addDecorator('DivDivDivWrapper');
   }
-}
\ No newline at end of file
+}

--- a/web/application/modules/Group/Form/Topic/Create.php
+++ b/web/application/modules/Group/Form/Topic/Create.php
@@ -54,7 +54,7 @@ class Group_Form_Topic_Create extends Engine_Form
     if ( $allowHtml || $allowBbcode ) {
       $upload_url = "";

-      if(Engine_Api::_()->authorization()->isAllowed('album', $user, 'create')){
+      if(Engine_Api::_()->authorization()->isAllowed('album', $viewer, 'create')){
         $upload_url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('controller'=>'index','action'=>'upload-photo'),'group_extended',true);

       }
@@ -129,4 +129,4 @@ class Group_Form_Topic_Create extends Engine_Form

     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons');
   }
-}
\ No newline at end of file
+}

--- a/web/application/modules/Messages/Form/Compose.php
+++ b/web/application/modules/Messages/Form/Compose.php
@@ -66,7 +66,7 @@ class Messages_Form_Compose extends Engine_Form
           'html' => true,
       );

-      if(Engine_Api::_()->authorization()->isAllowed('album', $user, 'create')){
+      if(Engine_Api::_()->authorization()->isAllowed('album', null, 'create')){
         $upload_url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action' => 'upload-photo'), 'messages_general', true);
       }

@@ -123,4 +123,4 @@ class Messages_Form_Compose extends Engine_Form
       'ignore' => true
     ));
   }
-}
\ No newline at end of file
+}

 

This Should now help the arising issues and SocialEngine claim to have added this patch to the next version

 

Looking for quality SocialEngine Hosting? Look no further than Arvixe Web Hosting

Tags: , , , , , , | Posted under SocialEngine | RSS 2.0

Author Spotlight

Andrew Cross

Hi, I'm Andrew. A am a 26, ICT Administrator which offers support to company's around the South Wales Area. I have created a few social sites for myself and other company's. So far 2 out of 3 have been successful using the powerful SocialEngine Script. I continue to try and help the community of SocialEngine by giving Support and Technical Help where possible.

Leave a Reply

Your email address will not be published. Required fields are marked *