Tagged: buddyblog
Hi, I would like my users to be able to post two different types of blog posts. 1 – Stories 2 – Articles. In a true dream world I’d have stories allow like 4 image attachements and have it’s own template on how the page is displayed as the end-result. Then have Articles work like a standard blog post. But if that’s impossible then just having two different types of custom posts would be cool rather then using categories. Is that possible with a snippet or something or require alot of modification?
Even more far fetched but gotta ask…
Rather then checking for “capability” required for making or editing posts. Is there a fairly easy customization check for if the user has an active WooCommerce Membership or Subscription to xxx? Since their Memberships plugin doesn’t allow you to grant new user role levels for letting some premium users/customers post blog posts 🙁
Thanks for any help or insight!
Hi J,
Welcome to BuddyDev.
1. I am sorry but at the moment, the plugin can handle only one post type. You will need to use category or custom field for managing two types. Or you can extend the plugin(which will be major work)Using WordPress Template hierarchy, you can easily create different layout for different kind of the posts.
About membership, we have a hook like this
apply_filters( 'buddyblog_user_can_publish', $can_publish, $user_id )
You can filter on ‘buddyblog_user_can_publish’ and customize the permission as you will like.
Hope that helps.
So is there a way to filter that on WooMemberships or Subscription status? That code just displays an individual’s user ID. I understand you’re not going to write the code for me but I’m just trying to make sure we’re on the same page and it’s reasonabley possible without being a massive customization.
Thanks
I am not sure of your last reply.
I posted that code to show what we have exposed. You can add to that filter and use woo subscription to decide whether to return true/false.
It will be a simple code with only 1 or 2 lines. I am sorry but I am not familiar with the WooMemberships or Subscription so I may not be able to help.
If you can provide me the function for checking expired membership for a given user, I can certainly write the code for you.
Thank you
BrajeshConditional checks: Members (sub heading) – Active member of particular plan:
https://docs.woocommerce.com/document/woocommerce-memberships-function-reference/
Hi J,
Yes, That link has the appropriate function. Please allow me 5 more minutes to put an example for you.Hi J,
Please put this in your bp-custom.php
/** * Do not allow members without active plans to pusblish post. * * @param boolean $can * @param int $user_id * * @return bool */ function buddydev_filter_publishing_permission( $can, $user_id ) { if ( function_exists( 'wc_memberships_get_user_active_memberships' ) && ! wc_memberships_get_user_active_memberships( $user_id ) ) { $can = false; } return $can; } add_filter( 'buddyblog_user_can_publish', 'buddydev_filter_publishing_permission', 10, 2 );
This should work.
Currently it is not possible to completely remove the component. We can disable the crate form though. We have been rewriting the BuddyBlog and the next major version will have this functionality as well as some workflow management too.
For specific membership type, Please see
https://github.com/skyverge/wc-plugins-snippets/blob/master/woocommerce-memberships/frontend/product-restricted-notice.php#L18
You must be logged in to reply to this topic.