Roundcube Community Forum

 

How to get variables from $this

Started by nlreeftank, November 16, 2012, 07:22:02 AM

Previous topic - Next topic

nlreeftank

how do i access these vars contained in $this

                                     [message] => rcube_mail_header Object
                                                (
                                                    [id] => 13
                                                    [uid] => 13

I need the to,from  etc

nlreeftank

#1
im a total noob with objects in objects.
Can anyone help me get the from,to etc

<?php
/**
 * verander_body
 *
 * Sample plugin to replace emoticons in plain text message body with real icons
 *
 * @version 1.0
 * @author Gerd K
 * @url http://www.domain.com
 */
class verander_body extends rcube_plugin
{

 
 public $task 'mail';
 private $inhoud '';

  function init()
  {
$app rcmail::get_instance ();
$this->add_hook('message_compose_body', array($this'replace'));
  }



  function replace($args,$inhoud)
  {

$args['body'] = print_r($args,1)."|".print_r($this,1);
return 
$args;
  }
}


?>

nlreeftank

I took the bad way arround

$alles=print_r($this,1);
$b1=explode("[to] => ",$alles);
$b1=explode("[cc]",$b1[1]);
$to=$b1[0];



If someone can explain me how to do this the correct way , i would be very thankful
this eats memory

JohnDoh

if its the headers you want they you are using the wrong hook, check message_compose is the one you want see http://trac.roundcube.net/wiki/Plugin_Hooks#message_compose you can get the values like $args['param']['to']
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

nlreeftank

but then i cant change the body tekst in the reply.
or can i save it before to a session

JohnDoh

one plugin and use manu hooks so you do what ever you need to do to the headers in one function and then the body in the next.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...