Support » Plugin: TBTestimonials » issues when moving site

  • Resolved jdkoelsch

    (@jdkoelsch)


    Hello,

    This morning, I moved this site to a new server, and once the dns settings resolved, none of the testimonials on the site appeared, either on the page that displays all via a shortcode, or from sidebar widgets.

    I found that the issue this morning was that the output templates disappeared. When I go to the Templates tab of the Output templates, there are three empty textareas. There are no titles or descriptions, just a “Delete template” link. When I click the delete link, nothing happens.

    I temporarily fixed the issue by copying the templates from our dev site to the live site. I found that I couldn’t name them the default names — it appeared to save, but nothing was updated on the templates tab. So, I had to give them new names. Then I updated my shortcode and widgets to use the new template names.

    When we move sites, we use the Migrate DB plugin. This plugin does a find and replace for all URLs and server directories, then generates a SQL script.

    Can you tell me how to delete these empty templates? And if there is something else I can do to make server migrations work in the future? Thanks so much for any help or suggestions you can provide.

    http://wordpress.org/plugins/tb-testimonials/

Viewing 6 replies - 1 through 6 (of 6 total)
  • I had the same problem on a site after migrating from one hosting company to another. The values have been mangled by the migration. You will need to fix this directly in the database.

    I wrote a code snippet you can use in your functions.php file if you are not comfortable access your database directly. No guarantees on this, but it should work. It is listed below these instructions for accessing your database directly.

    INSTRUCTIONS FOR CHANGING VALUE IN DATABASE
    ——–
    Open your database as you normally would (such as using phpMyAdmin via cPanel or Plesk).

    In the wp_options table (may have a different prefix than “wp_”), search for the row with the option_name of “tbt_templates” (without the quotation marks).

    Change the option_value of this row to:

    a:3:{s:6:"widget";O:27:"Testimonial_Output_Template":3:{s:8:"*_name";s:6:"widget";s:10:"*_syntax";s:468:"<li class="testimonial">
        <div class="testimonial-gravatar">{{ gravatar }}</div>
        <div class="testimonial-data">
            <p class="testimonial-content">{{ testimonial_excerpt }}</p>
            <p class="testimonial-author">{{ author_prefix }}{{ author }}</p>
            {% if  company_url %}
                <p class="testimonial-company"><a href="{{ company_url }}">{{ company_name }}</a></p>
           {% endif %}
        </div>
        <div class="tbtclear"></div>
    </li>";s:15:"*_description";s:21:"Default widget syntax";}s:9:"shortcode";O:27:"Testimonial_Output_Template":3:{s:8:"*_name";s:9:"shortcode";s:10:"*_syntax";s:475:"<div class="in-content-testimonial">
        <div class="testimonial-gravatar">{{ gravatar }}</div>
        <div class="testimonial-data">
            <p class="testimonial-content">{{ testimonial }}</p>
            <p class="testimonial-author">{{ author_prefix }}{{ author }}</p>
            {% if  company_url %}
                <p class="testimonial-company"><a href="{{ company_url }}">{{ company_name }}</a></p>
           {% endif %}
        </div>
        <div class="tbtclear"></div>
    </div>
    ";s:15:"*_description";s:24:"Default shortcode syntax";}s:7:"listing";O:27:"Testimonial_Output_Template":3:{s:8:"*_name";s:7:"listing";s:10:"*_syntax";s:475:"<div class="in-listing-testimonial">
        <div class="testimonial-gravatar">{{ gravatar }}</div>
        <div class="testimonial-data">
            <p class="testimonial-content">{{ testimonial }}</p>
            <p class="testimonial-author">{{ author_prefix }}{{ author }}</p>
            {% if  company_url %}
                <p class="testimonial-company"><a href="{{ company_url }}">{{ company_name }}</a></p>
           {% endif %}
        </div>
        <div class="tbtclear"></div>
    </div>
    ";s:15:"*_description";s:22:"Default listing syntax";}}

    Save this change. The default output templates should now appear in your admin area.

    CODE SNIPPET for those who cannot or do not wish to access the database directly
    ———
    IMPORTANT: delete this snippet after you restore the defaults, or it will rewrite every time you load a page.

    In your theme’s functions.php file, add the following code snippet. You may need to add opening and closing php tags, but they will most likely already be in the file.

    Once the snippet is in your functions.php file, browse any page of your site. Then delete the snippet from your functions.php file. The default output templates should now appear in your admin area.

    // BEGIN Revert TB Testimonials output templates to default values (remove code snippet after repair)
    add_action( 'wp_loaded', 'mip_reverttbttemplates' );
    function mip_reverttbttemplates(){
    	global $wpdb;
    
    	$defaulttemplatevalue = 'a:3:{s:6:"widget";O:27:"Testimonial_Output_Template":3:{s:8:"*_name";s:6:"widget";s:10:"*_syntax";s:468:"<li class="testimonial">
        <div class="testimonial-gravatar">{{ gravatar }}</div>
        <div class="testimonial-data">
            <p class="testimonial-content">{{ testimonial_excerpt }}</p>
            <p class="testimonial-author">{{ author_prefix }}{{ author }}</p>
            {% if  company_url %}
                <p class="testimonial-company"><a href="{{ company_url }}">{{ company_name }}</a></p>
           {% endif %}
        </div>
        <div class="tbtclear"></div>
    </li>";s:15:"*_description";s:21:"Default widget syntax";}s:9:"shortcode";O:27:"Testimonial_Output_Template":3:{s:8:"*_name";s:9:"shortcode";s:10:"*_syntax";s:475:"<div class="in-content-testimonial">
        <div class="testimonial-gravatar">{{ gravatar }}</div>
        <div class="testimonial-data">
            <p class="testimonial-content">{{ testimonial }}</p>
            <p class="testimonial-author">{{ author_prefix }}{{ author }}</p>
            {% if  company_url %}
                <p class="testimonial-company"><a href="{{ company_url }}">{{ company_name }}</a></p>
           {% endif %}
        </div>
        <div class="tbtclear"></div>
    </div>
    ";s:15:"*_description";s:24:"Default shortcode syntax";}s:7:"listing";O:27:"Testimonial_Output_Template":3:{s:8:"*_name";s:7:"listing";s:10:"*_syntax";s:475:"<div class="in-listing-testimonial">
        <div class="testimonial-gravatar">{{ gravatar }}</div>
        <div class="testimonial-data">
            <p class="testimonial-content">{{ testimonial }}</p>
            <p class="testimonial-author">{{ author_prefix }}{{ author }}</p>
            {% if  company_url %}
                <p class="testimonial-company"><a href="{{ company_url }}">{{ company_name }}</a></p>
           {% endif %}
        </div>
        <div class="tbtclear"></div>
    </div>
    ";s:15:"*_description";s:22:"Default listing syntax";}}';
    
    	$revertquery = "UPDATE {$wpdb->options} SET option_value = {$defaulttemplatevalue} WHERE option_name = 'tbt_templates'";
    
    	$wpdb->query($revertquery);
    }
    // END Revert TB Testimonials output templates to default values
    Plugin Author Travis Ballard

    (@ansimation)

    Hey there! Sorry for the delayed reply here, thank you greatly for assisting, Michelle! I have plans to add a button to reset things to default incase of corruption or whatever and I think it would be good to have. No promises on when that will be available though, I’m a bit busy on a few projects and have to find some spare time to work on it.

    Thanks for using TB-Testimonials,
    Travis Ballard

    I really love this plugin, Travis – and believe me, I completely understand the lack of spare time. If the code above helps in the future, please feel free to use it. Keep up the great work!

    Thread Starter jdkoelsch

    (@jdkoelsch)

    Wow, Michelle. Thanks so much! I appreciate the clear, detailed instructions.

    This is an incredibly helpful plugin, and I’m very thankful for all of your efforts, Travis!

    My pleasure! I hope it works for you.

    I had a similar problem, also using WP Migrate to migrate DB.

    Two things:
    1) I don’t think this issue should be marked as “resolved”. A work-around has been found, but the issue remains, and it is a fairly significant one since the DB appears to get corrupted, and any custom templates are lost!

    2) I found, in applying the wonderful solution posted by Michelle above to restore the defaults, that I needed quotation marks around the data in the query :
    $revertquery = "UPDATE {$wpdb->options} SET option_value = '{$defaulttemplatevalue}' WHERE option_name = 'tbt_templates'";

    Thanks Michelle – great idea!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘issues when moving site’ is closed to new replies.