How to create a YouTube API key

As is tradition, the process consists of 3 easy steps:

  1. Creating a new project in your Google Cloud Platform account.
  2. Enabling the “YouTube Data API V3″ data source for your newly created project. 
  3. Generating the API key to access the YouTube API.

Step 1

Log into your Google Cloud Platform account. Create your new project or select an existing one. 

 

Step 2

Once your new project is available, search “YouTube Data API V3” and enable the data source. You can also create the project here if you’re a rebel and skipped step 1. 

The end goal is to enable the YouTube data source for your project, which you did. Half-way there.

 

Step 3

Generate and save your API keys as illustrated below. But first, locate the YouTube DATA API.

 

Here you can choose to restrict the API key to your own domain. If unsure about this, leave the default options until you get the website operational. Otherwise, make sure to use the correct details about your domain and the rules you set. This part can’t be ignored and is the #1 source for problems. 

When set incorrectly, there can be no communication between your domain and the YouTube API since the restrictions/rules prevent it. Don’t worry, you’ll get an error message about it. 

 

 

Job done 🥳

Just copy/pasta your shiny new API key in PHP Melody’s ‘Settings’ page (you know where) and you’re good to go.

Have fun and be mindful of API usage and Google’s terms of service. 

 

The Ultimate Guide to PHP Melody Updates

You’re here because you need help with an update problem or it’s your first time updating PHP Melody. Either way, the following guide should answer all your questions.

This document is divided into the following sections:

Overview

New features, improvements and bug fixes for PHP Melody come in the form of an update package. Applying the update packages is 100% optional but we do recommend you try to keep your PHP Melody website(s) up to date.

Updates bring changes to both the PHP Melody file structure as well as its MySQL database. That is why it’s crucial to always use the official update packages to update your video site. We’ll show you how to correctly update your PHP Melody later in this guide.

In case you don’t have the time or desire to keep your PHP Melody up-to-date, we’re here to help. Our team can ensure your PHP Melody installation is always up-to-date by applying the new update packages. Please contact our support team to arrange for this service.

How do I know which PHP Melody version I’m using now?

Log into your website’s admin area and in the footer of all your pages you can find the PHP Melody version (as shown below):

powered

Note: In rare cases where the wrong patch/update files were applied in the past, an incorrect version might appear in the footer. Learn more about this in the ‘Troubleshooting’ section below.

How can I get the update packages?

UpdateYour customer account will give you access to both the full purchased product(s) as well as all the available update packages for each product.

The full product packages should only be used for new installations (never for updates).

To download the required update package(s), log into your Customer Account and browse to the ‘Download Updates‘ page.

It’s important to mention that you cannot and should never update your PHP Melody website(s) by applying the packages you can get from the ‘Download Products‘ page (i.e. the full product package).

To update your PHP Melody site correctly, always use the packages from the ‘Download Updates‘ page (i.e. the update package).

While it may sound obvious to you, we mention this because some customers have attempted to update their websites with the full package from the ‘Download Products‘ page only to find out that it ruins the site. That is because only the update packages include MySQL updating files.

Note: If you’ve applied the wrong update package or the full package, please see the ‘What can I do if I applied the wrong update or uploaded the full package by mistake?’ answer below.

How can I update my old PHP Melody installation?

Let’s begin by assuming you’re currently running PHP Melody v2.3 and need to update to the latest version which is v2.6.

Since between v2.3 and v2.6, we’ve released 5 other versions (v2.3.1, v2.4, v2.5, v2.5 [hotfix] and lastly v2.6), you will have to download all these update packages.
update-packs

 

 

 

 

You should end up with 5 zip packages saved locally. Begin the update process by unzipping the first update package (v2.3.1) and read the included Update Guide 2.3.1.pdf file. Note: each includes a update guide PDF.

Always read the Update Guide because each update includes important update instructions.

The update guides will advise you to only upload the update package after creating a backup of your current installation. Always backup your files and MySQL database before updating. Any problems can easily be solved by restoring the backup.

Once you’ve uploaded all the files and folders, log into your PHP Melody back-end site and follow the on-screen instructions to finish the update process. Logging into your administration area after uploading the update package is a mandatory step. It’s easy to overlook this step if you apply multiple updates.

Finally, if no update steps were skipped, your site will be updated to v2.3.1. You can now continue applying the next update package (v2.4). Repeat until you reach the latest version.

In summary, the key to a successful update is to: backup your existing files and MySQL database, read and follow the update instructions from the PDF, upload all the files and folders from the update package and update the MySQL database.

In case your site is using plugins/modules or custom themes, please see the ‘Troubleshooting’ section below. Any custom theme or plugin also has to be upgraded.

What can I do if I applied the wrong update or uploaded the full package by mistake?

Case 1: Uploading the wrong files without altering the MySQL database.

PHP Melody updates have safety-checks to ensure that you cannot accidentally apply the wrong update package. However, this covers the MySQL changes and it won’t prevent you from uploading the wrong files via FTP.

Let’s say you’re using PHP Melody v2.3 and, by mistake, uploaded the latest full package; v2.6. In this case, just restore the PHP Melody v2.3 files from the full package and overwrite the v2.6 files. In case you no longer have the v2.3 full package, please contact our support team and we will be happy to send you the required files.

After uploading the correct files, you can resume the update process by applying an update package.

Case 2: Applying both the wrong files and modifying or corrupting the MySQL database.

Without a backup there is little chance of fixing this problem by yourself because the damage is too extensive.

You shouldn’t worry because our team provides data recovery and general recovery services. We’ve successfully fixed numerous sites and recovered data in as fast as 24 hours for our customers.

We can help you fix corrupted MySQL tables, recover data from old PHP Melody installations and update your site in the process. Please get in touch with us if you’re looking to recover a crashed or wrongly updated site.

Frequent Asked Questions:

  1. I have an old PHP Melody site.  Can I skip straight to the latest update package?
    No. To correctly update PHP Melody you will have to apply each missing update; one after another. Read the “How can I update an old PHP Melody installation?” answer from above.
  2. Can I install the latest version and use my existing/old MySQL database?
    No. Because all updates include MySQL database changes your previous database will not have those changes. Having a mis-match between the files and the MySQL database version will cause problems. The PHP Melody files and the MySQL database should belong to the same version.
  3. I’ve been using a nulled copy but I want to update it. How can I get the missing update packages?
    Contact our team and describe your situation. We will send you the missing update packages. Be sure to mention which PHP Melody version you’re using at the moment.
  4. I’ve messed my website. Can you fix it for free?
    We’re glad to fix our bugs and problems free of charge. However, any intervention to fix problems caused by applying the wrong updates or incorrect product usage is a paid service.

Troubleshooting

I’ve updated my site exactly as you instructed but I cannot see the new features in the front-end.

In this case one of two things might have happened. Firstly, ensure the new feature(s) are not disabled by default (because some are). If your site uses a custom theme, make sure the theme is also up-to-date. To update your theme, simply download the latest theme version from your Customer Account and upload it to your site.

With each update, we’re also updating our available themes and plugins. Be sure to update your custom theme as well. Unlike PHP Melody, you can skip to the latest PHP Melody theme as long as the PHP Melody version and the theme version are the same/match.

I’m trying to change the settings form the back-end but the settings page doesn’t save them.

Such behavior indicates the MySQL database is not up to date. This is caused by either skipping updates or neglecting the last update step; updating the database. Since there is no general solution for this, contact our team. We can update your database for you (paid service).

My admin footer indicates I’m using the latest version but I don’t see the features or the latest theme.

There is a (slight) possibility that the version indicated is not true. This happens if someone manually updates the version number by hand or if the wrong update package was applied. If you’re unsure about this, contact our support team right away.

You may want to manually change the PHP Melody version so that you can apply the correct update package. To manually change the version number, use phpMyAdmin to manually edit the ‘pm_config’ table. Look for the ‘version’ entry and change the version as needed.

Warning: under normal circumstances you should never find yourself doing this. If you are, something has gone terribly wrong and perhaps the best idea would be to get in touch with our support team and determine what needs to be done next.
Never update the version number by hand unless you really know what you’re doing. We cannot take any responsibility for the problems this might cause.

 

 

Upload Error #2049 Explained

If while uploading a video or image to your PHP Melody site you get Error #2049, the might be within the /config.php file.

Check your /config.php file and make sure the URL is 100% accurate and does not include a trailing slash (i.e. /) at the end of the domain name.

Correct URL:

define('_URL', 'https://www.phpsugar.com');

Incorrect URL:

define('_URL', 'https://www.phpsugar.com/');

How to Create a Cron Job

The “Automated Jobs” feature from PHP Melody requires a cron job to run a PHP script on a regular basis.
Most of the times this can be easily be accomplished with the help of crontab (linux).

To setup your new cron job, you need to know the URL/command which cron will run. Retrieve this information log into your PHP Melody’s back-end and browse to the Automated Jobs > Setup page.

Once you retrieved your URL/command (should include a secret key), proceed with setting up your cron job as follows.

Method 1: Setup cron via cPanel, Plesk or your webhost panel

If you’re running PHP Melody on a shared hosting account or VPS, your webhost has already provided you with some sort of management area such as cPanel or Plesk.

Since adding a new cron job is already very well documented for both cPanel and Plesk we recommend using their instructions:

We also have a quick video on the entire cPanel procedure:

Method 2: Creating a new cron job using the command line (linux)

If you own the server or have access to the command line, edit your crontab by running:

# crontab -e

In a new line, add your cron job by pasting in the following line:

*/5 * * * * wget -q "https://www.PHPMELODY-URL.com/cron.php?cron-key=SECRET_KEY"

This example uses a dummy URL. To get your URL (with the secret key), visit your PHP Melody back-end and browse to the Automated Jobs > Setup page.

How to Manually Change Your Password (for back-end access)

Losing your PHP Melody admin password isn’t the end of the world. In this post we will help you overwrite your existing password in a matter of minutes.

Reasons why you might need this tutorial:

  • forgot the darn password
  • someone changed it and forgot to tell you
  • retrieving the password via the “Forgot your password” page fails

Before you begin make sure you have the login details for your cPanel, Plesk or your hosting management console.

If you’re already familiar with MySQL simply execute this MySQL query:

UPDATE `pm_users` SET `password` = MD5('newpassword') WHERE `pm_users`.`id` = 1;

Replace “newpassword” with your desired password.

Otherwise, log into your cPanel/Plesk account:

  1. Find the phpMyAdmin link which will take you to your MySQL databases
  2. Select your PHP Melody MySQL database
  3. Select the “pm_users” table from all of PHP Melody’s tables
  4. Click on the top left “Browse” tab to see the contents of the “pm_users” table
  5. Go to the first listing (ID number 1), normally the “admin” account and click the edit button (the pencil)
  6. Once on the edit page for the admin account, type in your new password in plain text
  7. Make sure you select “md5 from the functions column (on the left of your password)
  8. Hit the “Go” or “Save” button and try your new password by accessing your PHP Melody admin area.

We also have a quick video on the entire procedure:

How to Add a New Link In the Header Menu

Including a new link into your PHP Melody header menu (see image) is very easy.

All you have to do is open the template file responsible for the header and include the HTML for your new link.

In the following example we’re going to include a new link, named ‘Special Link‘ which points to https://www.phpmelody.com/. Here’s how to do it.

  1. Open your /templates/[current theme folder]/header.tpl file with a plain-text editor.
  2. Search for the following code:
    {if $smarty.const._MOD_ARTICLE == 1}
  3. Add your new link right after the closing {/if} like so:
    <li><a href="https://www.phpmelody.com/" class="wide-nav-link">Special Link</a></li>

Here’s how the code should look:

 

That’s it. Upload the updated header.tpl file back to your PHP Melody installation and the new link will appear in the header menu.

 

Verified Channels

Users with the “Verified Channel” mark represent a trusted source of content. The verification process or criteria depends on a per-project basis and should be handled by the site’s administrator.

“Verified channels”  display a checkmark icon to the right of the channel name, and “Verified” appears in a popup if you point your cursor at it.

In addition to having the verification badge applied to their profile/channel, verified users can also be allowed more freedom when it comes to publishing videos.

For example, users which own a “verified channel” can have their submissions automatically approved even if PHP Melody is configured to require manual approval of all user submitted content.

This feature was introduced in PHP Melody v2.6 and is part of the “Social Module”.

Featured Channels

The “Featured Channel” option allows you to promote and provide a higher visibility to certain accounts form your user base.

Depending on the project’s requirements, the “featured channel” mark can be used to:

  • Highlight accounts with high quality content form your user base
  • Promote accounts in exchange for payment
  • Organize the content based on the type of user
  • Target specific users based on their interests (in development)

This feature was introduced in PHP Melody v2.6 and is part of the “Social Module”.

Show hidden files on a Mac

Update: You can download an app (Funter) to do all the work for you.

PHP Melody includes several files beginning with a dot (e.g. .htaccess). If you’re using a Mac OS to upload the PHP Melody into your server, you’ll have to first make the .htaccess files visible in Finder or your FTP app.

To show hidden files, first open up the Terminal app. If you’ve never used this, it’s here:

Appli­cations → Utilities → Terminal

A quick note before you do anything: using Terminal without knowing what you’re doing can really screw up your computer. It’s not unsafe to do, you just have to be very careful not to type in any commands that you don’t intend to. As such make sure you’ve read the code below carefully and have typed it exactly as written! You have been warned.

Okay now, right after the dollar sign you can go ahead and type or paste in the code below, and press enter.

defaults write com.apple.finder AppleShowAllFiles TRUE

Nothing will happen yet, because you need to restart Finder for the changes to take effect. To do this, you can either press option+command+esc to open the Force Quit Appli­cations window, select Finder from the list and hit “Relaunch”, or simply type in the code below in the Terminal window, and again press enter.

killall Finder

If you typed those lines correctly, your desktop icons should disappear for just a second while Finder restarts and the code in your finder window will look like the image screenshot below.

Now any hidden files on the system should be visible. If you’re not seeing the file you expected, it’s possible that your FTP client is not configured to pull down those hidden files, so you may need to check those settings also. And remember, deleting any system files can break stuff on your computer—if you’re going to go through this process, make sure you’re only editing stuff you know is pertinent to your site, like the .htaccess file.

[Source]

How to improve the quality of your preview images

Note: Newer PHP Melody versions do not require this change. You can change the thumbnail quality straight form the back-end interface.
Browse to your ‘Settings‘ page (under the ‘General Settings‘ tab) and look for ‘Use thumbnail size‘. For PHP Melody versions released in early 2015 read on.

low-quality-imageIf you’ve recently (April 2015) updated your PHP Melody website and noticed the preview images look pixelated, like the image on the right, please read on.

Let’s get started.

Step 1.

Make sure that you are using PHP Melody v2.3.1 or newer.
Note: This procedure not apply to older installations (i.e. before v2.3.1).

Step 2.

Open your PHP Melody’s /include/functions.php file and search for the following (Lines: 1078 to 1082):

// if ($video['source_id'] == $video_sources['youtube']['source_id'] && $video['yt_id'] != '')
// {
// 	$video['preview_image'] = 'https://i.ytimg.com/vi/'. $video['yt_id'] .'/hqdefault.jpg'; 
// }

Replace that with:

if ($video['source_id'] == $video_sources['youtube']['source_id'] && $video['yt_id'] != '')
{
	$video['preview_image'] = 'https://i.ytimg.com/vi/'. $video['yt_id'] .'/hqdefault.jpg'; 
}

Step 3.

Save functions.php and upload it to the /include/ folder.
Enjoy your new high quality preview images.

Notes.

#1 The issue is found only in installations which were upgraded to PHP Melody v2.3 (before April, 2015). Newer installations should not be affected by this issue.
#2 If there are still problems with your preview images, please contact customer support.