Support » Plugin: GC Testimonials » Notice: Use of undefined constant KCVT_URL

  • Farhan Sabir


    I installed and activated the plugin. Getting the following error:

    Notice: Use of undefined constant KCVT_URL – assumed ‘KCVT_URL’ in …../public_html/blog/wp-content/plugins/gc-testimonials/testimonials.php on line 946

    line 944-947:

    if ( is_admin() ) {
    	//register_uninstall_hook(KCVT_URL.'/testimonials.php', 'gct_testimonials_de_register_settings');
    	register_activation_hook(KCVT_URL.'/testimonials.php', 'gct_testimonials_register_settings');

    Can you please help?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Farhan Sabir


    On front-end using shortcode [full-testimonials]</strong] I have two notices:

    Notice: Undefined variable: wp_query in ...../public_html/blog/wp-content/plugins/gc-testimonials/testimonials.php on line 500
    Notice: Undefined variable: display in ...../public_html/blog/wp-content/plugins/gc-testimonials/testimonials.php on line 505

    line 949: change KCVT_URL to GCT_URL

    comment out lines 445, 502, 764: // $temp = $wp_query;

    lines 351 and 507: change $display .= to $display = (without the period)

    Thanks for the help.

    You have solved most of the problems, but when I try to use the shortcode [testimonial-form], I get “undefined variable” for all the variables ($error, etc.) on line 621:

    return gct_get_create_testimonial_form($error, $success, $gct_client_name, $gct_email, $gct_company_name, $gct_company_website, $gct_headline, $gct_text, $gct_agree, $gct_client_photo);

    Can you see a fix for this one?


    You’re welcome.

    I reworked the code enough that it will be easier to just replace the entire section. My apologies to the original developer if I’m overstepping.

    function gct_form_shortcode($atts) {
      global $add_styles, $add_validation;
      $add_styles = true;
      $add_validation = true;
      if (isset( $_POST['gct_create_testimonial_form_submitted'] )
          && wp_verify_nonce( $_POST['gct_create_testimonial_form_submitted'], 'gct_create_testimonial_form' ) ) {
        $gct_client_name = trim($_POST['gct_client_name']);
        $gct_email = trim($_POST['gct_email']);
        $gct_company_name = trim($_POST['gct_company_name']);
        $gct_company_website = trim($_POST['gct_company_website']);
        $gct_headline = trim($_POST['gct_headline']);
        $gct_text = trim($_POST['gct_text']);
        $gct_agree = trim($_POST['gct_agree']); 
        $testimonial_data = array(
          'post_title' => $gct_headline,
          'post_content' => $gct_text,
          'post_status' => 'pending',
          'post_type' => 'testimonial'
        if ($testimonial_id = wp_insert_post($testimonial_data)) {
          add_post_meta($testimonial_id, "client_name", $gct_client_name);
          add_post_meta($testimonial_id, "email", $gct_email);
          add_post_meta($testimonial_id, "company_name", $gct_company_name);
          add_post_meta($testimonial_id, "company_website", $gct_company_website);
          if($_FILES['gct_client_photo']['size'] > 1) {
            foreach($_FILES as $field => $file) {
              // Upload File
              $overrides = array('test_form' => false);
              $uploaded_file = gct_wp_handle_upload($_FILES['gct_client_photo'], $overrides);
              $gct_client_photo = $uploaded_file['url'];
              // Create an Attachment
              $attachment = array(
                'post_title' => $file['name'],
                'post_content' => '',
                'post_type' => 'attachment',
                'post_parent' => $testimonial_id,
                'post_mime_type' => $file['type'],
                'guid' => $uploaded_file['url']
              $attach_id = wp_insert_attachment( $attachment, $uploaded_file['file'], $testimonial_id );
              $attach_data = wp_generate_attachment_metadata( $attach_id, $uploaded_file['file'] );
              wp_update_attachment_metadata( $attach_id,  $attach_data );
              add_post_meta($testimonial_id, 'client_photo', $gct_client_photo);
              set_post_thumbnail( $testimonial_id, $attach_id );
          $email_me = get_option('att_email_me');
          $email_address = get_option('att_email_address');
          if($email_me == 'yes' && $email_address != '') {
            $to = $email_address;
            $subject = 'Testimonial Submission on '.get_option('blogname');
            $headers = 'From: noreply@'.$_SERVER['HTTP_HOST'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
            $message = 'You have received a testimonial submission on '.get_option('blogname').'. This is awaiting action from the administrator of the website.';
            wp_mail($to, $subject, $message, $headers);
          return '<div class="testimonial-success">'. __("Thank You! Your Testimonial is awaiting moderation.", GCT_NAME) .'</div>';
      return gct_get_create_testimonial_form();


    function gct_get_create_testimonial_form() {
      $html = '<div id="testimonial-form">';
      $html .= '<div class="required_notice"><span class="required">* </span>= '.__("Required Field", GCT_NAME).'</div>';
      $html .= '<form id="create_testimonial_form" method="post" action="" enctype="multipart/form-data">';
      $html .= wp_nonce_field('gct_create_testimonial_form', 'gct_create_testimonial_form_submitted');
      $html .= '
      <p class=" form-field">
      <label for="gct_client_name">'.__("Full Name:", GCT_NAME).' <span class="req">*</span></label>
      <input type="text" name="gct_client_name" id="gct_client_name" class="text required"  minlength="2" />
      <span>'.__("What is your fullname?", GCT_NAME).'</span>
      <p class=" form-field">
      <label for="gct_email">'.__("Email:", GCT_NAME).' <span class="req">*</span></label>
      <input type="text" name="gct_email" id="gct_email" class="text required email" />
      <span>'.__("Fill in your email address", GCT_NAME).'</span>
      <p class=" form-field">
      <label for="gct_company_name">'.__("Company Name:", GCT_NAME).'</label>
      <input type="text" name="gct_company_name" id="gct_company_name" class="text" />
      <span>'.__("What is your company name?", GCT_NAME).'</span>
      <p class=" form-field">
      <label for="gct_company_website">'.__("Company Website:", GCT_NAME).'</label>
      <input type="text" name="gct_company_website" id="gct_company_website" class="text" />
      <span>'.__("Does your company have a website?", GCT_NAME).'</span>
      <p class=" form-field">
      <label for="gct_headline">'.__("Heading:", GCT_NAME).'</label>
      <input type="text" name="gct_headline" id="gct_headline" class="text" />
      <span>'.__("Describe our company in a few short words", GCT_NAME).'</span>
      <p class=" form-field">
      <label for="gct_text">'.__("Testimonial:", GCT_NAME).' <span class="req">*</span></label>
      <textarea name="gct_text" id="gct_text" class="textarea  required"></textarea><br />
      <span>'.__("What do you think about our company?", GCT_NAME).'</span>
      <div class="clear"></div>
      <p class=" form-field">
      <label for="gct_client_photo">'.__("Photo:", GCT_NAME).'</label>
      <input type="file" name="gct_client_photo" id="gct_client_photo" class="text" /><br />
      <span>'.__("Do you have a photo we can use?", GCT_NAME).'</span>
      <p class=" form-field agree">
      <input type="checkbox" value="yes" name="gct_agree" id="gct_agree" class="checkbox required" checked="checked" />
      <span><span class="req">*</span>'.__("I agree that this testimonial can be published.", GCT_NAME).'</span>
      <div class="clear"></div>
      <p class="form-field">
      <input type="submit" id="gct_submit_testimonial" name="gct_submit_testimonial" value="'.__("Add Testimonial", GCT_NAME).'" class="button" validate="required:true" />
      $html .= '</form>';
      $html .= '</div>';
      return $html;


    Chris: You’re the best! All works now. I can’t believe you did all this work to fix this. I hope the author builds this fix into his code.

    I can’t wait to read through your code and compare it to the original to see what you did to fix it.

    Thanks again.


    Do you have the entire fixed GC Testimonials plugin package you might be able to send me? I’m having the same issue.


    Sorry robertrhu, I wasn’t monitoring this thread. Contact me at chris at wpmission dot com. I’m actually working on a fork of this plugin that you may be interested in; that should be ready in January.


    Michael Cannon says he has fixed the errors:

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Notice: Use of undefined constant KCVT_URL’ is closed to new replies.