Support » Plugin: People Lists » [Plugin: People Lists] Executing PHP in a template

  • Hi

    I am working on creating a user list using your plugin, and so far it works great!

    I just can’t seem to get the last pieces of the puzzle to match my needs. I would really like to be able to exec some PHP within the template (I have the Exec PHP plugin installed). More precisely, I would like have a line like this work from inside the template:

    <?php echo get_user_meta( %id%, ‘weapon’, true); ?>

    Using %id% as one of the defaults you supply. I know I could just make the “weapon” field as an added field through your plugin, but it has already been made for all my users, and reconfiguring all of them would be a bore. Can this be done?


Viewing 7 replies - 1 through 7 (of 7 total)
  • BTW…

    The real problem is that somewhere the PHP gets caught and put into a comment instead, and therefore is not received by the Exec PHP plugin.

    The Chrome Inspector shows this line instead:

    <!–?php echo get_user_meta( %id%, ‘weapon’, true); ?–>

    Plugin Contributor Enej Bajgoric


    Hi JamTheMan

    I don’t think you need to do that.
    There is a way to create custom user meta fields in the user profile. and to display them in the template. Have you figured out how to do that? Let me know if the UI is not so straight forward.


    Yeah… I now that… And that btw works great!

    The thing is just that I already have all the extra user details added to the WordPress profiles, with another plugin, and it would therefore be much easier if i could use those values in your plugin, instead of remaking them all…

    This of cause could be done with some rather simple SQL updates, but then it would be great if all the custom meta fields were not added under “Contact Info” in the user profile, but maybe under a new node called “Other Info” or something. Just makes more sense to the users in case the new fields have nothing to do with contact info…

    So if there is no way to allow the PHP to go through, I’ll just have to do it the other way. Thanks in any case—


    Plugin Contributor Enej Bajgoric


    Hi Jam

    I am thinking about adding a filter to the plugin that will allow you to add your own tags and quiery the stuff easier in your case. This way you will be able to extend the plugin for your needs and not worry about modifying it for the future case. I will write a short tutorial that will do that. Would that work for your case?

    Cheers Enej

    Yeah, that sounds like it would be perfect…

    Thanks so much 😀

    Hi Enej,

    Congrats on the great plug-in. I have the exact same need as Jam (to have the ability to render a shortcode from another plug-in into the template).

    You mentioned you were working on adding a filter and writing a short tutorial on how to use this. Have you made any progress on this?


    Plugin Contributor Enej Bajgoric


    Hi aplussideas and Jam

    I am sorry I didn’t post some sort of tutorial earlier. If you look at the code and are compftable with filters. you can use the
    ‘people_list_shortcode’ filter to change the html that is being ouputed to the theme.

    try something like

    add_filter('people_list_shortcode','example_people_list_shortcode',10); //
    function example_people_list_shortcode($html){
    return $html."the end of the template";

    you can also try the ‘people_list_fields_display’ filer
    and the

    look at the code in the file people-list.php starting at line 726 for more info.

    I hope that helps

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: People Lists] Executing PHP in a template’ is closed to new replies.