Category Archives: wordpress

Run Multiple Domains with One WordPress Instance

Option 1: Explicitly Define the Domains

if ($_SERVER['HTTP_HOST'] == 'www.mywebsite.com') {
    define('WP_SITEURL', 'http://www.mywebsite.com');
    define('WP_HOME',    'http://www.mywebsite.com');
} else {
    // this is the default that shows up if someone visits your site
    define('WP_SITEURL', 'http://www.mywebsite.net');
    define('WP_HOME',    'http://www.mywebsite.net');
}

Source: Run Multiple Domains with One WordPress Instance – WPLauncher

How to make WordPress Twenty Fourteen theme full width

How to make WordPress Twenty Fourteen theme full width

Whilst refreshing a client’s WordPress site, I felt the WordPress Twenty Fourteen theme had too much white space. As with many things in our connected world, I was not the first and someone already had a solution.

A fairly simple process:

  1. Locate the theme style.css (in the wp-content/themes/twentyfourteen folder) file and look for the following code and modify the max width to 100% instead 1260px.

    .site {
    background-color: #fff;
    max-width: 1260px;
    position: relative;
    }

  2. Find the following piece of code and again modify the max-width to 100% instead 1260px.

    .site-header {
    background-color: #000;
    max-width: 1260px;
    position: relative;
    width: 100%;
    z-index: 4;
    }

Source: How to make WordPress Twenty Fourteen theme full width – Technical and Management Consulting

Create a WordPress admin user with SQL

Create a WordPress admin user with MySQL

If you’ve ever been locked out of a WordPress installation, but have access to the database, here’s a nifty snippet to grant you administrator-level access. There are a couple of things you need to do before using this MySQL code. First, set the variables to your own information. Next, if your WordPress installation is based on a non-standard wp_ table prefix, you must find/replace ‘wp_’ with your current table prefix.

SET @id = 99;
SET @user = 'username';
SET @pass = 'password';
SET @email = 'email@ddress';
SET @name = 'Your Name';
INSERT INTO  wp_users (ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name) VALUES (@id, @user, MD5(@pass), @name, @email, '', '2013-06-20 00:00:00', '', '0', @name);
INSERT INTO  wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, @id, 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO  wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, @id, 'wp_user_level', '10');
INSERT INTO  wp_usermeta (umeta_id, user_id, meta_key, meta_value) VALUES (NULL, @id, 'active', '1');

Source: Coderrr | Create a WordPress admin user with MySQL – Coderrr

Make the BP Non Editable Profile Fields Truly Non Editable • WordPress & BuddyPress Support Forums | BuddyDev

function bpfr_hide_profile_edit( $retval ) {

  // remove field from edit tab
   if ( bp_is_user_profile_edit() ) {
     $retval['exclude_fields'] = '2'; // field IDs separated by comma
   }

  // allow field on register page
  if ( bp_is_register_page() ) {
    $retval['include_fields'] = '2'; // field IDs separated by comma
  }

  // hide the field on profile view tab
  if ( $data = bp_get_profile_field_data( ‘field=2’ ) ) :  /// Joel MMCC: Does this also need to be changed, and if so, how for multiple fields?
    $retval['exclude_fields'] = '2'; // field IDs separated by comma
  endif;

return $retval;
}

Source: Make the BP Non Editable Profile Fields Truly Non Editable • WordPress & BuddyPress Support Forums | BuddyDev

Topic: How to Get User Profile Data · BuddyPress.org

During a recent project, I needed to get certain User Profile Data to be used. This was used outside any loops and not on the Profile page. Hopefully this will help others seeking the same information.

To obtain the default data (such as User ID, User Login, ect) use the following:
`global $bp;
$the_user_id = $bp->loggedin_user->userdata->ID;
$the_user_login = $bp->loggedin_user->userdata->user_login;`

Userdata values include:
ID
user_login
user_pass (this is encrypted MD5 Hash)
user_nicename
user_email
user_url
user_registered
user_activation_key
user_status
display_name

To get field data from extended profile fields for the current logged in user, use the following:
`$the_first_name = bp_get_profile_field_data(‘field=First Name&user_id=’.bp_loggedin_user_id());
/* Change field name to the one you added to the profile, or if you know the field’s #, you can use that instead. */

Source: Topic: How to Get User Profile Data · BuddyPress.org