[ABD] Knowledge Base 0.2.14

In diesem Forum können Mod-Autoren ihre Mods vorstellen, die sich noch im Entwicklungsstatus befinden. Der Einbau in Foren im produktiven Betrieb wird nicht empfohlen.
Forumsregeln
phpBB 3.0 hat das Ende seiner Lebenszeit überschritten
phpBB 3.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 3.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf die neuste phpBB-Version, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Lilianne
Mitglied
Beiträge: 3
Registriert: 11.05.2012 23:52

Re: [BETA] Knowledge Base 0.2.14

Beitrag von Lilianne »

I added a function in includes/functions_kb.php to send a PM to the admin when an article needs activation. For some reason it is sont sending the PM. Could I have the wrong If Statement in the function? Thanks

Code: Alles auswählen

/**
* Send PM to admin for pending articles that needs activation
*/
function pending_article($user_id, $sender_id)
{
   global $phpEx, $phpbb_root_path, $config;
   global $template, $db, $user, $auth;
   $sender = $this->get_user_info($sender_id);
   $message_parser = new parse_message();	
          
      if($row['activ'] == 0)
          {
             include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
             include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
           
               $subject = utf8_normalize_nfc(sprintf($user->lang['KB_PENDING_SUBJECT']));
	       $message_parser->message = utf8_normalize_nfc(sprintf($user->lang['KB_PENDING_MESSAGE'], get_username_string('full', $sender['user_id'], $sender['username'], $sender['user_colour'])));          
           
          
             $message_parser->parse(true, true);
       
             $pm_data = array(
			'from_user_id'		=> (int) $sender['user_id'],
			'from_user_ip'		=> $sender['user_ip'],
			'from_username'		=> $sender['username'],
			'enable_sig'		=> false,
			'enable_bbcode'		=> true,
			'enable_smilies'	=> true,
			'enable_urls'		=> false,
			'icon_id'			=> 0,
			'bbcode_bitfield'	=> $message_parser->bbcode_bitfield,
			'bbcode_uid'		=> $message_parser->bbcode_uid,
			'message'			=> $message_parser->message,			
			'address_list'		=> array('u' => array($user_id => 'to')),
			
             );
       
             submit_pm('post', $subject, $pm_data, true);
           }
}
Zuletzt geändert von Lilianne am 21.05.2012 02:13, insgesamt 2-mal geändert.
Benutzeravatar
Miriam
Mitglied
Beiträge: 12310
Registriert: 13.10.2004 07:18
Kontaktdaten:

Re: [BETA] Knowledge Base 0.2.14

Beitrag von Miriam »

Hello,

imho there are some issues w/ the code. Have a look at the comments, pls.

Code: Alles auswählen

/**
* Send PM to admin for pending articles that needs activation
*/
function pending_article($user_id, $sender_id)
{
    global $phpEx, $phpbb_root_path, $config;
    global $template, $db, $user, $auth;
    $sender = $this->get_user_info($sender_id);        //What object is $this referencing to? Plus: phpBB3 does not know a function called: get_user_info()
    $message_parser = new parse_message();            // You instantiate an object not having the class handy, e.g. by including /includes/mesage_parser.php?  
         
    if($row['activ'] == 0)                            //Which $row-array are you talking about? I guess there is an SQL query missing.
        {
            include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
            include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
            $subject = utf8_normalize_nfc(sprintf($user->lang['KB_PENDING_SUBJECT']));  //Wouldn't that be the language of the poster and not the one receiving the notifivcation?
            $message_parser->message = utf8_normalize_nfc(sprintf($user->lang['KB_PENDING_MESSAGE'], get_username_string('full', $sender['user_id'], $sender['username'], $sender['user_colour'])));

            $message_parser->parse(true, true);
       
            $pm_data = array(
                'from_user_id'        => (int) $sender['user_id'],
                'from_user_ip'        => $sender['user_ip'],
                'from_username'        => $sender['username'],
                'enable_sig'        => false,
                'enable_bbcode'        => true,
                'enable_smilies'    => true,
                'enable_urls'        => false,
                'icon_id'            => 0,
                'bbcode_bitfield'    => $message_parser->bbcode_bitfield,
                'bbcode_uid'        => $message_parser->bbcode_uid,
                'message'            => $message_parser->message,         
                'address_list'        => array('u' => array($user_id => 'to')),
             );
       
             submit_pm('post', $subject, $pm_data, true);
           }
} 
Gruss, Miriam.
Ich schmeiß' alles hin und...
... lasse es liegen
Lilianne
Mitglied
Beiträge: 3
Registriert: 11.05.2012 23:52

Re: [BETA] Knowledge Base 0.2.14

Beitrag von Lilianne »

OK, I tried again following your advice. I don't know if I made it worse. :lol: At least the outcome is the same; no pm. Here is the test website http://sonyreaderforumtest.x10.mx/forums/knowledge/

Code: Alles auswählen

/**
* Send PM to admin for pending articles that needs activation
*/
function pending_article($article_id)
    {
        global $phpEx, $phpbb_root_path, $config;
        global $template, $db, $user, $auth;
        $sql_array = array(
        'SELECT'    => 'a.article_id, a.activ, a.article, a.titel, a.description, a.post_time, a.cat_id, a.type_id, a.user_id, a.page_uri, a.post_id, c.post_forum, c.cat_title, c.show_edits, c.right_id, c.left_id, t.name, ut.username, ut.user_colour, ut.user_id, au.username AS author',
    
        'FROM'        => array(
            KB_ARTICLE_TABLE    => 'a',
        ),
        'LEFT_JOIN'    => array(
            array(
                'FROM'    =>    array(KB_CATEGORIE_TABLE    => 'c'),
                'ON'    => 'c.cat_id = a.cat_id'
            ),
            array(
                'FROM'    => array(KB_TYPES_TABLE => 't'),
                'ON'    => 't.type_id = a.type_id'
            ),
            array(
                'FROM'    => array(USERS_TABLE => 'ut'),
                'ON'    => 'ut.user_id = ' . (int) $kb_config['post_user']
            ),
            array(
                'FROM'    => array(USERS_TABLE => 'au'),
                'ON'    => 'au.user_id = a.user_id'
            )
        ),
        'WHERE'        => 'a.article_id = ' . (int) $article_id,
    );

    $sql = $db->sql_build_query('SELECT', $sql_array);
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);
        
           if($row['activ'] = 0)
           {
            include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
            include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
        
            $message_parser = new parse_message();
        $user_tmp['user_id'] = $user->data['user_id'];
        $user_tmp['username'] = $user->data['username'];
        $user_tmp['user_colour'] = $user->data['user_colour'];

        $user->data['user_id'] = $row['user_id'];
        $user->data['username'] = $row['username'];
        $user->data['user_colour'] = $row['user_colour'];
            $post_url = append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=kb&mode=kb_activate&part=view&id=' . $row['article_id']);
            $post_link = '<a href="' . $post_url . '">';
            
         
                
             $message_parser->message = sprintf($user->lang['KB_PENDING_MESSAGE'], $user->data['username'], $post_link, '</a>');
                
            }    
            $message_parser->parse(true, true, true);
    
            $pm_data = array(
                'from_user_id'            => $user->data['user_id'],
                'from_user_ip'            => $user->ip,
                'from_username'            => $user->data['username'],
                'enable_sig'            => false,
                'enable_bbcode'            => true,
                'enable_smilies'        => true,
                'enable_urls'            => true,
                'icon_id'                => 0,
                'bbcode_bitfield'        => $message_parser->bbcode_bitfield,
                'bbcode_uid'            => $message_parser->bbcode_uid,
                'message'                => $message_parser->message,                
                'address_list'        => array('u' => array($row['username'] => 'to')),
                                                
            );
    
            submit_pm('post', $user->lang['KB_PENDING_SUBJECT'], $pm_data, true);        
    }
 
Benutzeravatar
Miriam
Mitglied
Beiträge: 12310
Registriert: 13.10.2004 07:18
Kontaktdaten:

Re: [BETA] Knowledge Base 0.2.14

Beitrag von Miriam »

If you need someone to help you out by coding something for you, you might have a look at the Jobbörse 'round here. I am sure, there will be some ppl having time on their hands to help you w/ your issues.
Gruss, Miriam.
Ich schmeiß' alles hin und...
... lasse es liegen
Lilianne
Mitglied
Beiträge: 3
Registriert: 11.05.2012 23:52

Re: [BETA] Knowledge Base 0.2.14

Beitrag von Lilianne »

Gelöst wurde es mit "Moderator Needed Mod" anstatt eine PM

Sceenshot
[ externes Bild ]
Benutzeravatar
-motte-
Mitglied
Beiträge: 283
Registriert: 22.08.2006 18:36
Wohnort: Lüdinghausen
Kontaktdaten:

Re: [BETA] Knowledge Base 0.2.14

Beitrag von -motte- »

So nun melde ich mich hier auch mal. Ich nutze die 1.2.12 noch, vom Tobi gibt es irgendwie ja nix mehr und nu hab ich ein Problem.

Bei mir meldet die Knowledgebase seid dem update vom 3.0.10 auf 3.0.11 folgendes:

Code: Alles auswählen

Allgemeiner Fehler
Du hast keine Berechtigung, auf diese Datei zuzugreifen.

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/includes/message_parser.php
LINE: 1605
CALL: trigger_error()

FILE: [ROOT]/knowledge/kbposting.php
LINE: 73
CALL: parse_message->get_submitted_attachment_data()
Ich bin jetzt die gesamte Installation des Mods noch mal Schritt für Schritt nach gegangen und stellte fest das in [root]/downloads/file.php alle Codezeilen des Mods fehlten. Diese habe ich ersetzt, der Fehler ist aber nicht weg.

Habt ihr noch eine Idee was ich da für ein Problem habe?

LG Ralph
Renault Scenic Forum 🚘 since 2003 ...

... lover of Modeltrains 🚂🚃🚃
Antworten

Zurück zu „[3.0.x] Mods in Entwicklung“