Pligg CMS Forums


Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials



Simple Email Mod - Users Only

Advanced Tutorials for Modifying your Pligg site


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-06-2007, 02:49 PM
New Pligger
 
Join Date: Jan 2007
Posts: 17
Smile Simple Email Mod - Users Only

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
Sponsor
  #2 (permalink)  
Old 02-06-2007, 02:55 PM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,547
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}

Free and Premium Pligg Hosting
I accept donations for my time helping users like you on the forum and IRC.
Reply With Quote
  #3 (permalink)  
Old 02-06-2007, 02:59 PM
New Pligger
 
Join Date: Jan 2007
Posts: 17
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, 03:28 PM
jitgos's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: Indiana (soon New Hampshire)
Posts: 339
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, 08:37 PM
New Pligger
 
Join Date: Jan 2007
Posts: 17
Smile

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 08:47 PM.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
mail: "there is a new comment in your story" inggenia Modification Tutorials 84 06-30-2009 01:04 PM
How to check if a registering user's email is valid? rhythm General Help 26 01-10-2008 06:58 PM
users email on "send to friend" chad90382 Suggestions 9 11-18-2007 12:46 PM
I can populate your site with users Pligglet Off-topic 0 10-10-2007 12:49 AM

Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Use the coupon code PLIGG at Dreamhost.com to receive a discount of up to $84.00 Make a donation to support Pligg CMS development