JOOM::GALLERY::FORUM

Archive => Backend / Administration => Topic started by: mebuzzme on 09-12-2008 18:46:27



Title: Add message field to Send to Friend
Post by: mebuzzme on 09-12-2008 18:46:27
How would I go about adding a personal message field to the send to friend form? I would like my visitors to use the gallery like an e-post card type of thing. So the email would contain the personal message.

Any guidance would be greatly appreciated.

Kevin


Title: Re: Add message field to Send to Friend
Post by: aHa on 26-12-2008 14:29:46
Hi,
the following modification should work:

1) Open the file sub_viewdetails.html.php and search the function 'ShowSend2FriendArea'
beginning with line 1026. Then scroll down to the code which shows the input fields, beginning with line 1074:


Code
<tr class="<?php echo $sectiontableentry2; ?>">
 <td width="30%" valign="top">
   <b><?php echo _PONYGALLERY_FRIENDS_MAIL; ?></b>
 </td>
 <td width="70%" valign="top">
   <input type="text" name="send2friendemail" size="15" class="inputbox" onfocus="pg_comment_active=1" onreset="pg_comment_active=0" onchange="pg_comment_active=0" onblur="pg_comment_active=0" />
 </td>
</tr>
<tr class="<?php echo $sectiontableentry1; ?>">
 <td width="30%" valign="top">&nbsp;
 </td>
 <td>
   <br /><input type="button" name="send" value="<?php echo _PONYGALLERY_SEND; ?>" class="button" onClick="validatesend2friend()" />
 </td>
</tr>
 


This code shows the input box for 'Your Friend's Email' and the 'send' button.

Between them insert the code for the new textarea with the name 'send2friendmsg':

Code
<tr class="<?php echo $sectiontableentry2; ?>">
 <td width="30%" valign="top">
   <b><?php echo _PONYGALLERY_FRIENDS_MAIL; ?></b>
 </td>
 <td width="70%" valign="top">
   <input type="text" name="send2friendemail" size="15" class="inputbox" onfocus="pg_comment_active=1" onreset="pg_comment_active=0" onchange="pg_comment_active=0" onblur="pg_comment_active=0" />
 </td>
</tr>
<tr class="<?php echo $sectiontableentry1; ?>">
 <td width="30%" valign="top">
   <b>Message</b>
 </td>
 <td width="70%" valign="top">
   <textarea name="send2friendmsg" class="inputbox" cols="30" rows="5" onfocus="pg_comment_active=1" onchange="pg_comment_active=0" onblur="pg_comment_active=0" ></textarea>
 </td>
</tr>              
<tr class="<?php echo $sectiontableentry2; ?>">
 <td width="30%" valign="top">&nbsp;
 </td>
 <td>
   <br /><input type="button" name="send" value="<?php echo _PONYGALLERY_SEND; ?>" class="button" onClick="validatesend2friend()" />
 </td>
</tr>
 

From now on you can see the additional field.

Then open the file 'ponygallery.php' at line 653:

Code
case 'send2friend':
 $send2friendname=mosGetParam( $_POST, 'send2friendname', '' );
 $send2friendemail=mosGetParam( $_POST, 'send2friendemail', '' );
 $from2friendname=mosGetParam( $_POST, 'from2friendname', '' );
 $from2friendemail=mosGetParam( $_POST, 'from2friendemail', '' );
 $id= intval(mosGetParam( $_POST, 'id', ''));
 $text=$from2friendname . " (" . $from2friendemail . ")"
 . " "._PONYGALLERY_INVITE_VIEW_PIC."\r \n";
 $text.=$mosConfig_live_site . "/index.php?option=com_ponygallery&func=detail&id=$id \r \n";
 $subject=$mosConfig_sitename . ' - ' . _PONYGALLERY_RECCOMEND_PIC_FROM_FREND;
 mosMail( $mosConfig_mailfrom, $mosConfig_fromname, $send2friendemail, $subject, $text);
 

and add there the two lines commented above

Code
case 'send2friend':
 $send2friendname=mosGetParam( $_POST, 'send2friendname', '' );
 $send2friendemail=mosGetParam( $_POST, 'send2friendemail', '' );
 $from2friendname=mosGetParam( $_POST, 'from2friendname', '' );
 $from2friendemail=mosGetParam( $_POST, 'from2friendemail', '' );
 //new get the message
 $send2friendmsg=mosGetParam( $_POST, 'send2friendmsg', '' );
 
 $id= intval(mosGetParam( $_POST, 'id', ''));
 $text=$from2friendname . " (" . $from2friendemail . ")"
 . " "._PONYGALLERY_INVITE_VIEW_PIC."\r \n";
 $text.=$mosConfig_live_site . "/index.php?option=com_ponygallery&func=detail&id=$id \r \n";
 
 //new, add the message to the text
 $text.=$send2friendmsg;
 $subject=$mosConfig_sitename . ' - ' . _PONYGALLERY_RECCOMEND_PIC_FROM_FREND;
 mosMail( $mosConfig_mailfrom, $mosConfig_fromname, $send2friendemail, $subject, $text);
 

Not tested
Regards
Andreas