Displaying additional User Contact Information

This might help you out if you haven’t found an answer yet. /* BEGIN Custom User Contact Info */ function extra_contact_info($contactmethods) { unset($contactmethods[‘aim’]); unset($contactmethods[‘yim’]); unset($contactmethods[‘jabber’]); $contactmethods[‘facebook’] = ‘Facebook’; $contactmethods[‘twitter’] = ‘Twitter’; $contactmethods[‘linkedin’] = ‘LinkedIn’; return $contactmethods; } add_filter(‘user_contactmethods’, ‘extra_contact_info’); /* END Custom User Contact Info */ Displaying it: <a href=”https://wordpress.stackexchange.com/questions/32505/<?php the_author_meta(“facebook’, $current_author->ID); ?>”></a> http://thomasgriffinmedia.com/blog/2010/09/how-to-add-custom-user-contact-info-in-wordpress/

Display site admin profile fields in header.php

Ok I figured a way to do it. If anyone else is interested, here’s the code. It first gets the user id of the admin of the blog, and then it uses the id to pull the meta from the profile fields. For one field — <?php $thisblog = $current_blog->blog_id; $user_id_from_email = get_user_id_from_string( get_blog_option($thisblog, ‘admin_email’)); … Read more

How to add country drop down menu to the user profile?

Try this /* Save selected data */ add_action( ‘personal_options_update’, ‘save_user_fields’ ); add_action( ‘edit_user_profile_update’, ‘save_user_fields’ ); function save_user_fields( $user_id ) { if ( !current_user_can( ‘edit_user’, $user_id ) ) return false; update_usermeta( $user_id, ‘country’, $_POST[‘country’] ); } add_action( ‘show_user_profile’, ‘Add_user_fields’ ); add_action( ‘edit_user_profile’, ‘Add_user_fields’ ); function Add_user_fields( $user ) { ?> <h3>Additional Field</h3> <table class=”form-table”> <tr> <th><label … Read more

update_user_meta adding new rows in db for same key

Try this: global $current_user; $user_id = $current_user->ID; // current user ID $meta = get_user_meta( $user_id, ‘title’, ‘Manager’ ); // subject meta if($meta != ”) // updates meta if exists update_user_meta($user_id, ‘title’, ‘Manager’); else // creates new meta if not exists add_user_meta($user_id, ‘title’, ‘Manager’);

How to get top 10 user is based on user meta value

I guess you can do with get_users, something like: $topusers = get_users( array ( ‘meta_key’ => ‘todayuserclicks’, ‘meta_value’ => ”, ‘meta_compare’ => ‘!=’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘DESC’, ‘number’ => ’10’, ) );

Upload files programmatically to users

it was just missing $upload_dir[‘path’] . “https://wordpress.stackexchange.com/” . $upload_file_name in $uploaded_file[‘attach_id’] = wp_insert_attachment($attachment, $upload_dir[‘path’] . “https://wordpress.stackexchange.com/” . $upload_file_name); require_once(ABSPATH . ‘wp-admin/includes/image.php’); //Generate the metadata for the attachment, and update the database record. $attach_data = wp_generate_attachment_metadata($uploaded_file[‘attach_id’], $upload_dir[‘path’] . “https://wordpress.stackexchange.com/” . $upload_file_name);

Exclude main blog from get_blogs_of_user

If you drop this line in your code, you will see all the properties of $user_blogs. echo ‘<pre>’.print_r($user_blogs,true).'</pre>’; One of them is userblog_id, so you just have to check against it before echoing the blogname. <?php $user_blogs = get_blogs_of_user( $user_id ); if (!$user_blogs) { echo ‘no blogs’; } else { echo ‘<div><ul>’; foreach ( $user_blogs … Read more

Can I create front-end editable user profile pages with WordPress? How do I do it?

Rarely do I answer question with simply a plugin recommendation – and I’d never recommend a commercial one – but since there’s a really good plugin for the task of front end profiles/login and such out there, I cannot let it go unmentioned: Check out Theme-My-Login by Jeff Farthing. There ain’t no better solution. It’s … Read more

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