Tag Info

New answers tagged

1

This is what I ended up with. Totally does the trick, minus the sorting by last name. Would love to hear any additional thoughts on that. $display_admins = false; $order_by = 'display_name'; // 'nicename', 'email', 'url', 'registered', 'display_name', or 'post_count' $role = ''; // 'subscriber', 'contributor', 'editor', 'author' - leave blank for 'all' ...


0

If you want something to behave like a "normal" wordpress author then the best thing to do is to create a "dummy" account for it, and if you really want disable the possibility to login to it. For any other solution that mimics the functionality in other ways you first need to fully understand the functionality you are trying to mimic, and by your own words ...


1

You noted that you are using custom post types. To see if that is the problem: Create a normal "post" for each user (not a custom post type) See if their pages suddenly show up. If so, then more than likely your author page is not set up to show show custom posts. To fix that, you might use something like the following in your funtions.php file (or ...


1

The user meta, including the custom ones, are saved in the wp_usermeta table. You can get all user properties and meta keys using get_userdata( $userid ), an alias of get_user_by( 'id' ) , which returns a WP_User object or false on failure (the user with that ID does not exist). Furthermore, you can determine if a certain meta key or property is set for a ...


3

I think you are confusing function arguments with author (user) meta fields. To get all user meta fields you can use get_user_meta() with empty $key parameter. For example, for user with ID 45: $user_meta = get_user_meta( 45 ); $user_meta will be an array with all meta fields for the user with ID = 45.


0

Do not use query_posts, and for that matter any custom query to replace the main query. It is always problematic and it creates more problems that solving it. Use the main query and make use of pre_get_posts to alter the main query as needed. To solve your issue, remove the query_posts line, this is how author.php should look. <?php ...


0

You might try this: function add_author_edit_link( $wp_admin_bar ) { if ( is_author() && current_user_can( 'add_users' )) { $currentUserID = get_current_user_id(); $args = array( 'id' => 'author-edit', 'title' => __( 'Edit Person' ), 'href' => '/wp-admin/user-edit.php?user_id=' . ...


1

You could try this modification of your code: function add_author_edit_link( $wp_admin_bar ) { if ( is_author() && current_user_can( 'add_users' ) ) { $args = array( 'id' => 'author-edit', 'title' => __( 'Edit Author' ), 'href' => admin_url( sprintf( ...


0

i dont see the problam in using WP_Query... it has an author parameter. $cuser_id = get_current_user_id(); $args = array( 'post_type' => 'campaigns', 'posts_per_page' => 100, 'author' => $cuser_id, ); $the_query = new WP_Query($args); if ($the_query->have_posts()) { while ($the_query->have_posts()) ...


0

By default, you can view posts by authors with a URL of the form {home_url}/author/{author-slug}/ If you'll be writing any PHP and need to output a link to an author's posts, see the function get_author_posts_url. Edit: If you'll be writing your own author post page template, the filename should be one of the following formats: author-{nicename}.php, ...


0

This plugin does the job nicely: https://wordpress.org/plugins/display-name-author-permalink/


0

A partial solution, that addresses the second half of your request -- i.e. limiting the number of posts allowed, on a per-user basis -- would be to use the "Bainternet Posts Creation Limits" plugin.


1

The best way I know of would be to filter the data. For posts, you might do: function my_check_post_not_crazy( $data, $post_arr ) { $max_content_length = 2048; # max length in characters $max_num_posts = 200; # maximum number of posts if ( !current_user_can('activate_plugins') && empty( $post_arr['ID'] ) ) { $die_args ...


3

I would take a different approach to this using a direct database query to get a list of author IDs ordered by recent posts. global $wpdb; $user_ids = $wpdb->get_results( " SELECT DISTINCT post_author FROM $wpdb->posts ORDER BY post_date DESC " ); if ( $user_ids ) { foreach ( $user_ids as $user_id ) { $user = ...


0

The answer is essentially the same as my Edit 2 code. I must have had a typo the first time? I've tried to comment on what each thing does... The code works but the comments could be way off. I'm new at this. Also, this same code should work your author archive. As one helpful person pointed out, this code is really useless and is not at all what Wordpress ...



Top 50 recent answers are included