PDA

View Full Version : Edit link ~ Email Notification Question


Loren
07-09-2006, 01:00 PM
Question for the lads (Nick, Greg or Sergey or anyone else if they know how:))

If you have your edit link set to active i.e. no need to be approved (which is not the norm in the script anyway my mod) Is it possible to create upon editing submitted (incorporating with the submit button), an email to admin to say it has been edited? Just so i can check that all is above board?

Loren
07-11-2006, 10:48 AM
Oops and another little reminder Simon or Nick :wink:

Loren
07-17-2006, 01:02 PM
bumpty bump

Loren
07-18-2006, 08:22 AM
Hello???

Okay let me reword this:

Is it possible to make the edit-submit button, send admin an email upon clicking the submission button, regardless of it's status?

Vincent Wright
07-18-2006, 12:15 PM
Is it possible to make the edit-submit button, send admin an email upon clicking the submission button, regardless of it's status?


The answer to your question is "Yes". Yes, it's possible to send an email when an editor edits his/her links and clicks Edit Link button.

There are several question though:

1. What should be the From: header?
2. What should be the Subject: line?
3. What should be the content of the email?

P.S.

As you know we have some crucial bugs to fix. My #1 priority now is reimplementing cron jobs and writing detailed instructions on how to set up cron jobs. Thus I won't be able to implement this mod right now. Though, if you answer the questions above I will put this in my "TODO List" <g>

Loren
07-18-2006, 01:15 PM
The answer to your question is "Yes". Yes, it's possible to send an email when an editor edits his/her links and clicks Edit Link button.

There are several question though:

1. What should be the From: header?
2. What should be the Subject: line?
3. What should be the content of the email?

P.S.

As you know we have some crucial bugs to fix. My #1 priority now is reimplementing cron jobs and writing detailed instructions on how to set up cron jobs. Thus I won't be able to implement this mod right now. Though, if you answer the questions above I will put this in my "TODO List" <g>
Oh Bless you Vincent. Yes i know you have some things to do..and we must not hinder those! :)

I would appreciate that although, in order not to take your time up at all, Is it complex? If you want to point me in the direction, i might be able to work it out, with maybe a few hints from yourself, i guess the changes would be in the edit.php file?

1. I guess it would be {id} in otherwords the {id} of the link. I can see in my admin panel the id 's immediately. Although, i could have {title} as well just to make sure.

2. Link Edited

3. Now this one is a toughy go for {description} for now, coz i think once i got the idea i could put the others in.

Another question...Can for example {if $link.description neq ''} be put in an email also? Just thinking if i have a whole list, and only one item is changed, then this way i would only see what was actually changed...

thanks petal :kiss:

Vincent Wright
07-19-2006, 03:30 AM
In PHP there is mail() (http://www.php.net/mail) function that is capable of sending emails.

You can call it when the link is saved after having been edited. Play with it and see what happens.

Loren
07-19-2006, 08:12 AM
In PHP there is mail() (http://www.php.net/mail) function that is capable of sending emails.

You can call it when the link is saved after having been edited. Play with it and see what happens.

Will do! Bless you petal...:)

Loren
07-25-2006, 08:19 PM
Hey Vinny or anyone, can you answer me on this, when i get a copy of the emails that send out coz i am a member too :) I get this

You can view your link here:
http://www.spiritmindbody.co.uk/directory// <---it's the double backslashes that worry me, how to rectify please?

Sai_dallas
07-25-2006, 10:00 PM
This is the one I was bragging about earlier.

Now you took up this issue, I would love to see a solution.

Any time you move the link you get the new link like the one you were pointing.

(I did not test for changing the link)



.

Loren
07-25-2006, 11:30 PM
This is the one I was bragging about earlier.

Now you took up this issue, I would love to see a solution.

Any time you move the link you get the new link like the one you were pointing.

(I did not test for changing the link)



.
Oh Bless you Sai, but i don't think you used the right terminology...you are certainly not bragging petal, but now you mention it i do recall you raise this issue a while back. My problem is when it's modified.

Actually what would be helpful Vincent, Simon who ever is to tell us the terminology that is used for the emails, because i notice they do not have {$} in them. If we could at least understand what is used for what we could fix and modify ourselves.

So what is missing from the above, the extention part of the url relating to the editors link.

And I do hope we will get some kind of resolution on this, as the emails look tatty. Not very professional i have to say. :bebe:

Vincent Wright
07-26-2006, 05:08 AM
I cannot solve this problem virtually just by skimming through source codes. I need to reproduce it. So, please, give me detailed steps on how to repro it. And I will try to track it down.

Loren
07-26-2006, 02:16 PM
I cannot solve this problem virtually just by skimming through source codes. I need to reproduce it. So, please, give me detailed steps on how to repro it. And I will try to track it down.

Fair enough :good:

How about this then.

Dear Kindred Spirit,

We are glad to inform you, that your link to site {your_site_url} was modified.
These are the new attributes of your link:

Title: {your_site_title}
URL: {your_site_url}
Description: {your_site_desc}
Email: {your_site_email}
Rank: {your_site_rank}
Status: {your_site_status}

You can view your link here:
{dir_link}

______________________________
Love, Light and Peace
{own_site} Administration Team
{own_url}
{own_email}

Looks like this

Dear Kindred Spirit,

We are glad to inform you, that your link to site http://www.ipyramidia.com was modified.
These are the new attributes of your link:

Title: Holistic Web Design
URL: http://www.ipyramidia.com
Description: Specialist Holistic Design, Spiritual and Mystical Websites, encompassing all areas from spiritual teachings online to complementary therapy businesses.

I personally live every day with esoteric teachings, healing, personal & spiritual development, mediumship, psychic development, tarot, etc., I just happen to design web sites too!
Email: loren@ipyramidia.com
Rank: 0
Status: active

You can view your link here:
http://www.spiritmindbody.co.uk/directory//

______________________________
Love, Light and Peace
Holistic Directory Administration Team
http://www.spiritmindbody.co.uk
listings@spiritmindbody.co.uk



However, the delete email displays the url in full???
Dear Kindred Spirit,

Your link {your_site_url} has been deleted from {dir_link} category, this could be due to a number of things.

Either breach of the Terms and Conditions, a dead link to your site, or not having the required reciprocal link(s) to {own_site} in order to maintain your membership.

To see your link again, please add a link to our site and inform us.

______________________________
Love, Light and Peace
{own_site} Administration Team
{own_url}
{own_email}

Dear Kindred Spirit,

Your link http://www.ipyramidia.net has been deleted from http://www.spiritmindbody.co.uk/directory/art-therapy/ category, this could be due to a number of things.

Either breach of the Terms and Conditions, a dead link to your site, or not having the required reciprocal link(s) to Holistic Directory in order to maintain your membership.

To see your link again, please add a link to our site and inform us.

______________________________
Love, Light and Peace
Holistic Directory Administration Team
http://www.spiritmindbody.co.uk
listings@spiritmindbody.co.uk


Does this help?

Vincent Wright
07-27-2006, 06:30 AM
This definitely helps.

Open classes/DirAdmin.php, find the function editLink(). Within it find this piece:


/** send email in case link email exist and option is enabled **/
if ($aLink['email'] && $aSendmail)
{
$category = $this->getCategoryById($aLink['id_category']);

$this->mMailer->sendMail('link_modify', $aLink, $category);
}


and add the lines in bold below:


/** send email in case link email exist and option is enabled **/
if ($aLink['email'] && $aSendmail)
{
// Get category id first
$query = 'SELECT `id_category` FROM `'.$this->mPrefix.'link_categories` WHERE `id_link` = '.$aLink['id'].' AND `crossed` = \'0\'';
$aLink['id_category'] = (int)$this->mDb->getOne($query);
$category = $this->getCategoryById($aLink['id_category']);

$this->mMailer->sendMail('link_modify', $aLink, $category);
}


This should work.

WTM
07-27-2006, 06:38 AM
This code is near line #1813

(Vince if you want to edit your post and delete mine)

Vincent Wright
07-27-2006, 06:41 AM
No, that's ok.

Loren
07-27-2006, 06:55 AM
Ah...think that's where the problem could be..searched for the code you wanted me to add to with that title

** send email in case link email exist and option is enabled ** but the only coding i could find such as you specified under that title was here:

Start at line 611 classes/dir.php


/**
* Updates link information
*
* @param arr $aLink link info array
* @param bool $aSendmail if true send email
*
* @return bool
*/
function editLink($aLink, $aSendmail = false)
{
$sql = "UPDATE `{$this->mPrefix}links` SET ";

foreach($aLink as $key=>$value)
{
$sql .= "`{$key}` = '{$value}', ";
}

$sql .= " `id` = '{$aLink['id']}' ";

$sql .= "WHERE `id` = '{$aLink['id']}'";

if($aLink['email'] && $aSendmail)
{
$category = $this->getCategoryById($aLink['id_category']);

$this->mMailer->sendMail('link_modify', $aLink, $category);
}

return $this->mDb->query($sql);
}


Do i add it here?

Loren
07-27-2006, 07:01 AM
This code is near line #1813

(Vince if you want to edit your post and delete mine)

Not in mine it isn't.:confused:

Vincent Wright
07-27-2006, 07:02 AM
I'm afraid not.

This file (classes/Dir.php) has editLink() function as well. But this has nothing to do with admin part. And the email we've been discussing is sent when you edit link in Admin Panel.

Probably that's the matter of script versions?

Well, you had better search for "function editLink" in classes/DirAdmin.php.

Vincent Wright
07-27-2006, 07:03 AM
Btw, mine starts on line #1802, not #1813 as mentioned by WTM. Try looking somewhere starting on line #1800.

Loren
07-27-2006, 07:04 AM
I'm afraid not.

This file (classes/Dir.php) has editLink() function as well. But this has nothing to do with admin part. And the email we've been discussing is sent when you edit link in Admin Panel.

Probably that's the matter of script versions?

Well, you had better search for "function editLink" in classes/DirAdmin.php.

As above for me :) do i add that coding then to it?

Loren
07-27-2006, 07:05 AM
Btw, mine starts on line #1802, not #1813 as mentioned by WTM. Try looking somewhere starting on line #1800.

What the hell have you got in between! :huh: Mine is the same as the new pro1.2 version installed..why yours so far down????

Vincent Wright
07-27-2006, 07:06 AM
I don't think adding this code to classes/Dir.php will help. But why not give it a try. Btw, could you email me your version of classes/DirAdmin.php to vwright at esyndicat dot com?

Loren
07-27-2006, 07:15 AM
I don't think adding this code to classes/Dir.php will help. But why not give it a try. Btw, could you email me your version of classes/DirAdmin.php to vwright at esyndicat dot com?

I don't have it any other way Vincent. There is no coding with

if ($aLink['email'] && $aSendmail) in mine that i can find. And i did try to post the file here but doesn't take php, so put it in text and it was too big! Arrggh..so yes i will petal. Winging it's way to you now :)

Vincent Wright
07-27-2006, 10:49 AM
Ah, you sent me Dir.php, but I need DirAdmin.php. Please resend DirAdmin.php to me.

Thanks.

Loren
07-27-2006, 11:06 AM
Ah, you sent me Dir.php, but I need DirAdmin.php. Please resend DirAdmin.php to me.

Thanks.

:ooi: Well that would explain why i couldn't find it! Oh hell i am sorry Vinny, i was in the wrong file..Doh..

Anyway brushing over that very quickly...mine actually started "/** send email in case link email exist and option is enabled **/" on line 1815 ..

Okay well i have applied what you put above and i shall test it out, sorry petal for giving you headache...that will teach me to not to get up at 5.30 am in future! Mind obviously needed a few hours more sleep either that or i left it in the etheric plain!

Vincent Wright
07-27-2006, 11:13 AM
No, problem.

Sometimes I miss obvious things too, so it's ok.

Hope this will resolve the problem with wrong directory url.

Loren
08-04-2006, 08:45 AM
Vinny Help Meeee!

You remember you registered as an editor, well i didn't know this, until you told me, i didn't get notification that a new editor registered...I got another person register sometime to, and i didn't know this either, for some reason although emails are going out to the editor they are not going out to me!!!!

And this worries me because under all that admin notificiation (which is enabled) is one for paypal!

What do i need to check? Or impliment?

Vincent Wright
08-04-2006, 09:08 AM
I consulted with Simon, he said no email is sent when editor registers on the site.

Loren
08-04-2006, 09:16 AM
I consulted with Simon, he said no email is sent when editor registers on the site.
Oh yes you are quite right, that time of the morning again..but i think this needs to be included, you can then keep an eye on who's registering, and you don't always notice as it's way at the bottom.

How could i impliment this?

Vincent Wright
08-04-2006, 09:18 AM
Ok, I will tell Simon to include this in his TODO list.

netizen
08-05-2006, 03:21 PM
This definitely helps.

Open classes/DirAdmin.php, find the function editLink(). Within it find this piece:


/** send email in case link email exist and option is enabled **/
if ($aLink['email'] && $aSendmail)
{
$category = $this->getCategoryById($aLink['id_category']);

$this->mMailer->sendMail('link_modify', $aLink, $category);
}


and add the lines in bold below:


/** send email in case link email exist and option is enabled **/
if ($aLink['email'] && $aSendmail)
{
// Get category id first
$query = 'SELECT `id_category` FROM `'.$this->mPrefix.'link_categories` WHERE `id_link` = '.$aLink['id'].' AND `crossed` = \'0\'';
$aLink['id_category'] = (int)$this->mDb->getOne($query);
$category = $this->getCategoryById($aLink['id_category']);

$this->mMailer->sendMail('link_modify', $aLink, $category);
}


This should work.

NOT working for me and still I get email with category field empty as described in my earlier bug report.


............
............
Rank: 8
Status: active
You can view your link here:
http://mysite.com/links// (http://mysite.com/links//)


Vincent, Please check this feature in your test directory and find out where is the problems. Thank you.

Vincent Wright
08-06-2006, 09:33 AM
Please email me your ftp credentials so that I can take a look at it.

netizen
08-06-2006, 01:53 PM
Please email me your ftp credentials so that I can take a look at it.

Hi Vincent,

I have check the modified code again and found that I have wrongly placed the modified 3 lines inside addLink() function. I have corrected these errors today and put the code inside editLink() function. Now it is working fine. I am very sorry for posting a non-working message in the forum.

Vincent Wright
08-06-2006, 05:41 PM
It's ok. We all do miss things sometimes.