Forums / Developer / function "write to guru"

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

function "write to guru"

Author Message

Vytautas Germanavičius

Monday 19 September 2005 10:46:35 am

I need function, i call it "write to guru":
Every user has assigned "guru" (another user). I need something like feedback form, but sender information must be taken from cuurent user, and destination email, must be taken from urrent user's "guru".

{set-block scope=root variable=cache_ttl}0{/set-block}

Łukasz Serwatka

Monday 19 September 2005 11:17:14 am

Hi vytis,

You can make custom extension, xhtml form, send post data to one of module view. Modify code below and fetch assigned Guru`s e-mail (you did now write, how is assigned), and send e-mail.

Example code can look:

<?php 

include_once( 'lib/ezutils/classes/ezmail.php' );
include_once( 'lib/ezutils/classes/ezmailtransport.php' );
include_once( 'lib/ezutils/classes/ezhttptool.php' );

$http =& eZHTTPTool::instance();

//Current user data
$user =& eZUser::currentuser();
$object =& $user->attribute( 'contentobject' );

//Receiver
$receiver = $object->attribute( 'assigned_guru_email' );

//E-mail sender
$emailSender = $user->atribute( 'email' );

//Message
$body = $http->postVariable( 'text' );

$mail = new eZMail
$mail->setReceiver( $receiver );
$mail->setSender( $emailSender );
$mail->setBody( $body );

$mailResult = eZMailTransport::send( $mail );

?>

This code needs some modifications but, should give you right point.

Good luck.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog