Newsletter in Forum Edit Profile

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Newsletter in Forum Edit Profile
Purus
CZ Super Newbie
Purus has been a member for over 20 year's 20 Year Member
usa.gif newyork.gif
Occupation: Student
Gender: Male
Fav. Sports Team: US Junior Orienteering Team
Website:
Status: Offline
Joined: Dec 28, 2003
0.01 posts per day
Posts: 62
Points: 2,591
   
Is there any way to add a field to the Forum Edit Profile that allows a user to control whether or not they recieve the newsletter? I am attempting to move the field from the Your_Account Edit Profile function to the includes/usercp_register.php file so that you can select to recieve the newsletter while editing your forum profile, but I don't really understand the code well enough to do it. Has someone already done something like this, or would it be possible for someone to do it for me?




_________________
[ Register or login to view links on this board.] | [ Register or login to view links on this board.]
Back to top Reply with quote
#2   re: Newsletter in Forum Edit Profile
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Ok I had a few minutes so I wrote a mod for this. I tested it on this site and it is working fine. Make a backup before trying it.

Open modules/Forums/language/lang_english/lang_main.php

Find

//
// That's all Folks!
// -------------------------------------------------


BEFORE add

//Add on for Newsletter Mod
$lang['Newsletter'] = 'Newsletter Subscription';
$lang['Yes'] = 'Yes';
$lang['No']='No';


Open includes/usercp_register.php

Find

$signature = str_replace('<br />', "\n", $signature);


AFTER add

$newsletter = ( isset($HTTP_POST_VARS['newsletter']) ) ? intval ($HTTP_POST_VARS['newsletter']) : 0;


Find

$sql = "UPDATE " . USERS_TABLE . "
SET "
WHERE user_id = $user_id";


IN THAT LINE FIND

$avatar_sql . "


In line AFTER add

, newsletter=$newsletter


Find

$sql = "INSERT INTO " . USERS_TABLE . "
VALUES (


IN LINE FIND

, user_style


AFTER add

, newsletter


IN LINE FIND

, $user_style


AFTER ADD

, '$newsletter'


Find

$interests = $userdata['user_interests'];


AFTER add

$newsletter=$userdata['newsletter'];


Find

display_avatar_gallery(


IN LINE FIND

);


IN LINE BEFORE ADD

, $newsletter


Find

$smilies_status = ( $userdata['user_allowsmile'] && $board_config['allow_smilies']  ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];


AFTER ADD

switch ($newsletter)
{
   case 1: $ck1="checked=\"checked\"";break;
   default: $ck2="checked=\"checked\"";
}


Find

'INTERESTS' => $interests,
'LOCATION' => $location,


AFTER ADD

'NEWSLETTER' => $newsletter,
'YES' => $ck1,
'NO' => $ck2,


Find

'L_INTERESTS' => $lang['Interests'],


AFTER ADD

'L_NEWSLETTER' =>$lang['Newsletter'],
'L_YES' =>$lang['Yes'],
'L_NO' =>$lang['No'],


Now also make these changes to every themes/YOUR_THEME/forums/profile_add_body.tpl

Find

<tr>
<td class="row1"><span class="explaintitle">{L_BOARD_LANGUAGE}:</span></td>
<td class="row2">{LANGUAGE_SELECT}</td>
</tr>


BEFORE ADD

<tr>
      <td class="row1"><span class="gen">{L_NEWSLETTER}:</span></td>
      <td class="row2">
      <input type="radio" name="newsletter" value="1" {YES}/>
      <span class="gen">{L_YES}</span> ;; ;;
      <input type="radio" name="gender" value="0" {NO}/>
      <span class="gen">{L_NO}</span></td>
</tr>


Save and upload.

I will also make this in a text file and put into the downloads.

EDIT

Added to DL's
[ Register or login to view links on this board. ]



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   
Purus
CZ Super Newbie
Purus has been a member for over 20 year's 20 Year Member
usa.gif newyork.gif
Occupation: Student
Gender: Male
Fav. Sports Team: US Junior Orienteering Team
Website:
Status: Offline
Joined: Dec 28, 2003
0.01 posts per day
Posts: 62
Points: 2,591
   
You friggin rock Telli! I knew you'd understand. You think you could make a mod to add the "Extra Info" box while you are at it? eusa_dance.gif

*/ Edit

Doh! It isn't working. It appears on the edit profile page just fine, with the Yes option selected, but when you click on the "No" radio option, it selects it, but it doesn't deselect the "Yes" option. Then both are selected, and when you click submit nothing happens. I went through the code a couple times to make sure I hadn't made a mistake, but I guess it is still possible. I used the code in this post. Have you made any changes to the code in the downloads section? Maybe I should try that first eusa_think.gif




_________________
[ Register or login to view links on this board.] | [ Register or login to view links on this board.]
Back to top Reply with quote
#4   re: Newsletter in Forum Edit Profile
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
You have to be exact with the code. Its working fine on this site. And I will look into the extra info box this afternoon or this evening.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum