Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32

Thread: Admin Approve Edited Ads

  1. #1
    Thread Starter
    Veteran hugo's Avatar
    Join Date
    Aug 2010
    Location
    United Kingdom
    Posts
    310
    Thanks
    13
    Thanked 80 Times in 54 Posts

    Admin Approve Edited Ads

    Seems to be a popular request among folks, so here it is (tested)

    You will need to open up files:

    includes/theme-emails.php
    and
    includes/theme-functions.php

    Firstly in theme/email.php right at the bottom above the closing ?> tag add this:

    PHP Code:
       // send EDITED ad notification email to admin
    function cp_edited_ad_email($post_id) {

        
    // get the post values
        
    $the_ad get_post($post_id);
        
    $category appthemes_get_custom_taxonomy($post_id'ad_cat''name');

        
    $ad_title stripslashes($the_ad->post_title);
        
    $ad_cat stripslashes($category);
        
    $ad_author stripslashes(get_the_author_meta('user_login'$the_ad->post_author));
        
    $ad_slug stripslashes($the_ad->guid);
        
    //$ad_content = appthemes_filter(stripslashes($the_ad->post_content));
        
    $adminurl get_option('siteurl').'/wp-admin/post.php?action=edit&post='.$post_id;

        
    $mailto get_option('admin_email');
        
    // $mailto = 'tester@127.0.0.1'; // USED FOR TESTING
        
    $subject __('Edited Ad Awaiting Moderation','appthemes');
        
    $headers 'From: '__('ClassiPress Admin''appthemes') .' <'get_option('admin_email') .'>' "\r\n";

        
    // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        
    $blogname wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

        
    $message  __('Dear Admin,''appthemes') . "\r\n\r\n";
        
    $message .= sprintf(__('The following ad listing has just been edited on your %s website.''appthemes'), $blogname) . "\r\n\r\n";
        
    $message .= __('Ad Details''appthemes') . "\r\n";
        
    $message .= __('-----------------') . "\r\n";
        
    $message .= __('Title: ''appthemes') . $ad_title "\r\n";
        
    $message .= __('Category: ''appthemes') . $ad_cat "\r\n";
        
    $message .= __('Author: ''appthemes') . $ad_author "\r\n";
        
    //$message .= __('Description: ', 'appthemes') . $ad_content . "\r\n";
        
    $message .= __('-----------------') . "\r\n\r\n";
        
    $message .= __('Preview Ad: ''appthemes') . $ad_slug "\r\n";
        
    $message .= sprintf(__('Edit Ad: %s''appthemes'), $adminurl) . "\r\n\r\n\r\n";
        
    $message .= __('Regards,''appthemes') . "\r\n\r\n";
        
    $message .= __('ClassiPress''appthemes') . "\r\n\r\n";

        
    // ok let's send the email
        
    wp_mail($mailto$subject$message$headers);

    }

    // send EDITED ad MODERATION email to ad owner
    function cp_owner_edited_ad_email($post_id) {

        
    // get the post values
        
    $the_ad get_post($post_id);
        
    $category appthemes_get_custom_taxonomy($post_id'ad_cat''name');

        
    $ad_title stripslashes($the_ad->post_title);
        
    $ad_cat stripslashes($category);
        
    $ad_author stripslashes(get_the_author_meta('user_login'$the_ad->post_author));
        
    $ad_author_email stripslashes(get_the_author_meta('user_email'$the_ad->post_author));
        
    $ad_status stripslashes($the_ad->post_status);
        
    //$ad_content = appthemes_filter(stripslashes($the_ad->post_content));
        
    $siteurl trailingsla****(get_option('home'));

        
    $dashurl trailingsla****(CP_DASHBOARD_URL);

        
    // The blogname option is escaped with esc_html on the way into the database in sanitize_option
        // we want to reverse this for the plain text arena of emails.
        
    $blogname wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

        
    $mailto $ad_author_email;
        
    //$mailto = 'tester@127.0.0.1'; // USED FOR TESTING

        
    $subject sprintf(__('Your Ad Submission on %s','appthemes'), $blogname);
        
    $headers 'From: 'sprintf(__('%s Admin''appthemes'), $blogname) .' <'get_option('admin_email') .'>' "\r\n";

        
    $message  sprintf(__('Hi %s,''appthemes'), $ad_author) . "\r\n\r\n";
        
    $message .= sprintf(__('Your update listing is being processed and is now held in pending status until reviewed by site admin.''appthemes'), $blogname) . "\r\n\r\n";
        
    $message .= __('Ad Details''appthemes') . "\r\n";
        
    $message .= __('-----------------') . "\r\n";
        
    $message .= __('Title: ''appthemes') . $ad_title "\r\n";
        
    $message .= __('Category: ''appthemes') . $ad_cat "\r\n";
        
    $message .= __('Status: ''appthemes') . $ad_status "\r\n";
        
    //$message .= __('Description: ', 'appthemes') . $ad_content . "\r\n";
        
    $message .= __('-----------------') . "\r\n\r\n";
        
    $message .= __('You may check the status of your ad(s) at anytime by logging into your dashboard.''appthemes') . "\r\n";
        
    $message .= $dashurl "\r\n\r\n\r\n\r\n";
        
    $message .= __('Regards,''appthemes') . "\r\n\r\n";
        
    $message .= sprintf(__('Your %s Team''appthemes'), $blogname) . "\r\n";
        
    $message .= $siteurl "\r\n\r\n\r\n\r\n";

        
    // ok let's send the email
        
    wp_mail($mailto$subject$message$headers);


    ok with that done you can close that file,

    now in theme-functions.php around line 1100 you will see this block of code:

    PHP Code:
    // put all the ad elements into an array 
        // these are the minimum required fields for WP (except tags)
        
    $update_ad                      = array();
        
    $update_ad['ID']                = trim($_POST['ad_id']);
        
    $update_ad['post_title']        = appthemes_filter($_POST['post_title']);
        
    $update_ad['post_content']      = trim($post_content); 
        
    $update_ad['tags_input']        = $new_tags// array 
    replace it with this:

    PHP Code:
    // put all the ad elements into an array
        
        
    if(current_user_can'contributor' )) { 
        
    // these are the minimum required fields for WP (except tags)
        
    $update_ad                      = array();
        
    $update_ad['ID']                = trim($_POST['ad_id']);
        
    $update_ad['post_title']        = appthemes_filter($_POST['post_title']);
        
    $update_ad['post_content']      = trim($post_content);
        
    $update_ad['post_status']       = ( 'pending' );
        
    $update_ad['tags_input']        = $new_tags// array 
        //$update_ad['post_category']   = array((int)appthemes_filter($_POST['cat'])); // maybe use later if we decide to let users change categories
        
    } else {
        
    $update_ad                      = array();
        
    $update_ad['ID']                = trim($_POST['ad_id']);
        
    $update_ad['post_title']        = appthemes_filter($_POST['post_title']);
        
    $update_ad['post_content']      = trim($post_content);
        
    $update_ad['tags_input']        = $new_tags// array    
        

    what we have done here is basicaly said if the user isnt admin then send his edited post into pending status.

    Now around line 1138 or thereabouts look for this:

    PHP Code:
    $errmsg '<div class="box-yellow"><b>' __('Your ad has been successfully updated.','appthemes') . '</b> <a href="' CP_DASHBOARD_URL '">' __('Return to my dashboard','appthemes') . '</a></div>'
    repalce that with this:

    PHP Code:
    $errmsg '<div class="box-yellow"><b>' __('Your ad has been updated and is held for manual review.','appthemes') . '</b> <a href="' CP_DASHBOARD_URL '">' __('Return to my dashboard','appthemes') . '</a></div>';
            
            
    cp_owner_edited_ad_email($post_id);
            
    cp_edited_ad_email($post_id); 
    Done!

    remember back up your files first
    Last edited by hugo; April 25th, 2011 at 07:56 AM. Reason: changed title
    My Classipress Suggestion: http://ideas.appthemes.com/forums/84...ents?ref=title vote if you like!

  2. The Following 6 Users Say Thank You to hugo For This Useful Post:

    eaport (May 8th, 2012), echo08 (August 3rd, 2013), Fanatic (January 10th, 2013), kate_b (April 25th, 2011), philip937 (January 26th, 2012), rubencio (January 20th, 2013)

  3. #2
    Thread Starter
    Veteran hugo's Avatar
    Join Date
    Aug 2010
    Location
    United Kingdom
    Posts
    310
    Thanks
    13
    Thanked 80 Times in 54 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    My Classipress Suggestion: http://ideas.appthemes.com/forums/84...ents?ref=title vote if you like!

  4. #3
    Amateur kate_b's Avatar
    Join Date
    Mar 2011
    Posts
    17
    Thanks
    4
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #4
    Thread Starter
    Veteran hugo's Avatar
    Join Date
    Aug 2010
    Location
    United Kingdom
    Posts
    310
    Thanks
    13
    Thanked 80 Times in 54 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    My Classipress Suggestion: http://ideas.appthemes.com/forums/84...ents?ref=title vote if you like!

  6. The Following User Says Thank You to hugo For This Useful Post:

    kate_b (April 25th, 2011)

  7. #5
    Amateur kate_b's Avatar
    Join Date
    Mar 2011
    Posts
    17
    Thanks
    4
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. #6
    Amateur kate_b's Avatar
    Join Date
    Mar 2011
    Posts
    17
    Thanks
    4
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #7
    Thread Starter
    Veteran hugo's Avatar
    Join Date
    Aug 2010
    Location
    United Kingdom
    Posts
    310
    Thanks
    13
    Thanked 80 Times in 54 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    My Classipress Suggestion: http://ideas.appthemes.com/forums/84...ents?ref=title vote if you like!

  10. #8
    Amateur kate_b's Avatar
    Join Date
    Mar 2011
    Posts
    17
    Thanks
    4
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  11. #9
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    41,006
    Thanks
    170
    Thanked 3,409 Times in 3,280 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

  12. #10
    lausha's Avatar
    Join Date
    Dec 2010
    Location
    United Kingdom
    Posts
    422
    Thanks
    62
    Thanked 11 Times in 11 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Page 1 of 4 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Notification of edited ads
    By lausha in forum ClassiPress General Discussion
    Replies: 7
    Last Post: March 9th, 2011, 01:51 PM
  2. How do I approve a listing change?
    By rmalt in forum Report JobRoller Bugs
    Replies: 2
    Last Post: February 12th, 2011, 05:10 AM
  3. What am I missing? How do I approve an ad?
    By smith2010 in forum Help Using ClassiPress
    Replies: 9
    Last Post: June 28th, 2010, 09:36 PM
  4. Approve all ads regardless payment status
    By knientje in forum ClassiPress General Discussion
    Replies: 3
    Last Post: June 21st, 2010, 08:10 PM