Using xprofile_insert_field

Your code does work. It’s just that you are declaring $xfield_args after you have made the call xprofile_insert_field( $xfield_args ); it should look like this add_action(‘bp_init’, ‘field_xprofile_twitter’); function field_xprofile_twitter() { global $bp; $xfield_args = array ( field_group_id => 1, name => ‘Twitter’, can_delete => false, field_order => 1, is_required => false, type => ‘textbox’ ); … Read more

Update user meta without lose of old data

If I understand problem correctly, you want to store name of multiple files in user meta field. add_user_meta function has fourth argument $unique which is false by default that means for each call to add_user_meta a new key-value pair is added, even if key already exists. add_user_meta has less clarification then the add_post_meta that does … Read more

Order By Meta_key but convert custom date to Y-m-d first

I actually found a cool value for the orderby option in this case. meta_value_datetime It works the same as using strtotime and the date methods in PHP. So here is my final code that started working: $wp_query=new WP_Query(array ( ‘post_type’ => ‘sermon’, ‘meta_key’ => ‘sermon_date’, ‘orderby’ => ‘meta_value_datetime’, ‘order’ => ‘DESC’, ‘posts_per_page’ => -1 ) … Read more

Displaying field value in new column in users view on wordpress

Use this function to register a new column in the users table: function users_custom_columns( $column ) { $column[‘security_answer’] = ‘Security Answer’; return $column; } add_filter( ‘manage_users_columns’, ‘users_custom_columns’ ); And this function to display the new custom column: function display_users_custom_columns( $val, $column_name, $user_id ) { switch ($column_name) { case ‘security_answer’ : return get_user_meta( $user_id, ‘meta_key’, true); … Read more

Fetch user related data

I use this function on functions.php in all my development websites function imp($a){ echo ‘<pre>’; print_r($a); echo ‘</pre>’; die(); } now just use imp($user); where you are using get_user_meta ($user->ID). you will have all the info about the $user, maybe this will tell you the answer you need… You will find inside an object with … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)