Link to Authors blog posts

the_author_ID() says in Codex: It displays the unique numeric user ID for the author of a post; the ID is assigned by WordPress when a user account is created. This tag must be used within The Loop. So, it won’t work. Try using the following code* within a loop: <li class=”author vcard”> <a class=”url fn … Read more

Designing a member area on my site

If you never heard of WordPress, you can have an overview at the Codex in Getting Started with WordPress and explore the topics as the need arrives. G.M’s linked Answer has very nice information for your use-case, and sample code with advanced techniques. Worth bookmarking. To get really started, learn how to make a Child … Read more

Add a column before username in the users profile table

Ok, I solved it by unsetting $defaults and reconstructing it after adding the company function add_company_column($defaults) { unset($defaults); $defaults[‘company’] = __(‘Company’); $defaults[‘username’] = __(‘username’); $defaults[‘name’] = __(‘Name’); $defaults[’email’] = __(‘Email’); return $defaults; }

Validate user meta and redirect

Here is how I would do it: function save_extra_user_profile_fields( $user_id ) { if (!isset($_POST[‘address’]) || empty($_POST[‘address’])) { // this field was not set or was empty // do your action wp_redirect( home_url() ); // or profile page exit; } else { // field was set and contains a value // do your action update_user_meta( $user_id, … Read more

Creating Custom user type just like custom post

Well, Roles are in many ways custom user types and you can add meta fields specific to roles. For example… function is_my_user_role($id = null) { global $profileuser; if (empty($profile) && !empty($id)) $profileuser = get_user_to_edit($id); return (in_array(‘myrole’,$profileuser->roles)) ? true : false; } function my_user_fields($profileuser) { if (!is_my_user_role()) return false; // HTML for the fields } add_action(‘show_user_profile’, … Read more

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