Jump to content

terungwa

Members
  • Posts

    90
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Interests
    PHP and RUBY programming

terungwa's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. adding this function below to my wp-config.php solved the problem: define('DB_SSL', true); Reference: https://stackoverflow.com/questions/7142632/wordpress-ssl-mysql-is-this-configuration-possible
  2. I have Set Up a Remote Database to Optimize wordpress Site Performance with MySQL on Ubuntu 16.04. I downloaded the wordpress onto my web server. When I Navigate to the public IP address associated with my web server, i get "Error establishing a database connection". With wordpressdebug mode set to true, the details of the error is: Warning: mysqli_real_connect(): (HY000/3159): Connections using insecure transport are prohibited while --require_secure_transport=ON. in /var/www /html/wp-includes/wp-db.php on line 1538 I have tested remote connection using the remote user and I am able to connect. This means my database server is running and my remote user credentials are also correct. What may be causing this and how can I resolve this?
  3. I have created a phone number as Buddypress Profile field. I need to check that no two or more user accounts share the same phone number. My query below is not enforcing the restriction. I need help to resolve this. function bp_phone_number_validate() { global $bp; global $wpdb; // check if phone number is in use $result=$bp->get_var("SELECT COUNT(*) FROM {$bp->profile->wp_bp_xprofile_data} WHERE value = '{$_POST['field_2']}' GROUP BY id;"); if($result > 0){ $bp->signup->errors['field_2'] = __( 'Phone number is already in use.', 'buddypress' ); } } add_action( 'bp_signup_validate', 'bp_phone_number_validate');
  4. I have used this tutorial here (https://codex.wordpress.org/Integrating_WordPress_with_Your_Website) as a guide to set up non-wordpress pages to access some wordpress resources on non-wordpress pages. Eg I can view wordpress posts on non-wordpress page. I have wordpress installed in a sub-folder( ./root - PHP pages ./root/wordpres - Wordpress installation} In addition, I need to be able to detect if a user is logged into wordpress on the non-wordpress page. I am using this code below on non-wordpress pages for that: if(is_user_logged_in()){ $current_user = wp_get_current_user(); /** * @example Safe usage: $current_user = wp_get_current_user(); * if ( !($current_user instanceof WP_User) ) * return; */ echo 'Username: ' . $current_user->user_login . '<br />'; echo 'User email: ' . $current_user->user_email . '<br />'; echo 'User first name: ' . $current_user->user_firstname . '<br />'; echo 'User last name: ' . $current_user->user_lastname . '<br />'; echo 'User display name: ' . $current_user->display_name . '<br />'; echo 'User ID: ' . $current_user->ID . '<br />'; echo get_avatar( $current_user->user_email, 32 ). '<br />'; echo '<hr />'; } else{ echo 'Not logged-in'; } Even though I am logged into wordpress, when I navigate to the non-wordpress page, I see wordpress posts listed but, the is_user_logged_in() function returns false and prints 'Not logged-in'!!! Is there a way of achieving this besides the approach I have adopted? I need guidance to resolve this.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.