WordPress.org

Ready to get started?Download WordPress

Forums

People Lists
Add custom fields (8 posts)

  1. Naz
    Member
    Posted 3 years ago #

    I absolutely love this plugin, but would love to know if (and how) it is possible to add custom profile fields to the People Lists plugin. I'm not talking about the custom fields you can create using People Lists, but custom fields I've created in the functions.php file.

    I'd love to use the following code in one of my People Lists:

    <a href="http://twitter.com/<?php the_author_meta( 'twitter' ); ?>" title="Follow <?php the_author_meta( 'display_name' ); ?> on Twitter" target="_blank">Follow @<?php the_author_meta( 'twitter' ); ?> on Twitter</a>

    I'd really appreciate it if someone could help me with this. Thanks!

    Edit: I sort of fixed this myself. For anyone who wants to know: I edited the people-lists.php file, went to line 637 and added:

    $input_template[11] = "%twitter%";

    I scrolled down to line 663 and added:
    $replacements[11] = $user_data->twitter;

    Still, I'd love to see this added as a feature. Thanks!

    http://wordpress.org/extend/plugins/people-lists/

  2. enej
    Member
    Plugin Contributor

    Posted 3 years ago #

    Hi Naz

    There should be really no need for us to add the twitter user name fields. You can add to user profile by going to the "Profile Settings"
    You can find them under
    Dashboard -> Setting -> People Lists

    Next to the View all lists link.
    There you can add as many profile fields as you like.

    Thanks

  3. francodag
    Member
    Posted 3 years ago #

    Hi enejb
    the problem I've found with the People Lists custom fields functionality is that I can add only text fields.

    In the website that I'm currently creating I need to add some custom fields as listbox, than I've canged the people-lists.php adding my meta fields to the default fields array with the get_user_meta function:

    $replacements[$counter] = get_user_meta($id, 'my_meta_field', true);

    I think is good improvement to add in the template editing page, the possibility to select also from meta fields like "Member List" plugin.

    For now I've graven my meta fields in the people-lists.php but I'm sure I'll have to work to make it customizable, in this case I will be happy toshare my work.

    Thanks

  4. listingwarebob
    Member
    Posted 3 years ago #

    I guess I'll go on record on the output of custom fields. Yes, we can use your plugin to create extra fields and output them easily, but it would be nice if your template could be made to output user metadata gathered through other plugins.

    Your plugin is great at what it does, but there are others like Cimy User Extra Fields and Members that are built for the purpose of taking in custom fields also. Because yours has the nice Template feature for displaying user info, it would be nice if we could just reference metadata from any source, not just the fields you're creating.

    Of course I'd be happy to donate to your development time if this were added. Just my two cents. Thanks.

  5. enej
    Member
    Plugin Contributor

    Posted 3 years ago #

    Hi listingwarebob and francodag.
    I am planning to add some filters to the plugin that will allow you to extend the functionality. And I will add a tutorial somewhere that will explain how to do that. would that work for you?

    Btw. I looked into Cimy User Extra Fields and it creates some unnecessary tables in your database which I think are completely unnecessary. It would be better if it used the default wordpress tables.

  6. listingwarebob
    Member
    Posted 3 years ago #

    It does sound good that we could use the additional field filters. I look forward to seeing it.

    As for the extra tables with Cimy User Extra Fields - I may dig in and check those out too.

  7. enej
    Member
    Plugin Contributor

    Posted 3 years ago #

    Hi listingwarebob

    I updated the plugin for some reason the readme file is not updating.
    here is a short tutorial on how you can use the filters

    <?php
    /* test filters */
    add_filter("people_list_custom_fields",'test_display_custom_fields');
    function test_display_custom_fields($array){
    
    	$array[] = "%this%"; //this is the string that is displayed in your template
    	return $array;
    }
    
    add_filter("people_list_fields_display",'test_display_field',10,3);
    function test_display_field($display_list,$user, $list)
    {
    	// $user // not being used but is the user object from the of a particular user.
    	// do doing something like $user->ID try something like var_dump($user) to see the whole object
    
    	// $list refers to a particular list and is the variable used
    	// this way you can target a particular list
    	$display_list[] = "replace text"; // this is the text that is
    	return $display_list;
    }
    ?>
  8. unp0ssible
    Member
    Posted 2 years ago #

    This tutorial teaches how to make a wordpress member list with pagination and custom fields and gravatars: http://we.bsit.es/wordpress/2011/12/how-to-make-a-wordpress-member-list-with-custom-fields-and-import-a-csv-user-list/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic