Advertisement:

Author Topic: [SOLVED]send mail to user after admin approval of listing  (Read 1637 times)

sravani

  • Newbie
  • *
  • Posts: 15
[SOLVED]send mail to user after admin approval of listing
« on: August 26, 2016, 12:31:19 pm »
Hi,

I have enabled admin approval for all the listings in my website.
When a listing is posted by user, admin gets a validation mail and after validation is done,
I would like to send "your listing is approved by admin" mail to user.

Can someone help me to add this.
Tried to check if there are any earlier solutions for this. But couldn't get any.
« Last Edit: August 26, 2016, 11:12:16 pm by sravani »


sravani

  • Newbie
  • *
  • Posts: 15
Re: send mail to user after admin approval of listing
« Reply #2 on: August 26, 2016, 02:53:45 pm »
Hi teseo,

Thanks for the reply.

I did add the piece of code at the end of functions.php of my theme
(using mcfly theme) and edited email_new_item_non_register_user template.

But not receiving mail after admin validation.

Just to be sure, I have done the following work around
http://forums.osclass.org/general-help/item-validation-via-email-by-administrator-(not-user)/msg89675/#msg89675

Only logged in users can post listings
User gets wait for admin approval mail
admin gets validation mail when a new listing is added

attached functions.php
« Last Edit: August 26, 2016, 03:51:30 pm by sravani »

sravani

  • Newbie
  • *
  • Posts: 15
Re: send mail to user after admin approval of listing
« Reply #3 on: August 26, 2016, 05:37:12 pm »
Installed more edit plugin.

Now user gets 'approved' mail after admins approval.
But there are some issues.
1. Ad is BLOCKED before admins approval. Can't we keep it in INACTIVE state? (like when new listing is published on normal osclass without more edit plugin)

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: send mail to user after admin approval of listing
« Reply #4 on: August 26, 2016, 08:45:32 pm »
For that you need to modify two identical lines on moreedit/index.php:

Code: [Select]
Item::newInstance()->update(array('b_enabled' => 0), array('pk_i_id' => $item_id));
to:

Code: [Select]
Item::newInstance()->update(array('b_active => 0), array('pk_i_id' => $item_id));
Regards

sravani

  • Newbie
  • *
  • Posts: 15
Re: send mail to user after admin approval of listing
« Reply #5 on: August 26, 2016, 10:25:57 pm »
Hi Teseo,

I did try changing b_enabled to b_active.
In that case, user is not getting email saying "admin approved"

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: send mail to user after admin approval of listing
« Reply #6 on: August 26, 2016, 10:50:00 pm »
This is like a snowball: you change b_enabled by b_active and you need to change everything related as well.

In this function:

Code: [Select]
function cust_approved_item_mail($id) {

    $eItem = Item::newInstance()->findByPrimaryKey($id);
    View::newInstance()->_exportVariableToView('item', $eItem);

    fn_email_new_item_non_register_user($eItem);
}

osc_add_hook('enable_item', 'cust_approved_item_mail');

You need to change the hook:

Code: [Select]
osc_add_hook('activate_item', 'cust_approved_item_mail');
Regards

sravani

  • Newbie
  • *
  • Posts: 15
Re: send mail to user after admin approval of listing
« Reply #7 on: August 26, 2016, 11:01:03 pm »
Thanks for taking time to explain.
It is working as expected.

Thank you so much Teseo

I have one more issue. Wondering if you could help.
http://forums.osclass.org/plugins-20/contact-counter-not-updating-views/

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: send mail to user after admin approval of listing
« Reply #8 on: August 26, 2016, 11:10:20 pm »
You're welcome :) Please add [SOLVED] to the title of this thread.

Sorry, I don't know that Contact plugin.

Regards

sravani

  • Newbie
  • *
  • Posts: 15
Re: send mail to user after admin approval of listing
« Reply #9 on: August 26, 2016, 11:11:18 pm »
Anyway Thanks