Members Plugin – Affect Output Loop Count with Event Listings

Home Forums Calendar Products Events Calendar PRO Members Plugin – Affect Output Loop Count with Event Listings

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #23490
    David Luyendyk
    Participant

    Hi all,
    I’m using Event Calendar (Pro) in conjunction with the Members plugin http://wordpress.org/extend/plugins/members/ When setting an event to be accessible by a certain user role, it hides the content (which is fine – works as expected). While not perfect (as it still shows all of the Event data, it’s a start.

    Members has a function that you can wrap around individual posts (or in the loop) like so:

    `$current_user = wp_get_current_user();
    if(members_can_user_view_post( $current_user->ID, $post->ID ) == true) { }`

    Which allows us to check to see if the current user has access to a specific post – again, fine there and handy. What I’d like to know though is how I can hook into the Advanced Event List widget (for example) in a way that doesn’t effect the number of output items. For example, bringing over events-advanced-list-load-widget.php in my template and then /events directory would allow to be put that access check around the element, but it is already counted towards the total you specify in the Widget options – so in theory, users could get 0 which is a little frustrating.

    Any help would be greatly appreciated. Thanks!

    #23514
    Joyce Grace
    Member

    Hello Yellowhousedesign!

    Thanks for posting here – this is an interesting topic and I’m sure when we find a good answer for it, it will benefit the community here.

    I personally don’t have the skill level to help you out but I wanted you to know that you are being heard and not ignored 🙂

    This type of customization is not usually covered by our support team, since it is technically a “customization,” but I’m still going to try to get someone on this that may be able to help out.

    In the mean time, have you checked out our Technical Documentation page? https://theeventscalendar.com/support/documentation It might have what you are looking for. Do let me know if you see something there that could work for you.

    Thanks for your patience!

    #23527
    Casey
    Participant

    Yellowhousedesign,
    I’d definitely be happy to help you out with this. Could you explain in a little more depth how you’re wanting to customize the widget? Do you always want to display 5 events regardless of the user’s access?

    In other words if I’m a member (and you’ve got the widget set to display 5 events), then I can see the following:

    – Event A (Private to Members)
    – Event B
    – Event C (Private to Members)
    – Event D
    – Event E

    If I’m not a member, then I’ll see the following
    – Event B
    – Event D
    – Event E
    – Event F
    – Event G

    Does that sound like what you’re wanting to do? If so, I can work up some code to help you with this. Just let me know! Thanks!

    -Casey

    #23528
    David Luyendyk
    Participant

    Hi Casey,
    Appreciate the reply. After looking into this a bit more, I realized this wouldn’t necessarily need to be done via the template files and should most likely be done with pre_get_posts(). Here’s what I have so far: http://pastebin.com/C40MHGRv

    The Members plugin saves a hidden meta key of _members_access_role to each post (by post I mean all wordpress content) which is correctly returned if you run a print_r(members_get_member_posts()) but for some reason it is not blocking out all of the content correctly. If you can, please use the example code I have along with the Members plugin installed to see if there could be a filter in the way (or something). Really appreciate it. Thanks!

    #23529
    Casey
    Participant

    Yellowhousedesign,
    Stupid question (just covering my bases), but you’re logged out when trying to view those protected events, correct? Could you send me some screenshots (and maybe a URL) that will help me understand what events are displaying, but should be hidden? Thanks.

    #23590
    David Luyendyk
    Participant

    No worries 😉 Yessir, using a different browser as well. I know this is the part where you’d like to ring me a new one, but currently the site is on my localhost, anyway you can use the code I provided along with a quick Members plugin setup of the roles mentioned to give it a shot on your end? Really appreciate the continued help. Thanks!

    #23701
    Rob
    Member

    No prob, Yellowhousedesign. Just a heads up that we’re still looking into this. No guarantees but we’re doing what we can. Stay tuned and thanks for your patience so far.

    #23741
    Casey
    Participant

    Yellowhousedesign – Have you verified that the _members_access_role meta key is returned when viewing the ‘tribe_events’ post type? I would imagine that this plugin is inserting that meta key value with a hook in the post edit screen, and might not work with custom post types.

    I would contact the plugin author to verify that this plugin does work with custom types.

    Sorry we couldn’t be more help than that! Just let us know if you have any questions. Thanks!

    #23742
    David Luyendyk
    Participant

    Hi Casey,
    Thanks again for the continued efforts here. It is in-fact adding in that meta kay (as it returns tribe events just fine in my members_get_member_posts() function just fine). I’ve also been doing some more research and believe the Role Scoper plugin http://wordpress.org/extend/plugins/role-scoper/ might be a good fit (and seems to work very well with my testing). Lots of options, but I like the approach and may go that route for now. Thanks again for everyone’s time!

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Members Plugin – Affect Output Loop Count with Event Listings’ is closed to new replies.