Plugin Directory

Changeset 995441


Ignore:
Timestamp:
09/23/2014 02:57:01 PM (12 years ago)
Author:
colinph970
Message:

updated files to fix saving buttons problem.

Location:
button-maker/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • button-maker/trunk/buttons.php

    r995372 r995441  
    66Author: Pluginhandy
    77Author URI: http://pluginhandy.com/
    8 Version: 1.0.0
     8Version: 1.1
    99Text Domain:
    1010License: GPL version 2 or later -
     
    2525$comp_table_prefix=$wpdb->prefix;
    2626define('PROF_TABLE_PREFIX', $comp_table_prefix);
     27$btntable = PROF_TABLE_PREFIX."custom_btns";
    2728
    2829function demo_install()
     
    6465add_action('wp_ajax_map_post_type_show','map_post_type_show');
    6566function map_post_type_show() {
     67    $btntable = PROF_TABLE_PREFIX."custom_btns";
    6668    if(isset($_POST['btn_id'])) {
    6769        global $wpdb;
     70       
    6871        //echo "<pre>";print_r($_POST);die();
    6972        $id = $_POST['btn_id'];
    7073        /* update clicks */
    71         $wpdb->query("UPDATE `wp_custom_btns` set clicks=(clicks+1) where id=$id");
     74        $wpdb->query("UPDATE `$btntable` set clicks=(clicks+1) where id=$id");
    7275       
    73         $getbtn = $wpdb->get_results("Select * from `wp_custom_btns` where id=$id");
     76        $getbtn = $wpdb->get_results("Select * from `$btntable` where id=$id");
    7477        if($getbtn != NULL) {
    7578            $url = $getbtn[0]->url;
     
    9194        foreach($getbtns as $btnid) {
    9295            /* update impressions */
    93             $wpdb->query("UPDATE `wp_custom_btns` set impressions=(impressions+1) where id=$btnid");
     96            $wpdb->query("UPDATE `$btntable` set impressions=(impressions+1) where id=$btnid");
    9497        }
    9598       
     
    155158
    156159if(isset($_POST['save_btn'])) {
    157     //echo "<pre>";print_r($_POST);exit;
     160    //$tables = $wpdb->get_results("Select * from `$btntable`");
     161    //echo "<pre>";print_r($tables);print_r($_POST);exit;
    158162    $text = $_POST['btn_text'];
    159163    $size = $_POST['font_size'];
     
    167171    $html = trim($_POST['btn_html']);
    168172    $current_time = time();
    169     $wpdb->query("INSERT INTO `wp_custom_btns`(`text`, `size`, `color`, `height`, `width`, `background`, `hover`, `shape`, `url`, `clicks`, `impressions`, `html`, `created_at`) VALUES('$text','$size','$color','$height','$width','$backcolor','$hovercolor','$shape','$url','0','0','$html','$current_time')");
     173    $wpdb->query("INSERT INTO `$btntable`(`text`, `size`, `color`, `height`, `width`, `background`, `hover`, `shape`, `url`, `clicks`, `impressions`, `html`, `created_at`) VALUES('$text','$size','$color','$height','$width','$backcolor','$hovercolor','$shape','$url','0','0','$html','$current_time')");
    170174    $nextpage = site_url().'/wp-admin/admin.php?page=button-maker/buttons.php';
    171175    echo "<script type='text/javascript'>document.location.href='$nextpage';</script>";
     
    186190    $url = $_POST['url'];
    187191    $html = trim($_POST['btn_html']);
    188     $wpdb->query("UPDATE `wp_custom_btns` set text='$text',size='$size',color='$color',height='$height',width='$width',background='$backcolor',hover='$hovercolor',url='$url',shape='$shape',html='$html' where id=$id");
     192    $wpdb->query("UPDATE `$btntable` set text='$text',size='$size',color='$color',height='$height',width='$width',background='$backcolor',hover='$hovercolor',url='$url',shape='$shape',html='$html' where id=$id");
    189193    $nextpage = site_url().'/wp-admin/admin.php?page=button-maker/buttons.php';
    190194    echo "<script type='text/javascript'>document.location.href='$nextpage';</script>";
     
    212216    $isshow = $_POST['is_show'];
    213217    $order = $_POST['order'];
    214     $wpdb->query("UPDATE `wp_custom_btns` SET `show` = '0' WHERE `show` =1;");
     218    $wpdb->query("UPDATE `$btntable` SET `show` = '0' WHERE `show` =1;");
    215219    foreach($isshow as $show) {
    216         $wpdb->query("UPDATE `wp_custom_btns` SET `show` = '1' WHERE `id` =$show;");
     220        $wpdb->query("UPDATE `$btntable` SET `show` = '1' WHERE `id` =$show;");
    217221    }
    218222    if($order != NULL) {
    219223        foreach($order as $key=>$value) {
    220             $wpdb->query("UPDATE `wp_custom_btns` SET `order` = '$value' WHERE `id` =$key;");
     224            $wpdb->query("UPDATE `$btntable` SET `order` = '$value' WHERE `id` =$key;");
    221225        }
    222226    }
     
    234238   
    235239    global $wpdb;
    236    
     240    $btntable = PROF_TABLE_PREFIX."custom_btns";
    237241    /* get all custom buttons */
    238     $getbtns = $wpdb->get_results("Select * from `wp_custom_btns` WHERE `show`=1 order by `order` asc");
     242    $getbtns = $wpdb->get_results("Select * from `$btntable` WHERE `show`=1 order by `order` asc");
    239243    if($getbtns != NULL) {
    240244        $btns = array();
     
    273277
    274278            global $wpdb;
    275 
     279            $btntable = PROF_TABLE_PREFIX."custom_btns";
    276280            /* get all custom buttons */
    277             $getbtns = $wpdb->get_results("Select * from `wp_custom_btns` WHERE `show`=1 order by created_at asc");
     281            $getbtns = $wpdb->get_results("Select * from `$btntable` WHERE `show`=1 order by created_at asc");
    278282            if($getbtns != NULL) {
    279283                $btns = '';
  • button-maker/trunk/data_show.php

    r995372 r995441  
    2828</script>
    2929<?php global $wpdb;
     30$btntable = PROF_TABLE_PREFIX."custom_btns";
    3031if(isset($_GET['editid']) && $_GET['editid'] != NULL) {
    3132    include 'edit_btn.php';
     
    3334   
    3435    $id = $_GET['delid'];
    35     $query = "Delete from wp_custom_btns where id=$id";
     36    $query = "Delete from $btntable where id=$id";
    3637    $wpdb->query($query);
    3738    $nextpage = site_url().'/wp-admin/admin.php?page=button-maker/buttons.php';
     
    4243   
    4344    $id = $_GET['clearid'];
    44     $query = "Update wp_custom_btns set clicks=0,impressions=0 where id=$id";
     45    $query = "Update $btntable set clicks=0,impressions=0 where id=$id";
    4546    $wpdb->query($query);
    4647    $nextpage = site_url().'/wp-admin/admin.php?page=button-maker/buttons.php';
     
    4950   
    5051} else {
    51     $buttons = $wpdb->get_results("Select * from `wp_custom_btns` order by id desc");
     52    $buttons = $wpdb->get_results("Select * from `$btntable` order by id desc");
    5253    //echo "<pre>";print_r($buttons);exit; ?>
    5354    <div class="show_btns">
  • button-maker/trunk/edit_btn.php

    r995372 r995441  
    4545<?php global $wpdb;
    4646$id = $_GET['editid'];
    47 $getbtn = $wpdb->get_results("Select * from `wp_custom_btns` where id=$id");
     47$getbtn = $wpdb->get_results("Select * from `$btntable` where id=$id");
    4848$shape = $getbtn[0]->shape;
    4949//echo "<pre>";print_r($getbtn);exit; ?>
  • button-maker/trunk/readme.txt

    r995372 r995441  
    131131
    132132Issue 1: No changes
    133 Issue 1.1 resolved issue with permissions for saving buttons
    134133
    135134
    136135== Upgrade Notice ==
    137136
    138 Please note that an updated version now exists. This fixes the issues with saving buttons due to permission errors.
     137No upgrades to date
Note: See TracChangeset for help on using the changeset viewer.