Roundcube Community Forum

 

Trying to add custom link to task menu to import address books from old system

Started by mspicer, February 14, 2009, 05:21:17 PM

Previous topic - Next topic

mspicer

I am trying to add a custom link to the task to import address books from our old webmail system.  The only thing I am having trouble with is getting the user's id.  I would like the link to be
import old where the [email protected] is the users email.  Since round cube uses template processing () I can't find a way to get the email or where I could grab it from.  

Any help would be great!

Thanks,

Mike

mspicer

I figured out how to do this.  It was a little complicated, but I received help from http://www.roundcubeforum.net/general-discussion/4133-adding-links-task-bar.html.  I will try to lay this out as an easy to follow guide.  

You start by editing your round cube template generator to have the ability to create new objects.
    Find the file roundcube/program/include/rcube_template.php
    Find the following section:
 $this->add_handlers(array(
            
'loginform'       => array($this'login_form'),
            
'username'        => array($this'current_username'),
            
'message'         => array($this'message_container'),
            
'charsetselector' => array($this'charset_selector'),
        ));

    Add a section for your custom object.  I added one called 'useroutput'.
    Now scroll to the bottom of the file just above the last '}' and add your function name.  The function name needs to equal what you put in the array next the '$this'.  For example if I was creating one for loginform, I would make a function named login_form. Now make the function do what ever your heart desires.  Mine is a basic that uses the $_SESSION['username'] variable.