Simple Email Mod - Users Only

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-06-2007, 03:49 PM
New Pligger
 
Join Date: Jan 2007
Posts: 13
I made a simple mod to only allow registered users to email a story. I did this since the email comes from the pligg email address in the language file. You never know what kind of crap might end up being sent by anonymous users and associated with your pligg email address.

Check it out at: favester.com

Just click "Email this Website"

I also changed the code to produce a much friendlier email. If you have looked at what gets generated by the install, you know it is pretty ugly. You will have to register at my site and send yourself and email of a story to see how it works. That mod will work for registered or anonymous users if you decide to not implement the mod above.

Anyway, if anyone wants it, let me know and I will post it.

kb
Reply With Quote
  #2 (permalink)  
Old 02-06-2007, 03:55 PM
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
you can change the email address the email comes from. And you really didn't have to write a mod to let only registered users use the tell a friend. All you would have had to do is use an if statement around the tell a friend link. Like

{if authenticated eq "true"}

tell a friend link

{/if}
Reply With Quote
  #3 (permalink)  
Old 02-06-2007, 03:59 PM
New Pligger
 
Join Date: Jan 2007
Posts: 13
kbeeveer46,

Nice. What does that do when they try to click it ? This displays a message that they need to register. And it is a three liner too, so no biggie.

Others may want the changes I made to the message itself, since the standard one is pretty ugly. Again, simple mod, but makes a much nicer message.

Thanks

kb
Reply With Quote
  #4 (permalink)  
Old 02-06-2007, 04:28 PM
jitgos's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: Indiana (soon New Hampshire)
Posts: 315
Thanks kahunabear,

I'd say absolutely post them... the more mods submitted the better ... devs can check them over and users will always weed out the bad ones or ones they don't want.
Reply With Quote
  #5 (permalink)  
Old 02-06-2007, 09:37 PM
New Pligger
 
Join Date: Jan 2007
Posts: 13
I made these changes to recommend.php:

To display a message that you must be logged in:

Before:

Code:
if(isset($requestTitle)){
	$requestID = $db->get_var("SELECT link_id FROM " . table_links . " WHERE `link_title_url` = '$requestTitle';");
}else{
	if(!is_numeric($requestID)){
		$requestID = $db->get_var("SELECT link_id FROM " . table_links . " WHERE `link_title_url` = '$requestID';");
	}
}
if(!isset($_REQUEST['email_to_submit'])){ // we're not submitting the form

After:

Code:
if(isset($requestTitle)){
	$requestID = $db->get_var("SELECT link_id FROM " . table_links . " WHERE `link_title_url` = '$requestTitle';");
}else{
	if(!is_numeric($requestID)){
		$requestID = $db->get_var("SELECT link_id FROM " . table_links . " WHERE `link_title_url` = '$requestID';");
	}
}
if (!$current_user->user_login){
	echo "<br>Must be logged in to email.<br>";
	return;
}
if(!isset($_REQUEST['email_to_submit'])){ // we're not submitting the form

To make a more readable email message:

Before:

Code:
$body = $message . "\r\n" . Included_Text_Part1 . $current_user->user_login . Included_Text_Part2 . $link_url . ' "' . $link->title . '" ' .  $link->content;
After:

Code:
if ($current_user->user_login){
	$body = $message . "\r\n\r\n" . Included_Text_Part1 ."\r\n\r\n". $current_user->user_login .", ". Included_Text_Part2 ." ".$link->title." - " .$link->content."\r\n\r\n" ."Here is a link to the story: ". $link_url;
}
else{
	$body = $message . "\r\n\r\n" . Included_Text_Part1 ."\r\n\r\nAnonymous, ". Included_Text_Part2 ." ".$link->title." - " .$link->content."\r\n\r\n" ."Here is a link to the story: ". $link_url;		
}
The else is if you don't do the first mod and just want the message to say it is from "Anonymous" for non registered users.

kb
favester.com

Last edited by kahunabear; 02-06-2007 at 09:47 PM.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to send email to all users at once tarok Questions and Comments 7 09-30-2011 10:49 PM
mail: "there is a new comment in your story" inggenia Questions and Comments 90 03-27-2010 08:07 AM
How to check if a registering user's email is valid? rhythm Questions and Comments 26 01-10-2008 07:58 PM
users email on "send to friend" chad90382 Questions and Comments 9 11-18-2007 01:46 PM
I can populate your site with users Pligglet Questions and Comments 0 10-10-2007 01:49 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development