Replies
- Brajesh Singh on January 6, 2018 at 8:02 pm in reply to: [Resolved] Buddypress – How to Hide / Restrict Primary Name field? #12722This reply has been marked as private.
Hi Monsur,
I am sorry, I forgot about it. Will test today and get back to you.regards
BrajeshHi Rossini,
what you are looking for isPlease take a look at the template for all available options.
- Brajesh Singh on January 6, 2018 at 9:31 am in reply to: [Resolved] Adding a gallery automatically on post creation #12717
Hi George,
Here is an example that creates a gallery each time a post is published/** * Auto Create Custom photo gallery when new post is created. * * @param int $post_id post id. * @param WP_Post $post post object. */ function mpp_custom_create_update_associated_gallery( $post_id, $post ) { // Only test for already published posts. if ( 'publish' != $post->post_status ) { return; } // we only want to create gallery for 'post' post type // change 'post' with your own post type name. if ( 'post' != $post->post_type ) { return; } $associated_gallery_id = get_post_meta( $post_id, '_mppc_associated_photo_gallery_id', true ); $user_id = $post->post_author;// or should we use get_current_user_id() ? if ( $associated_gallery_id ) { // wht do you want to do? // return; } // if we are here, the gallery does not exist, let us create it. $gallery_id = mpp_create_gallery( array( 'creator_id' => $user_id, 'title' => $post->post_title, 'description' => '', 'status' => 'public', 'component' => 'sitewide', 'component_id' => $user_id, 'type' => 'photo', ) ); // save a reference to post in gallery meta? // and a reference of gallery to post meta? if ( $gallery_id ) { mpp_update_gallery_meta( $gallery_id, '_mppc_associated_post_id', $post_id ); update_post_meta( $post_id, '_mppc_associated_photo_gallery_id', $gallery_id ); } } add_action( 'save_post', 'mpp_custom_create_update_associated_gallery', 10, 2 );You can update it to match for your own post type.
Hope it helps.Regards
Brajesh Thank you for marking it resolved.
- Brajesh Singh on January 6, 2018 at 9:30 am in reply to: [Resolved] Left Sidebar, Right Sidebar #12713This reply has been marked as private.
- Brajesh Singh on January 6, 2018 at 1:54 am in reply to: [Resolved] Adding a gallery automatically on post creation #12711
Hi George,
I am sorry, I could not post the code earlier. Will do today(in next couple of housr when I get to work on my system again).Congratulations. Learning is fun and I am sure you are enjoying it 🙂
Will love to see you extend MediaPress and will be ready to assist all the time 🙂
Best regards
Brajesh - Brajesh Singh on January 6, 2018 at 1:52 am in reply to: [Resolved] MediaPress Gallery Tab in Private Groups #12710
Hi Graham,
Sorry for the delayed reply.I fixed it in the morning.
https://github.com/buddydev/mediapress/commit/afa88ebac51c9019eb31e9c70fb81b2f33d32e5c
I have pushed a release on WordPress.org and the fix is available in 1.3.3
https://wordpress.org/plugins/mediapress/Thank you
Brajesh - Brajesh Singh on January 6, 2018 at 1:52 am in reply to: [Resolved] Buddypress – How to Hide / Restrict Primary Name field? #12709
Hi Ekiz,
Please put this code in your bp-custom.php/** * Don't allow changing full name on BuddyPress Edit profile. * * Pre-process $_POST and overwrite the full name field data to avoid update by users. */ function buddydev_overwrite_name_update() { if ( empty( $_POST['field_ids'] ) || is_super_admin() ) { //allow super admins. return; } $field_id = bp_xprofile_fullname_field_id(); $field = 'field_' . $field_id; if ( empty( $_POST[ $field ] ) ) { return; //not set. } // Check the field group exists. if ( ! bp_is_action_variable( 'group' ) || ! xprofile_get_field_group( bp_action_variable( 1 ) ) ) { return; } // overwrite with raw value. // avoiding displayed_user_name and get_field_data as they provide extra filtering. $_POST[ $field ] = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $field_id, bp_displayed_user_id() ) ); } add_action( 'bp_screens', 'buddydev_overwrite_name_update', 2 );That will do it for you.
You can hide the field using css. User edit’s won’t have any effect.
Regards
Brajesh - Brajesh Singh on January 4, 2018 at 12:17 pm in reply to: Buddypress User Registration – include mailchimp group signup? #12700
Hi Chris,
Sure, No problem.Regards
Brajesh