3.8.11 – How to Update your wpsc-user-log.php file.

You’ve likely landed on this page because you recently upgraded to WPeC 3.8.11 or greater and you happen to have a theme that has modified the wpsc-user-log.php page.  This was a change made in 3.8.10, and this documentation is our effort to, as easily as possible, assist you in upgrading your theme file to be compatibile with the latest version of WPeC.

Before 3.8.10

Before WPeC 3.8.10 was released, the wpsc-user.log.php was a mish-mash of presentation and logic filled with tons of conditionals and inconsistent hooks and mechanisms for plugin developers to modify the output.  If you have a very basic understanding of HTML and template tags in WordPress, you can check out the source of this file here.

You’ll see a few basic blocks

  • is_user_logged_in()
  • You must be logged in (Preceded by <?php else : ?>)

After 3.8.10

After 3.8.10, the wpsc-user-log.php page has been streamlined into a fairly versatile system where each view of the user account page is inserted via hooks.  This means it is far easier for plugin developers to add (or remove) different view in the My Account page without having to worry the user with making changes to their theme files.  If you look at the source file, you’ll see it drastically simplified. The blocks are as follows:

  • is_user_logged_in()
  • do_action (this is important)
  • You must be logged in (Preceded by <?php else : ?>)

After looking at the code, here are the really important differences to note:

  1. Near the top, by the global keyword –  the new version removes all of the previous globals, and adds one, $current_tab.
  2. The contents inside of the user-profile-links <div> have completely changed. It’s only a few lines, but they are important.
  3. Outside of that <div>, there is a new action, <?php do_action( 'wpsc_user_profile_section_' . $current_tab ); ?>

    Also super important.

  4. Aside from that, everything else is stripped away and you’re left with the “else” condition for the logged out form.

If there are new changes you want to make, or you’re beginning the process of re-applying changes to different areas of this file, you’ll notice three new files which contain the areas previously contained in this file.

  1. wpsc-account-downloads.php
  2. wpsc-account-purchase-history.php
  3. wpsc-account-edit-profile.php

Naturally, you can just apply your previous changes to each of these files.  This should be a fairly easy change, even for novices.  But of course, if you need any help in this process, WPEC Consultants are highly capable and should be able to handle even the more complex theme files within an hour’s time – for most themes, it could be much less than that.