Gossamer Forum
Home : Products : Gossamer Links : Discussions :

how to email all user's link to user

Quote Reply
how to email all user's link to user




i wonder if i could have a scirpt or globle
which will email back user all links owned
below code are only able to email back single link

it it possible to have a loop in email tempalate?
andyone did it before?


my $link = $DB->table('Links')->get($linkid);
Links::send_email("8add-email-pre.eml", { %$IN, %$link, %$USER }) or die "Unable to send message: $GT::Mail::error";

Thanks

Last edited by:

austin99: Sep 1, 2009, 11:31 PM
Quote Reply
Re: [austin99] how to email all user's link to user In reply to
To do it for ALL validated links, you could use:
Code:

my $sth = $DB->table('Links')->select( { isValidated => "Yes" } );

while (my $hit = $sth->fetchrow_hashref) {

my $user = $DB->table('Users')->select( { Username => $hit->{LinkOwner} } )->fetchrow_hashref;

my $link = $DB->table('Links')->get($linkid);
Links::send_email("8add-email-pre.eml", { $IN->get_hash, %$link, %$user }) or die "Unable to send message: $GT::Mail::error";
}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] how to email all user's link to user In reply to
Thank you Andy



i wonder if it gives multiple links' informaiton per email per user?
as i don;t see any loop code in link tempalate .

what i would like to achieve is :


user one
here is all your links submitted

link1 link1 information
link2 link2 information
link3 link3 information
link4 link4 information
link5 link5 information


Thanks

Last edited by:

austin99: Sep 2, 2009, 12:39 AM
Quote Reply
Re: [austin99] how to email all user's link to user In reply to
Nope - that won't do that. You would need something more advanced to do that (afraid I don't have time to write it at the moment, as got loads of work to be getting on with, sorry)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] how to email all user's link to user In reply to
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ADD_DATE DESC Limit 3');
$sth = $search_db->select ( { isNew => 'Yes'});
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);

}
my $TAGS;
$TAGS->{'output'} = $output;
Links::send_email("email-links.eml", { %$IN, %$USER, %$TAGS }) or die "Unable to send message: $GT::Mail::error";



email-links.eml

<%output%>



you then get a mail


link 1
link 2
link 3



share with others in case any one need it.
Quote Reply
Re: [austin99] how to email all user's link to user In reply to
Hi,

Links::send_email("email-links.eml", { %$IN, %$USER, %$TAGS }) or die "Unable to send message: $GT::Mail::error";

...should be:

Links::send_email("email-links.eml", { $IN->get_hash, %$USER, %$TAGS }) or die "Unable to send message: $GT::Mail::error";

..as $IN is a GT::CGI object, and not a hashref :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [austin99] how to email all user's link to user In reply to
Thanks you Andy. you are right. Thanks for the corrction.


austin99 wrote:
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY ADD_DATE DESC Limit 3');
$sth = $search_db->select ( { isNew => 'Yes'});
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
#$output .= GT::Template->parse( 'email-links.txt', { $IN->get_hash, %$CFG }, { compress => 0 } ); #replace it with above line if you have layout problem
}
my $TAGS;
$TAGS->{'output'} = $output;
Links::send_email("email-links.eml", { $IN->get_hash, %$USER, %$TAGS }) or die "Unable to send message: $GT::Mail::error";



email-links.eml

<%output%>



you then get a mail


link 1
link 2
link 3



share with others in case any one need it.

Last edited by:

austin99: Sep 30, 2009, 5:45 PM
Quote Reply
Re: [Andy] how to email all user's link to user In reply to
Andy wrote:
Links::send_email("email-links.eml", { $IN->get_hash, %$USER, %$TAGS }) or die "Unable to send message: $GT::Mail::error";

..as $IN is a GT::CGI object, and not a hashref :)

1) Links::user_page is used to parse the template, so you don't need to pass $USER or $IN.
2) You can pass $IN and $CFG into GT::Template since it handles these objects properly.

Adrian
Quote Reply
Re: [brewt] how to email all user's link to user In reply to
Ah, didn't know that =) (well, probably did, but never realised the reason behind it ;))

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!