Thread: Post Admin name

Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16
  1. #11
    Join Date
    Jul 2004
    Posts
    167
    Plugin Contributions
    0

    Default Re: Post Admin name

    Sorry brains a bit adled from the sun today!! I meant '$from'. This is what I changed the code to with no avail:

    $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . "
    (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent)
    values ('" . $insert_id ."', '0', '".$from."',
    '" . $mail['customers_email_address'] . "', now() )");

    I wonder what variable it is that holds the logged in admin users name?

  2. #12
    Join Date
    Mar 2004
    Posts
    16,042
    Plugin Contributions
    5

    Default Re: Post Admin name

    try this,
    not tested

    Code:
    $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . "
    (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent)
    values ('" . $insert_id ."', '0', '".$from."',
    '" . $mail->fields['customers_email_address'] . "', now() )");

  3. #13
    Join Date
    Jul 2004
    Posts
    167
    Plugin Contributions
    0

    Default Re: Post Admin name

    Hi Merlin

    Thanks but I had already tried that suggestion earlier. is $from the only variable that holds the elusive admin users id?

  4. #14
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Post Admin name

    How rude - I wasn't notified by email for these last two notes.

    Anyway. Here's a modification I just coded while you were waiting (untested - so make a backup of the file first).

    On that same file,

    find:


    $id1 = create_coupon_code($mail->fields['customers_email_address']);
    $insert_query = $db->Execute("insert into " . TABLE_COUPONS . "
    (coupon_code, coupon_type, coupon_amount, date_created)
    values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())");

    $insert_id = $db->Insert_ID();

    $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . "
    (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent)
    values ('" . $insert_id ."', '0', 'Admin',
    '" . $mail->fields['customers_email_address'] . "', now() )");
    replace with:

    Code:
    $id1 = create_coupon_code($mail->fields['customers_email_address']);
          $insert_query = $db->Execute("insert into " . TABLE_COUPONS . "
                                        (coupon_code, coupon_type, coupon_amount, date_created)
                                        values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())");
    
          $insert_id = $db->Insert_ID();
    
          $mail_from = $db->Execute("select admin_name FROM ".TABLE_ADMIN." where admin_id = '".(int)$_SESSION['admin_id']."'");
    
          while (!$mail_from->EOF) {
          $sent_from = trim($mail_from->fields['admin_name']);
    
          $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . "
                        (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent)
                        values ('" . $insert_id ."', '0', '".$sent_from."',
                                '" . $mail->fields['customers_email_address'] . "', now() )");
          }
    Then, a couple of lines below,

    find:


    $insert_query = $db->Execute("insert into " . TABLE_COUPONS . "
    (coupon_code, coupon_type, coupon_amount, date_created)
    values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())");

    $insert_id = $db->Insert_id();

    $insert_query = $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . "
    (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent)
    values ('" . $insert_id ."', '0', 'Admin',
    '" . $_POST['email_to'] . "', now() )");

    }
    replace with:

    Code:
    $mail_from = $db->Execute("select admin_name FROM ".TABLE_ADMIN." where admin_id = '".(int)$_SESSION['admin_id']."'");
    
          while (!$mail_from->EOF) {
          $sent_from = trim($mail_from->fields['admin_name']);
    
          $insert_query = $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . "
                                        (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent)
                                        values ('" . $insert_id ."', '0', '".$sent_from."',
                                                '" . $_POST['email_to'] . "', now() )");
          }
    
        }
    Recall: Make a backup of the file, first, before you proceed.

  5. #15
    Join Date
    Jul 2004
    Posts
    167
    Plugin Contributions
    0

    Default Re: Post Admin name

    You've cracked it :) Thanks alot to both you and Merlin for your precious time on this

  6. #16
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Post Admin name

    Excellent. Thanks for updating, Glad to see it worked out well for you.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v150 change main host folder name and admin folder name after install?
    By Johnnycopilot in forum Installing on a Linux/Unix Server
    Replies: 1
    Last Post: 27 Aug 2012, 08:25 PM
  2. HEADING_TITLE as the post title, not the category name
    By woolexs in forum Basic Configuration
    Replies: 3
    Last Post: 6 May 2009, 11:24 AM
  3. field name for post amount ?
    By fulltilt in forum General Questions
    Replies: 0
    Last Post: 14 Feb 2009, 01:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR