List Users Members with Badges
-
HI !
I wonder,
is it possible to have a page with list members (name, avatars and other choose infromation) AND badges ?If anyone has already done yet, what plugin did you use for that ?
Thanks ??
-
Hi again,
I suppose the best way is to writte the a meber list plugin myself, using this indication.
But how could I add the badges ? ??
I took a lot in the API but i’m not really a php developper so i’m a bit lost.
Any help is welcome ??
Thanks !
how comfy are you with php? I have an idea but it’d take some editing on your own to execute.
To be honnest, I’m a beginner,
but I will try as hard as I can before searching for help ??On the link I gave before, there was a comment on a modified version of the plugin.
This version is called Simple User Listing and has separated .php files in order to be more customizable.The developper helgatheviking told me that if the badge are linked to user ID I should be able to display badges in the list.
But I have to admit that I need a bit more help in order to put the pieces together ?? I’m ready to hear your advices.
Must I create plugin ? Must I create a function ? Must I edit the listing plugin itself ?It can interest a lot of people using BadgeOS : a page with all members and their badges, it’s pretty nice ??
I will be happy to share the solution if I find it ??Well, let’s try this route first.
I am trusting you will be fine with copying the necessary template files, from this plugin you reference, into your own theme for safekeeping. So I won’t go over that part.
I have this: https://gist.github.com/tw2113/8938fc63cba580ba093d
It’s a custom function that I am borrowing from a shortcode I have done up in the past. It’s going to take an array with 3 different indexes in it. It’ll go in your theme’s functions.php file so that it’s available to use.
Example:
array( 'user' => 'X-Raym', 'type' => 'badges', 'limit' => 10 )
You will need to echo the function, and below is a complete example using what’s above:
echo custom_badgeos_user_achievements_list( array( 'user' => 'X-Raym', 'type' => 'badges', 'limit' => 10 ) );
The exact order doesn’t matter, as it will be taken care of inside the function, but it does need to have the ‘something’ => ‘value’ syntax for each of the 3.
It will output the following markup, as is, unless you change it yourself. Placeholder values are used to keep the example short. Imagine a limit of 1 for the moment.
<div class="badgeos-user-badges-wrap"> <div class="badgeos-badge-wrap"><img alt="Achievement image" src="" /> <span class="badgeos-title-wrap">Achievement Title</span> </div> </div>
The badgeos-badge-wrap div would be repeated for each achievement it’s set to show, default of the latest 5 unless you change that.
Hopefully this is making sense to you, but let me know if any part is unclear. Tried to keep the code as simple as possible and understandable as possible.
Thanks for diggin in it ??
I will test that as soon as my new domain is accessible, and I will told you if I succeed !
Answer in few days.Thanks again ??
I was wondering if you could advise me – I want participants of a conference to be able to add an image saying they are attending this event. I have several different ones available for them to use and have tried to add the code for them to copy and paste but it isn’t working. I have the image with this under it to copy and insert onto their own page:
<p style="text-align: center;"><textarea cols="40" name="textarea" rows="4" wrap="VIRTUAL"><a href="https://www.blissdomcanada.com"><img src="https://blissdomcanada.com/wp-content/uploads/2014/07/lookinggrey.png"></a><br /><br /><br /><br /> </textarea>
If I should not be asking here I apologize. Any help would be greatly appreciated.
@cariharris : This is not the right place for this, we are talking here about a specific award plugin: BadgeOS ??
@michael : I just succeed !
That was actually pretty simple, once we started to know php ??Here is the core code I put on content.php from Simple User Listing :
<?php echo custom_badgeos_user_achievements_list( array( 'user' => $user->ID, 'type' => 'badges', 'limit' => 10 ) ); ?>
(I don’t give the rest of my content.php page cause I don’t think it is useful).
(I will surely try to enhance that with link on the image, block positioning etc…)As you can see, it uses your function for this ??
Thanks again for your help, it took me a bit a time cause I had to learn PHP basics first ??
Note : meanwhile, I found an other promising list user plugin called amr users, which provide more user friendly way to customize field, several lists, ability to change order, table view, field detection etc…
It is not BadgeOS Badge Image ready yet, as I report on the support forum, but it can definitely be an interesting thing to think about.
A native compatibility with BadgeOS and LearnDash would be awesome ??I love to exploit all the possibilities to their maximum ??
Excellent to hear.
Firstly, excellent post. I had a similar problem with a few variations and struggled to get up to speed myself with everything. Finally came to a similar conclusion, details here:
Problem: I want the BadgeOS badges to appear in the automated BuddyPress ‘Members’ page.
Issues I experienced when working through the comments and my solutions:
1)
I am trusting you will be fine with copying the necessary template files, from this plugin you reference, into your own theme for safekeeping. So I won’t go over that part.
– I didn’t understand from this that I needed to copy the Members directory from the BuddyPress plugin directory to my Theme’s directory. This meant I was working on the wrong members-loop.php file. Further information about this here: https://codex.buddypress.org/themes/theme-compatibility-1-7/
2)
I used the function created by Michael but I kept getting some form of error – “Parse error: syntax error, unexpected ‘$args’ (T_VARIABLE) in…”. Debugged in Dreamweaver ok, realised it was a ‘space’ on every empty line. Once I deleted them it worked fine. Also I didn’t need the initial ‘<php’ tag as my functions.php already had one and it seems I needed to use it. I placed the function at the bottom of the document.3) I finally got it ‘working’ only to realise that it gave the achievement of the logged in user rather than each users specific achievements. I only wanted 1 badge to show (my badge types are called ‘rank’) and I had to use bp_get_member_user_id() for the users. I finally managed to tweak X-Raym’s echo to the following:
<?php echo custom_badgeos_user_achievements_list(array('user' => bp_get_member_user_id(), 'type' => 'rank', 'limit' => 1));?>
4) I wanted the latest badge to show from one type of achievement but the function always returned the first badge. Rather than rewrite the function to incorporate some form of descending sort, I am using a workaround where I revoke old ranks so only one exists for any user (actually more useful to me anyway).
5) I just need to format it now. Hoping to use the following forum for help (they directed me to the hyperlink in point 1): https://premium.wpmudev.org/blog/how-to-create-a-custom-buddypress-members-directory/
Cheers to both Micahel and X-Raym. I’m not one for contributing to forums like this but as the posts are so recent and so helpful I thought the time has come to share.
Hi mark !
Thank you for your answer and your interest ??
I can’t help you with this, But I want to tell that you that there is hope :p
I manage to have a user list in a resposinve table, with collapsing columns (that become lines), touch friendly, sortable, with an ajax search field, with badge + badge-title tooltip + badge permalink, badge count + total point. It tooks me days cause I’m a php beginner, but the core code is the shortcode given by Michael.the big difference bewteen your project and mine is that I don’t use buddypress
I will post screenshots then it would be polished.
Cheers ??
- The topic ‘List Users Members with Badges’ is closed to new replies.