Plugin Directory

Changeset 1992038


Ignore:
Timestamp:
12/11/2018 05:51:12 PM (7 years ago)
Author:
jgwhite33
Message:

added edit avatar function

Location:
wp-google-places-review-slider
Files:
73 added
6 edited

Legend:

Unmodified
Added
Removed
  • wp-google-places-review-slider/tags/4.9/admin/class-wp-google-reviews-admin.php

    r1966529 r1992038  
    187187                //admin js
    188188                wp_enqueue_script('review_list_page-js', plugin_dir_url( __FILE__ ) . 'js/review_list_page.js', array( 'jquery' ), $this->version, false );
     189               
     190                wp_enqueue_script('thickbox');
     191                wp_enqueue_style('thickbox');
     192         
     193                wp_enqueue_script('media-upload');
     194                wp_enqueue_script('wptuts-upload');
    189195            }
    190196           
     
    203209                //enque alpha color add-on wprevpro-wp-color-picker-alpha.js
    204210                wp_enqueue_script( 'wp-color-picker-alpha', plugin_dir_url( __FILE__ ) . 'js/wprevpro-wp-color-picker-alpha.js', array( 'wp-color-picker' ), '2.1.2', false );
     211               
    205212            }
    206213        }
  • wp-google-places-review-slider/tags/4.9/admin/css/wprev_admin.css

    r1966529 r1992038  
    113113}
    114114/*---------------review list page-------------*/
     115.editrev {
     116    cursor: pointer;
     117}
    115118.wpfbr_margin10 {
    116119    margin-top: 10px;
  • wp-google-places-review-slider/tags/4.9/admin/js/review_list_page.js

    r1966529 r1992038  
    4242        });
    4343       
     44        $( "#wprevpro_addnewreview_cancel" ).click(function() {
     45          jQuery("#wprevpro_new_review").hide("slow");
     46          //reload page without taction and tid
     47          //setTimeout(function(){
     48            //window.location.href = "?page=wp_pro-reviews";
     49          //}, 500);
     50         
     51        });
     52       
    4453        //remove all button
    4554        $( "#wpfbr_removeallbtn" ).click(function() {
     
    5160          openpopup("Upgrade Needed", '<p>Please upgrade to the Pro Version of this Plugin to access this feature.</p>', '<a class="button dashicons-before  dashicons-cart" href="?page=wp_google-get_pro">Upgrade Here</a>');
    5261        });     
     62       
     63        //upload avatar button----------------------------------
     64        $('#upload_avatar_button').click(function() {
     65            tb_show('Upload Reviewer Avatar', 'media-upload.php?referer=wp_pro-reviews&type=image&TB_iframe=true&post_id=0', false);
     66            return false;
     67        });
     68        window.send_to_editor = function(html) {
     69            var image_url = jQuery("<div>" + html + "</div>").find('img').attr('src');
     70            //var image_url = $('img',html).attr('src');
     71            $('#wprevpro_nr_avatar_url').val(image_url);
     72            $("#avatar_preview").attr("src",image_url);
     73            tb_remove();
     74        }
     75        //for adding default avater url to input rlimg
     76        $( ".rlimg" ).click(function() {
     77            var tempsrc = $(this).attr('src');
     78            $("#wprevpro_nr_avatar_url").val(tempsrc);
     79            $("#wprevpro_nr_avatar_url").select();
     80            $("#avatar_preview").attr("src",tempsrc);
     81        });
    5382
    5483        //launch pop-up windows code--------
  • wp-google-places-review-slider/tags/4.9/admin/partials/review_list.php

    r1966529 r1992038  
    2222$table_name = $wpdb->prefix . 'wpfb_reviews';
    2323$rowsperpage = 20;
     24
     25    $dbmsg = "";
     26    $html="";
     27    $currentreview= new stdClass();
     28    $currentreview->id="";
     29    $currentreview->rating="";
     30    $currentreview->review_title="";
     31    $currentreview->review_text="";
     32    $currentreview->reviewer_name="";
     33    $currentreview->reviewer_id="";
     34    $currentreview->company_name="";
     35    $currentreview->created_time="";
     36    $currentreview->created_time_stamp="";
     37    $currentreview->userpic="";
     38    $currentreview->review_length="";
     39    $currentreview->type="";
     40    $currentreview->from_name="";
     41    $currentreview->from_url="";
     42    $currentreview->from_logo="";
     43    $currentreview->consent="";
     44    $currentreview->hidestars="";
     45   
     46        //form updating here---------------------------
     47    if(isset($_GET['editrev'])){
     48        $rid = htmlentities($_GET['editrev']);
     49        //for updating
     50        if($rid > 0){
     51            //get form array
     52            $currentreview = $wpdb->get_row( "SELECT * FROM ".$table_name." WHERE id = ".$rid );
     53        }
     54       
     55    }
     56    //------------------------------------------
     57   
     58        //form posting here--------------------------------
     59    //if template id present then update database if not then insert as new.
     60    if (isset($_POST['wprevpro_submitreviewbtn'])){
     61        //verify nonce wp_nonce_field( 'wprevpro_save_review');
     62        check_admin_referer( 'wprevpro_save_review');
     63       
     64        //get form submission values and then save or update
     65        $r_id = sanitize_text_field($_POST['editrid']);
     66        //$rating = sanitize_text_field($_POST['wprevpro_nr_rating']);
     67        //$text = sanitize_textarea_field($_POST['wprevpro_nr_text']);
     68        //$name = sanitize_text_field($_POST['wprevpro_nr_name']);
     69        $avatar_url = esc_url_raw($_POST['wprevpro_nr_avatar_url']);
     70        //$rdate = sanitize_text_field($_POST['wprevpro_nr_date']);
     71       
     72        //insert or update
     73            $data = array(
     74                'userpic' => "$avatar_url",
     75                );
     76            $format = array(
     77                    '%s',
     78                );
     79
     80        if($r_id==""){
     81            //insert
     82            //$wpdb->insert( $table_name, $data, $format );
     83        } else {
     84            //update
     85            $updatetempquery = $wpdb->update($table_name, $data, array( 'id' => $r_id ), $format, array( '%d' ));
     86            if($updatetempquery>0){
     87                $dbmsg = '<div id="setting-error-wprevpro_message" class="updated settings-error notice is-dismissible">'.__('<p><strong>Review Updated!</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>', 'wp-review-slider-pro').'</div>';
     88            }
     89        }
     90    }
    2491?>
    2592<div class="wrap" id="wp_fb-settings">
     
    37104</p>
    38105</div>
     106<div class="wprevpro_margin10" id="wprevpro_new_review" <?php if($currentreview->id<1){echo "style='display:none;'";}?>>
     107<form name="newreviewform" id="newreviewform" action="?page=wp_google-reviews" method="post" onsubmit="return validateForm()">
     108    <table class="form-table ">
     109        <tbody>
     110            <tr class="wprevpro_row">
     111                <th scope="row">
     112                    <?php _e('Review Rating (1 - 5):', 'wp-review-slider-pro'); ?>
     113                </th>
     114                <td><div id="divtemplatestyles">
     115                <?php
     116                //if this is a not a manual review or new one then disable this
     117                    $tempdisable = 'disabled';
     118                ?>
     119                    <input type="radio" name="wprevpro_nr_rating" id="wprevpro_nr_rating1-radio" value="1" <?php if($currentreview->rating=="1"){echo "checked";} else {echo $tempdisable;}?> <?php echo $tempdisable; ?>>
     120                    <label for="wprevpro_template_type1-radio"><?php _e('1', 'wp-review-slider-pro'); ?></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     121                    <input type="radio" name="wprevpro_nr_rating" id="wprevpro_nr_rating2-radio" value="2" <?php if($currentreview->rating=="2"){echo "checked";} else {echo $tempdisable;}?> <?php echo $tempdisable; ?>>
     122                    <label for="wprevpro_template_type2-radio"><?php _e('2', 'wp-review-slider-pro'); ?></label>
     123                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     124                    <input type="radio" name="wprevpro_nr_rating" id="wprevpro_nr_rating3-radio" value="3" <?php if($currentreview->rating=="3"){echo "checked";} else {echo $tempdisable;}?> <?php echo $tempdisable; ?>>
     125                    <label for="wprevpro_template_type2-radio"><?php _e('3', 'wp-review-slider-pro'); ?></label>
     126                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     127                    <input type="radio" name="wprevpro_nr_rating" id="wprevpro_nr_rating4-radio" value="4" <?php if($currentreview->rating=="4"){echo "checked";} else {echo $tempdisable;}?> <?php echo $tempdisable; ?>>
     128                    <label for="wprevpro_template_type2-radio"><?php _e('4', 'wp-review-slider-pro'); ?></label>
     129                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     130                    <input type="radio" name="wprevpro_nr_rating" id="wprevpro_nr_rating5-radio" value="5" <?php if($currentreview->rating=="5" || $currentreview->rating==""){echo "checked";} else {echo $tempdisable;}?> >
     131                    <label for="wprevpro_template_type2-radio"><?php _e('5', 'wp-review-slider-pro'); ?></label>
     132                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     133                   
     134                    </div>
     135
     136                </td>
     137            </tr>
     138            <tr class="wprevpro_row">
     139                <th scope="row">
     140                    <?php _e('Review Text:', 'wp-review-slider-pro'); ?>
     141                </th>
     142                <td>
     143                <?php
     144                //if this is a not a manual review or new one then disable this
     145                    $tempdisable = 'readonly';
     146                ?>
     147                    <textarea name="wprevpro_nr_text" id="wprevpro_nr_text" cols="50" rows="4" <?php echo $tempdisable; ?>><?php echo $currentreview->review_text; ?></textarea>
     148                </td>
     149            </tr>
     150            <tr class="wprevpro_row">
     151                <th scope="row">
     152                    <?php _e('Reviewer Name:', 'wp-review-slider-pro'); ?>
     153                </th>
     154                <td>
     155                    <input id="wprevpro_nr_name" data-custom="custom" type="text" name="wprevpro_nr_name" placeholder="" value="<?php echo $currentreview->reviewer_name; ?>" required <?php echo $tempdisable; ?>>
     156                    <span class="description">
     157                    <?php _e('Enter the name of the person who wrote this review.', 'wp-review-slider-pro'); ?>     </span>
     158                </td>
     159            </tr>
     160            <tr class="wprevpro_row">
     161                <th scope="row">
     162                    <?php _e('Reviewer Pic URL:', 'wp-review-slider-pro'); ?>
     163                </th>
     164                <td>
     165                    <input id="wprevpro_nr_avatar_url" data-custom="custom" type="text" name="wprevpro_nr_avatar_url" placeholder="" value="<?php if($currentreview->userpic!=""){echo $currentreview->userpic; } else {echo plugin_dir_url( __FILE__ ) . 'google_mystery_man.png';} ?>"> <a id="upload_avatar_button" class="button"><?php _e('Upload', 'wp-review-slider-pro'); ?></a>
     166                    <br><span class="description">
     167                    <?php _e('Avatar for the person who wrote the review. Click the following image to insert generic avatar URL.', 'wp-review-slider-pro'); ?>
     168                    </span>
     169                    <div class="avatar_images_list">
     170                    <img src="<?php echo plugin_dir_url( __FILE__ ); ?>google_mystery_man.png" alt="thumb" class="rlimg default_avatar_img">&nbsp;&nbsp;&nbsp;
     171                    </div>
     172                    </br>
     173                    <img class="" height="100px" id="avatar_preview" src="<?php if($currentreview->userpic!=""){echo $currentreview->userpic; } else {echo plugin_dir_url( __FILE__ ) . 'google_mystery_man.png';} ?>">
     174                </td>
     175            </tr>
     176            <tr class="wprevpro_row">
     177                <th scope="row">
     178                    <?php _e('Review Date:', 'wp-review-slider-pro'); ?>
     179                </th>
     180                <td>
     181                    <input id="wprevpro_nr_date" data-custom="custom" type="text" name="wprevpro_nr_date" placeholder="" value="<?php if($currentreview->created_time!=""){echo $currentreview->created_time; } else {echo date("Y-m-d H:i:s",current_time( 'timestamp' ));} ?>" required readonly>
     182                </td>
     183            </tr>
     184        </tbody>
     185    </table>
     186    <?php
     187    //security nonce
     188    wp_nonce_field( 'wprevpro_save_review');
     189    $customlastsaveoption = get_option('wprevpro_customlastsave');
     190    ?>
     191    <input type="hidden" name="editrid" id="editrid"  value="<?php echo $currentreview->id; ?>">
     192    <input type="hidden" name="editrtype" id="editrtype"  value="<?php echo $currentreview->type; ?>">
     193    <input type="submit" name="wprevpro_submitreviewbtn" id="wprevpro_submitreviewbtn" class="button button-primary" value="<?php _e('Save Review', 'wp-review-slider-pro'); ?>">
     194    <a id="wprevpro_addnewreview_cancel" class="button button-secondary"><?php _e('Cancel', 'wp-review-slider-pro'); ?></a>
     195</form>
     196</br></br>
     197</div>
     198
    39199<?php
    40200
     
    107267            <thead>
    108268                <tr>
    109                     <th scope="col" width="70px" class="manage-column"><a href="'.esc_url( add_query_arg( 'sortby', 'hide',$currenturl ) ).$sortdirection.'"><i class="dashicons dashicons-sort '.$sorticoncolor[0].'" aria-hidden="true"></i> '.__('Hide', 'wp-google-reviews').'</a></th>
     269                    <th scope="col" width="70px" class="manage-column"><i class="dashicons dashicons-sort '.$sorticoncolor[0].'" aria-hidden="true"></i> '.__('Edit', 'wp-google-reviews').'</th>
    110270                    <th scope="col" width="50px" class="manage-column">'.__('Pic', 'wp-google-reviews').'</th>
    111271                    <th scope="col" style="min-width:70px" class="manage-column"><a href="'.esc_url( add_query_arg( 'sortby', 'reviewer_name',$currenturl ) ).$sortdirection.'"><i class="dashicons dashicons-sort '.$sorticoncolor[1].'" aria-hidden="true"></i> '.__('Name', 'wp-google-reviews').'</a></th>
     
    136296            foreach ( $reviewsrows as $reviewsrow )
    137297            {
    138                 if($reviewsrow->hide!="yes"){
    139                     $hideicon = '<i class="dashicons dashicons-visibility text_green" aria-hidden="true"></i>';
    140                 } else {
    141                     $hideicon = '<i class="dashicons dashicons-hidden" aria-hidden="true"></i>';
    142                 }
    143                 $hideicon ='';
     298                $hideicon = '<i class="dashicons dashicons-admin-tools editrev" aria-hidden="true"></i>';
     299
    144300                //user image
    145301                if($reviewsrow->userpic!=""){
    146                     $userpic = '<img style="-webkit-user-select: none" src="'.$reviewsrow->userpic.'">';
     302                    $userpic = '<img style="-webkit-user-select: none; width:100px;" src="'.$reviewsrow->userpic.'">';
    147303                } else {
    148                 $userpic = '<img style="-webkit-user-select: none" src="https://graph.facebook.com/v2.2/'.$reviewsrow->reviewer_id.'/picture?type=square">';
     304                $userpic = '<img style="-webkit-user-select: none; width:100px;" src="https://graph.facebook.com/v2.2/'.$reviewsrow->reviewer_id.'/picture?type=square">';
    149305                }
    150306                //user profile link
     
    158314   
    159315                $html .= '<tr id="'.$reviewsrow->id.'">
    160                         <th scope="col" class="wpfbr_upgrade_needed manage-column">'.$hideicon.'</th>
     316                        <th scope="col" class="manage-column"><a href="'.esc_url( add_query_arg( 'editrev', $reviewsrow->id,$currenturl ) ).'">'.$hideicon.'</a></th>
    161317                        <th scope="col" class="manage-column">'.$userpic.'</th>
    162318                        <th scope="col" class="manage-column">'.$reviewsrow->reviewer_name.'</th>
  • wp-google-places-review-slider/tags/4.9/admin/partials/tabmenu.php

    r1966529 r1992038  
    11<?php
    2 $urltrimmedtab = remove_query_arg( array('page', '_wpnonce', 'taction', 'tid', 'sortby', 'sortdir', 'opt', 'settings-updated' ) );
     2$urltrimmedtab = remove_query_arg( array('page', '_wpnonce', 'taction', 'tid', 'sortby', 'sortdir', 'opt', 'settings-updated','editrev' ) );
    33
    44$urlsettings = esc_url( add_query_arg( 'page', 'wp_fb-settings',$urltrimmedtab ) );
  • wp-google-places-review-slider/trunk/README.txt

    r1990916 r1992038  
    55Requires at least: 3.0.1
    66Tested up to: 5.0
    7 Stable tag: 4.9
     7Stable tag: 5.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8383
    8484== Changelog ==
     85= 5.0 =
     86* added ability to update Avatar image location.
    8587= 4.9 =
    8688* hidden date no longer gets added to page.
Note: See TracChangeset for help on using the changeset viewer.