Replies
- Brajesh Singh on October 22, 2015 at 1:32 pm in reply to: [Resolved] Username Availability Checker and WP-Members by Chad Butler #1093
Hi Hans,
Thanks for opening the topic. And yes, you read that right, It will be easy to make it work with any plugin. I was planning to show some examples for woocommerce/easy digital download but then stopped.Please send me the details and I will post code 🙂
- Brajesh Singh on October 22, 2015 at 12:05 pm in reply to: [Resolved] Add member name (@MemberName) under title on thumbs #1091
Btw, For shortcodes, the equivalent hook is
mpp_before_media_shortcode_item mpp_after_media_shortcode_item
instead of
mpp_before_media_item mpp_after_media_item
The ‘mpp_before_media_item’ is used on single gallery loop. For widgets, in the same way the hooks are
mpp_before_media_widget_item mpp_after_media_widget_item
Hope that helps.
- Brajesh Singh on October 22, 2015 at 12:01 pm in reply to: [Resolved] Add member name (@MemberName) under title on thumbs #1090
Hi Johan,
Thank you.I will post the code with explanations then. Also, if you need any help doing a custom Media Query, please do let me know. It is very simple(just like WP_Query)
1. To get the uploader user id inside the loop, we can use the following function
$user_id = mpp_get_media_creator_id();//get the id of user who uploaded this media
If you are not inside the loop, you can pass media id or object to that function like
$media_id = 32; $user_id = mpp_get_media_creator_id( $media_id );//accepts id or MPP_Media object or attachment post object
So, we are done with the user id part.
2. In BuddyPress, there are multiple ways to link to user.
Easiest way is to use
bp_core_get_userlink( $user_id )
That gives a link to the user profile with his/her Name linked
so, we can use it like this
echo bp_core_get_userlink( mpp_get_media_creator_id() );
If you are interested in linking to the username instead( Using username as the link label instead of the full name), we will need 2 functions, one for getting url of the user and another to get the username. Those are easy and there are again multiple way
$url = bp_core_get_user_domain( $user_id );//will return a ulr like http://site.com/members/xyz/ $username = bp_core_get_username( $user_id );// returns username e.g 'admin', 'sbrajesh' etc
So, we can build a link with them like this
<a href="<?php echo bp_core_get_user_domain( $user_id );?>"><?php echo bp_core_get_username( $user_id );?></a>
That will give us a link to the username if we decide to choose this method. we can write it inside a function and pass the user id to get the link
Now, the last part is to display the link in the media loop
Here, you will need to decide whether you are going to use the shortcode or creating a custom loop yourself.
If you are using a shortcode, we can hook to action ‘mpp_after_media_item’ and echo the user link. If you are using the custom query, you can list the username where you want.
Here is an example using the hook
add_action( 'mpp_after_media_item', 'mpp_custom_add_user_link' ); function mpp_custom_add_user_link() { //you may put some conditions here like //mpp_is_single_gallery(); //mpp_is_single_media(); //to avoid showing it on single gallery/media pages $user_link = bp_core_get_userlink( mpp_get_media_creator_id() ); echo $user_link; }
Though it is possible to filter title of media using the hook ‘mpp_get_media_title’, title is not always displayed( you might have already noticed it for photos, also, titles are linked and putting a link inside link will generate invalid html ). You can put some text though.
Another action that might interest you is ‘mpp_before_media_item’, it is same as ‘mpp_after_media_item’ except that it is called before showing the media content.
Hope that helps.
- Brajesh Singh on October 22, 2015 at 11:22 am in reply to: Localization of site wide activity plugin? #1087
That will be my mistake. I missed updating the widget UI while concentrating on the list display.
Thank you for letting me know, will need to update it again today.
- Brajesh Singh on October 22, 2015 at 11:21 am in reply to: [Resolved] Language files not "taking" #1086
Hi Jan,
Thank you for updating. You are right the old po file was not updated. Will do an update and push today.Thank you
Brajesh Thank you John.
Will be testing and getting back to you in next couple of hours.- Brajesh Singh on October 22, 2015 at 11:18 am in reply to: [Resolved] Add member name (@MemberName) under title on thumbs #1084
Hi Johan,
Welcome to BuddyDev forums and thank you for using MediaPress.That will be very easy( 3-5 lines of code at most ) but I need to understand the rationale correctly.
When a user is seeing a gallery, they already know whose gallery they are seeing, isn’t that correct? So, can you please explain me the need. If it is just for vanity, I will avoid as each time we link to username, it will be a few extra calls.
Please let me know and I will post the code.
Thank you
Brajesh - Brajesh Singh on October 22, 2015 at 6:16 am in reply to: [Resolved] Language files not "taking" #1079
Hi Jan,
No problem.
Is it working now? Should we mark this topic close then? PS: The form actually reloads but may not look like that. When ever you press submit button, the form is always reloaded. The UI may not reflect that if your server is fast.
Hi John,
I am sorry I missed the post due to site upgrades going on here.Can you please tell me which captcha plugin are you using? We may need to trigger some function to reload the captcha.
I will do a quick check and provide a solution after you let me know the plugin.