WordPress User Profile Plugin | UserPro Forums Tutorials / Integrations / How-to Integrating UserPro with your theme comments!

This topic contains 120 replies, has 48 voices, and was last updated by  Peter Davenport 8 months, 4 weeks ago.

Viewing 15 posts - 1 through 15 (of 121 total)
  • Author
  • #14211


    This guide will help you show the user profile picture, profile link, user badges and display name to your comments.

    Each theme is different but often you have a comments.php file, open that file and find this part:

    The callback will be different for each theme, so you just need to find this function inside your theme files, in my example, I am using the dream-theme and the callback presscore_comment is located in functions.php this can be different for each theme though. The callback function includes your actual comment template.

    Once you locate this function, edit the following parts to in the function to replace existing comments and integrate UserPro stuff in it. Here are steps:



    You must define this line global $userpro; just after the callback function has started. In my example, It looks like this:



    Change the part that displays user avatar in your comments to:

    This short line will display user avatar, 60 is the size you want. You can customize the comments avatar size using this option. That’s it for the avatar, UserPro avatars now integrated in comments.



    Find the part that displays comment author link or name and replace it with this function:

    What did we do? Simply we need to check if the commenter has an ID (profile) by testing $comment->user_id, then we display his permalink, and profile data (display name) that’s all. If he does not have an account, the normal author link will display.



    To display user badges in your comments, simply add this code to your comments function where you want to show the badges (This can be different for your needs) maybe beside commenter name is a good option. So you just need to insert the following snippet to show the badges for any registered user!!

    That will show the user badges for comment author. Ofcourse you need to check that he is not a guest using $comment->user_id check.

    If anyone has any specific question, or want to extend this tutorial, feel free to write! :)

    • This topic was modified 1 year, 2 months ago by  admin.
    • This topic was modified 1 year, 1 month ago by  admin.
    • This topic was modified 1 year, 1 month ago by  admin.

    Hi !

    Excellent guide, but i’m using a plugin (Commentator on CodeCanyon) for my comments.

    Here is the code with callback functions :

    I’ve tried a lot of things with no succes ! If anybody here can help me it will be really great :) Thx a lot !

    There is some mistakes with the copy/past, but I guess you understand where are the functions.

    • This reply was modified 1 year, 1 month ago by  Nexnivis.
    • This reply was modified 1 year, 1 month ago by  admin.

    I see the code has get_avatar() already to display custom thumb. What did you try please, or what exactly do you want to integrate? I am not familiar with that plugin. So I need more info about what you expect, and what code did you try


    I do not get the correct avatar in the comments, I get the default avatar (male or female) as this user did not upload their own avatar. I also love the avatar and username link to profile! And finally, I would like the verified badge appears next to the user name!

    I managed to do it with the native commenting system but I can not do with this addon!

    This addon is new, it was launched a few days ago, but already a lot of people are interested and many of us ask the author if the addon is compatible with yours.


    Okay, lets take it one by one. To show the badges for any user. Add this where you want badges to appear (maybe beside username)?

    <?php echo userpro_show_badges($idUser); ?>

    However, it’s not clear why he use current user info and not commenter info. I’d prefer if he could email me to explain to me how his logic works.


    Here is the plugin Commentator, if you want more informations about it :)

    I’m going to try adding the badges !


    I have just informed the author of the “Commentator WordPress Plugin” via PM in regards to this thread here. Hopefully he will contact Ahmed very soon. I am also interested to combine this plugin with UserPro! ;)

    Best regards,


    Thanks keyhanjun, great idea :)


    ummh that if UserPro does not release its own elegant like/comment system already ;)


    Now I am all ears! ;)



    Yes, if you are talking about creating a comments feature that evolves into a forum.. maybe????

    Of course, a comment system alone would be great, fabulous in fact..


    Hi, I have tried this but unfortunately I am using theme Enfold from ThemeForest and the code doesn’t look anything like what you gave as an example. It’s a bit modified and mixed with the standard WordPress comments.php so it’s very difficult to know what to replace with what. Is there any way you can help me if I give you the code? Thanks in advance.


    If you email me the comments file, I can tell you which parts to replace.


    Done :)



    I’m trying integrate comments link but I’m getting an error like this:

    Fatal error: Call to a member function permalink() on a non-object in /XXX/wp-content/themes/Newspaper/comments.php on line 115

Viewing 15 posts - 1 through 15 (of 121 total)

The forum ‘Tutorials / Integrations / How-to’ is closed to new topics and replies.