Ok, Jensf, I am going to need a little assistance here. I tried to modify my code so that the user could choose whether or not he would accept email when a new comment is made, instead of just choosing whether or not to accept email from admin. It seems to be working ok, but with my lack of knowledge in PHP, I cannot seem to get the option to display right in the member_editprofile.html file. When I load up the members control panel page, I can see the radio buttons, but I cannot see the text that states what the buttons are for. Also, even though I select the yes button, when I click on save, and the page reloads, it states at the top that my profile was updated, but the radio buttons are now both blank. I did add the table to mysql for called user_allowmailcomments. It was set to tinyint with a value/length of 1. I am completely beside myself trying to understand why the text doesn't show up.
Here is my code:
member_editprofile.html:
<tr>
<td class="head1"><b>{lang_allowmailcomments}</b></td>
<td class="head1">
<input type="radio" name="user_allowmailcomments" value="1"{user_allowmailcomments_yes} />
{lang_yes}
<input type="radio" name="user_allowmailcomments" value="0"{user_allowmailcomments_no} />
{lang_no}</td>
</tr>
lang/english/main.php:
$lang['allowmailcomments'] = "Email me:";
and details.php:
//-----------------------------------------------------
// Start Emailer for comments
//-----------------------------------------------------
$recipient_name = $image_row['user_name'];
$recipient_email = $image_row['user_email'];
$image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id;
$sql = "SELECT user_allowmailcomments FROM ".USERS_TABLE." WHERE ".get_user_table_field("", "user_name")." = '".$recipient_name."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$user_allowmailcomments = ($row['user_allowmailcomments']);
if ($image_row['user_id'] != $user_info['user_id'] && $user_allowmailcomments == 1) {
$current_time = time();
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$site_email->set_to($recipient_email);
$site_email->set_from($config['site_email'], $config['site_name']);
$site_email->set_subject($lang['send_comment_emailsubject']);
$site_email->register_vars(array(
"user_name" => stripslashes($user_name),
"recipient_name" => stripslashes($image_row['user_name']),
"image_name" => $image_row['image_name'],
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
"site_name" => $config['site_name'],
"image_url" => $image_url,
"comment_text" =>(stripslashes($comment_text)),
"comment_headline"=>(stripslashes($comment_headline)),
));
$site_email->set_body("comment_email", $config['language_dir']);
$site_email->send_email();
}
//----------------------------------------------------
I don't have a lot of knowledge with php, but from what I can tell, nothing seems out of line compared with the "allow_emailcomments" section just above this one. I have tried renaming the variables every which way, and can't get the text to show up, nor the radio buttons to show the selected option. Please help!
Thanks, and thanks everyone for the great mod!