Plugin Directory

Changeset 1511112


Ignore:
Timestamp:
10/09/2016 01:30:04 PM (8 years ago)
Author:
Stefan M.
Message:

small requested addon

Location:
custom-tables/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • custom-tables/trunk/custom-tables.php

    r1509473 r1511112  
    445445        function smarttag_form($atts) {
    446446            global $wpdb;
    447             extract(shortcode_atts(array('id' => '', 'limit' => '50', 'def' => false), $atts));
     447            extract(shortcode_atts(array('id' => '', 'limit' => '50', 'def' => false, 'url' => ''), $atts));
    448448
    449449            if ($this->prem_chk() !== true) { $out = __('Premium functionality has not been activated in the plugin. Please check for a valid licence!', 'wct'); }
  • custom-tables/trunk/pages/show_form.php

    r1509473 r1511112  
    2121    if ($form->r_filter != '') { $filter = "AND ".sqldatefilter(stripslashes($form->r_filter)); } else { $filter = ''; }
    2222    if ($form->toapprove == '1') {
     23        $wpdb->get_row("UPDATE `".$wpdb->prefix."wct".$form->r_table."` SET `status`='passive' WHERE `status` != 'passive' AND `id`='".mres($_GET['wctdfid'])."' ".$filter." LIMIT 1;");
    2324        do_action('wct_formupdate', array('id' => $_GET['wctdfid'], 'action' => 'update'));
    24         $wpdb->get_row("UPDATE `".$wpdb->prefix."wct".$form->r_table."` SET `status`='passive' WHERE `status` != 'passive' AND `id`='".mres($_GET['wctdfid'])."' ".$filter." LIMIT 1;");
    2525    }
    2626    else {
     27        $wpdb->get_row("DELETE FROM `".$wpdb->prefix."wct".$form->r_table."` WHERE `status` != 'passive' AND `id`='".mres($_GET['wctdfid'])."' ".$filter." LIMIT 1;");
    2728        do_action('wct_formupdate', array('id' => $_GET['wctdfid'], 'action' => 'delete'));
    28         $wpdb->get_row("DELETE FROM `".$wpdb->prefix."wct".$form->r_table."` WHERE `status` != 'passive' AND `id`='".mres($_GET['wctdfid'])."' ".$filter." LIMIT 1;");
    2929    }
    3030    if ($form->smail == '1') {
     
    3232    }
    3333    $_GET['wctdfid'] = '';
     34    if ($url != '') { wp_redirect( $url ); exit; }
    3435}
    3536elseif ($_GET['wctefid'] == 'save') {
     
    8081            if ($_GET['wct'.$tmpvar.'fid'] == '' AND $form->rights[2] == '1') {
    8182                if ($form->smail == '1') {
    82                     do_action('wct_formupdate', array('id' => $_GET['wctdfid'], 'action' => 'new'));
    8383                    $wpdb->get_row("INSERT INTO `".$wpdb->prefix."wct".$form->r_table."` SET ".$sqlstring.", `status`='".($form->toapprove != '1' ? 'active' : 'draft')."';");
    8484                    $tableid = $wpdb->insert_id;
     
    8686                }
    8787                else {
    88                     do_action('wct_formupdate', array('id' => $_GET['wctdfid'], 'action' => 'new'));
    8988                    $wpdb->get_row("INSERT INTO `".$wpdb->prefix."wct".$form->r_table."` SET ".$sqlstring.", `status`='active';");
    9089                }
     90                do_action('wct_formupdate', array('id' => $_GET['wctdfid'], 'action' => 'new'));
     91                if ($url != '') { wp_redirect( $url ); exit; }
    9192            }
    9293            elseif ($_GET['wct'.$tmpvar.'fid'] != '' AND $form->rights[1] == '1') {
    9394                if ($form->smail == '1') {
    94                     do_action('wct_formupdate', array('id' => $_GET['wctdfid'], 'action' => 'update'));
    9595                    $wpdb->get_row("UPDATE `".$wpdb->prefix."wct".$form->r_table."` SET ".$sqlstring.",`status`='".($form->toapprove != '1' ? 'active' : 'draft')."' WHERE `status`!='passive' AND `id`='".mres($_GET['wct'.$tmpvar.'fid'])."' LIMIT 1;");
    9696                    $createid = $wpdb->insert_id;
    9797                    if ($createid != '0') { wp_mail(get_option( 'admin_email' ), "Custom Forms - ".__('Entry was updated','wct'),"Please check the if the Entry can be published (located in draft Section).\r\n\r\nLink ".admin_url('admin.php?page=wct_table_'.$form->r_table.'&wcttab=content&wcttab2=draft&action=edit&wcts=0&rid='.$createid)); }
     98                    do_action('wct_formupdate', array('id' => $_GET['wctdfid'], 'action' => 'new'));
    9899                }
    99100                else {
     101                   
     102                    $wpdb->get_row("UPDATE `".$wpdb->prefix."wct".$form->r_table."` SET ".$sqlstring." WHERE `status`!='passive' AND `id`='".mres($_GET['wct'.$tmpvar.'fid'])."' LIMIT 1;");
    100103                    do_action('wct_formupdate', array('id' => $_GET['wctdfid'], 'action' => 'update'));
    101                     $wpdb->get_row("UPDATE `".$wpdb->prefix."wct".$form->r_table."` SET ".$sqlstring." WHERE `status`!='passive' AND `id`='".mres($_GET['wct'.$tmpvar.'fid'])."' LIMIT 1;");
    102                 }
     104                }
     105                if ($url != '') { wp_redirect( $url ); exit; }
    103106            }
    104107        }
Note: See TracChangeset for help on using the changeset viewer.