Tagged: buddyblog, Frontend, Hide Categories, Hide Tags, ID's
Hello PresPhuture,
Please upload the image to https://postimg.org and post the link here.
Regards
RaviHi Ravi
Here is the link: https://postimg.org/image/9jgzb6zgt/
Hello PresPhuture,
Thank you for sharing the screenshot. I have seen the settings and bit surprised that why the code is not working. Can you provide me with some demo details so that I can check Also, post me the code you are using in your ‘bp-custom.php’ file to modify BuddyBlog settings.
Thank You
RaviHi Ravi
Here is the code I used for buddyblog:
//For Buddyblog Set Minimum and Maximum Characters for Blog Post add_filter('bsfep_validate_post','buddyblog_custom_validate_title_content',10,2); function buddyblog_custom_validate_title_content($is_error,$post_data){ //if there is already an error, let us return if($is_error) return $is_error; //otherwise, let us check for the length of the title/contet $min_title_length=50;//assuming 50 characters $min_content_length=200;//assuming 200 charactes, will include space $title = trim($post_data['bp_simple_post_title']); $content = trim($post_data['bp_simple_post_text']); //get the form $form_id = $post_data['bp_simple_post_form_id']; $form = bp_get_simple_blog_post_form_by_id($form_id); if(strlen($title)<$min_title_length){ $form->message=sprintf('Sorry, The title is too short. The title must be atleast %d characters long.',$min_title_length); $is_error=true; return $is_error; } if(strlen($content)<$min_content_length){ $form->message=sprintf('Sorry, The content is too short. The post content must be atleast %d characters long.',$min_content_length); $is_error=true; return $is_error; } return $is_error; } //Allow Admin to pick which User blog gets published add_filter( 'buddyblog_user_can_publish', 'buddyblog_custom_admin_allow_publishing', 10, 2 ); function buddyblog_custom_admin_allow_publishing( $can_publish, $user_id ) { if(user_can( $user_id, 'list_users' ) ) $can_publish = true; return $can_publish; } //Show Categories as dropdown menu //buddyblog category as dd add_filter( 'buddyblog_post_form_settings', 'buddyblog_custom_category_as_dropdoown'); function buddyblog_custom_category_as_dropdoown( $settings ) { if( !empty( $settings['tax']['category'])) $settings['tax']['category']['view_type'] ='dd'; //view is drop down for categories return $settings; } //Show Post Tags as dropdown menu //buddyblog post tag as dd add_filter( 'buddyblog_post_form_settings', 'buddyblog_custom_post_tag_as_dropdoown'); function buddyblog_custom_post_tag_as_dropdoown( $settings ) { if( !empty( $settings['tax']['post_tag'])) $settings['tax']['post_tag']['view_type'] ='dd'; //view is drop down for categories return $settings; } //Include these categories and post tag for user on buddyblog /** * Filter the BuddyBlog form settings and limit category/tag inclusion. * * @param array $settings settings array. * * @return array */ function buddydev_filter_buddyblog_form_settings( $settings ) { $tax = isset( $settings['tax'] ) ? $settings['tax'] : array(); $tax['category']['include'] = array( 18, 180, 181, 183, 184, 186, 187, 192, 194, 196, 199 );// category ids to include. $tax['post_tag']['include'] = array( 202, 204, 230 );// tag ids to include. $settings['tax'] = $tax; return $settings; } add_filter( 'buddyblog_post_form_settings', 'buddydev_filter_buddyblog_form_settings' );
Hi Ravi
Happy New Year. Here are the demo
https://postimg.org/image/40r0np7ff/
https://postimg.org/image/hufdcvxhn/
I am not sure if this is what you mean by demo.
Regards
PresPhutureHello PresPhuture,
Sorry for the delayed reply and thank you for sharing the screenshots and the code. Actually, it was a bug in our plugin not BuddyBlog but ‘BuddyPress Simple Front-end Post’. There is a new version available on our site with the bug fix. Please download the latest version of the plugin from the following URL
https://buddydev.com/plugins/bp-simple-front-end-post/
And let me know. If the issues still persists or fix
Thank You
RaviHi Ravi
Sorry for the delay in responding. Thanks a million. The update of the plugin BP Simple Frontend Post worked. I’d like to ask one last thing then I’ll mark this topic as resolved. How do I hide buddyblog and the Blog profile link from the contributor and subscriber user. I only would like the author, editor and administrator to be the only users writing articles.
Regards
PresPhuture
Hi PresPhuture,
Since Ravi seems to be away, I will assist here.,Please put the following code in your bp-custom.php
/** * Only show BuddyBlog tabs if a user is author or above. */ function buddyblog_custom_remove_profile_nav() { if ( ! bp_is_user() || user_can( bp_displayed_user_id(), 'publish_posts' ) ) { return; } bp_core_remove_nav_item( 'buddyblog' ); } add_action( 'bp_buddyblog_setup_nav', 'buddyblog_custom_remove_profile_nav' ); /** * Remove from adminbar too for BuddyBlog. */ function buddyblog_custom_remove_admin_nav( $nav_items ) { if ( ! current_user_can( 'publish_posts' ) ) { $nav_items = array(); } return $nav_items; } add_filter( 'bp_buddyblog_admin_nav', 'buddyblog_custom_remove_admin_nav' );
You may adjust the capability further if you wnat in future.
Regards
BrajeshHi Brajesh
Thank you very much. The Code worked very well.
Regards
PresPhuture
Hi PresPhuture,
You are welcome. Glad that it worked.Best Regards
Brajesh
The topic ‘ [Resolved] Buddyblog: Hide certain Categories and Tags’ is closed to new replies.