Help (php amateur hour)

From: Matt14 Apr 2012 13:02
To: CHYRON (DSMITHHFX) 4 of 7
Try this (not tested, but should give you an idea):

php code:
<?php defined('BASEPATH') or exit('No direct script access allowed');
 
class Module_Blog extends Module {
 
    public $version = '2.0';
 
    public function info()
    {
        $info = array(
            'name' => array(
                'en' => 'Blog',
                'ar' => 'المدوّنة',
                'el' => 'Ιστολόγιο',
                'br' => 'Blog',
                'pl' => 'Blog',
                'he' => 'בלוג',
                'lt' => 'Blogas',
                'ru' => 'Блог',
                'zh' => '文章',
                'id' => 'Blog'
            ),
            'description' => array(
                'en' => 'Post blog entries.',
                'nl' => 'Post nieuwsartikelen en blogs op uw site.',
                'es' => 'Escribe entradas para los artículos y blog (web log).', #update translation
                'fr' => 'Envoyez de nouveaux posts et messages de blog.', #update translation
                'de' => 'Veröffentliche neue Artikel und Blog-Einträge', #update translation
                'pl' => 'Dodawaj nowe wpisy na blogu',
                'br' => 'Escrever publicações de blog',
                'zh' => '發表新聞訊息、部落格等文章。',
                'it' => 'Pubblica notizie e post per il blog.', 
…[Message Truncated] View full message.
EDITED: 14 Apr 2012 13:03 by MATT
From: CHYRON (DSMITHHFX)14 Apr 2012 16:45
To: Matt 5 of 7
That removes the categories tab from everyone, including admins. At least it doesn't throw an error.

Let me try this again. I missed a bit of your code, so I just pasted in the whole thing. Now it behaves correctly, but is throwing the following errors (which are appearing on every page):
---
Message: Undefined property: CI::$current_user
Filename: libraries/Module.php
Line Number: 137
---
AND
---
Message: Trying to get property of non-object
Filename: blog/details.php
Line Number: 78
---
the details.php array is somehow referenced by Module.php, I guess.
EDITED: 14 Apr 2012 16:55 by DSMITHHFX
From: Matt14 Apr 2012 17:11
To: CHYRON (DSMITHHFX) 6 of 7
I don't know PyroCMS nor codeignitor so I'm not going to be able to help you beyond the basic PHP syntax.

I can tell you that the error means the Module_Blog class nor it's parent Module class have a property named current_user, which is referenced in the if statement you had in your first post and which I simply copied and pasted wholesale into my example.

If you can find some other code in PyroCMS to get the current user then you can possibly copy that to use that and modify the if statement to use that code.

Honestly, you'll be better off asking the PyroCMS team / community I reckon.
From: CHYRON (DSMITHHFX)14 Apr 2012 17:26
To: Matt 7 of 7
OK thanks. I thought it might be a (relatively) simple syntax issue, as is often the case with my hacking efforts.