Article suggestions
  1. Home
  2. Section: Developer Hub
  3. Important $w Array Update

Important $w Array Update

Important $w Array Update
  • avatar
Written by Chan Nier
Updated on February 19, 2025

 Link: https://support.brilliantdirectories.com/support/solutions/articles/12000048956

As of November 1st, 2018, several keys found in the $w array will no longer be available in this array and will only be available through the new static method brilliantDirectories::getDatabaseConfiguration() for enhanced security.

IMPORTANT: If there is any custom code on your website that makes reference to these keys in the $w array, please make sure to update those references following the instructions below before November 1st, 2018 to avoid any issues.

Here is the list of keys that will be impacted:

  • website_user
  • website_pass
  • database_user
  • database_pass
  • database_host
  • database
  • database_directory_user
  • database_directory_pass
  • whmcs_database_host
  • whmcs_database_user
  • whmcs_database_password
  • whmcs_database_name
  • whmcs_api_password
  • whmcs_api_host
  • whmcs_api_username

Updating References to These Keys

The brilliantDirectories::getDatabaseConfiguration() static method is available as of the writing of this article (September 4, 2018), and the keys will remain accessible in both the $w array and the new static method over the next 8 weeks so websites have the opportunity to update any custom widgets, files, member features / Post Types, or other code that are currently referencing these keys in the $w array.

All of the keys will follow the same naming convention, but will be accessed using the static method instead.

To update a piece of code, simply replace the reference to the key in the $w array by sending the key as a parameter in the brilliantDirectories::getDatabaseConfiguration() method.

For example, a reference to the website_user key in the $w array like this:

$w['website_user']
PHP

or like this:

$w[website_user]
PHP

would be updated by sending this same key as a parameter to the static method brilliantDirectories::getDatabaseConfiguration():

brilliantDirectories::getDatabaseConfiguration('website_user')
PHP

As another example, let's take this piece of code referencing the 'database' key in the $w array:

$membersQuery = mysql($w['database'],"SELECT 
        * 
    FROM 
        `users_data`");
PHP

Using the new static method, it would be updated to the following:

$membersQuery = mysql(brilliantDirectories::getDatabaseConfiguration('database'),"SELECT 
        * 
    FROM 
        `users_data`");
PHP

Thank you for leaving a rating!
Did you find this article helpful?
0 out of 0 people found this article helpful so far
Can't find what you're looking for? Get in touch
How can we help?
Send your question below and we'll get back to you as soon as possible.
Cancel
translation missing: en.kb.default.contact_form_error
×
Thanks for your message!
Thanks for your message!
×