Theme changes not showing up after deploy

I have added the following lines to the user.php file in sages “app” directory.

add_action('personal_options', __NAMESPACE__ . '\\show_users_followed_pages');

    function show_users_followed_pages($user) {

      $user_id = $user->ID;

      ?>
      <table class="form-table">
        <tbody>
              <?php
                $notifications = \Roots\Sage\Notifications\PageNotifications::get_instance();
                $pages = $notifications->get_users_subscribed_pages($user_id);

                if (!empty($pages)) {
                  ?>
                    <th scope="row"><h2>Followed Pages</h2></th>
                  <?php

                  foreach($pages as $page) {
                    echo "<tr>";
                    echo "<td><em>$page->post_title</em></td>";
                    echo "</tr>";
                  }
                }
              ?>
        </tbody>
      </table>
      <?php
    }




    add_action( 'personal_options', __NAMESPACE__ . '\\show_users_quick_links' );

    function show_users_quick_links($user) {
    	// $user_meta = get_user_meta($user);
      $user_id = $user->ID;

      if($user_id != 0) {
        $user_meta = get_user_meta($user_id, "quick_links");
      }

      ?>
      <table class="form-table">
        <tbody>
              <?php

                if (!empty($user_meta)) {
                  ?>
                    <th scope="row"><h2>Quick Links</h2></th>
                  <?php

                  foreach($user_meta[0] as $page_id) {
                    $link = htmlspecialchars_decode(get_the_title($page_id));
                    echo "<tr>";
                    echo "<td><em>$link</em></td>";
                    echo "</tr>";
                  }
                }
              ?>
        </tbody>
      </table>
      <?php
    }

And the following to notifications.php

    function get_users_subscribed_pages($user, $args = null) {

    if (is_int($user))
      $user = get_userdata($user)->user_login;

    $post_args = array(
      'tax_query' => array(
          array(
            'taxonomy' => $this->notifications_taxonomy,
            'field' => 'slug',
            'terms' => $user,
          )
      ),
      'orderby' => 'modified',
      'order' => 'DESC',
      'post_status' => 'any',
      'post_type' => 'page',
      'posts_per_page' => -1
    );

    $pages = get_posts($post_args);

    return $pages;
  }

Whenever I deploy, the changes are not showing up on any of the users profiles on my staging server. The deployment runs successfully, I made sure to composer update from both the theme and the site root directory.

I am at a complete loss.

  • What is your deploy process?
  • Have you confirmed that the new versions of users.php and notifications.php are on your staging server after deploy?
  • Where is notifications.php? If it’s also in theme\app, then your instantiation of the class looks like it’s using the wrong namespace (theme\app usually uses the App namespace, not Roots\Sage).

Using trellis to deploy. Typical setup, and yes notifications is in the theme/app/ directory. Changes work perfectly on my local vagrant dev env but no changes show up on the staging server.

And even though i know it’s always frowned upon and I never do it any other time, I added them directly to the staging server because the changes were not getting set during the deploy, and they still didn’t work.

Can you deploy other changes? i.e. is updated CSS reflected, or are PHP things done elsewhere reflected?

I actually just got it figured out. Someone had set the theme branch to master instead of staging in the wordpress_sites.yml file. It’s working perfectly now.

1 Like

I’m not kidding this happens to me at least once per project. Every single time I think I’ve lost my mind or something is severely broken in my deploy process and it’s always that I forgot to merge.

So cheers.

Should be noted that https://github.com/roots/trellis/pull/997 will fix this right? Once it’s fix and un-reverted :slight_smile:

1 Like