WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
Display by Attribute (25 posts)

  1. Lee Rickler
    Member
    Posted 2 years ago #

    I am trying to only show events according to attribute - is this possible?

    Example:
    I add a new attribute - 'Assigned to'
    I add a name (current logged in username) to the 'Assigned to' field in the event form

    So, I assign an event to Bob, Bob logs in and now he can see only that event.

    How can I show events where that "assigned to' username matches the logged in username?

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 2 years ago #

    not possible atm, but you can use general arguments to filter events by owner http://wp-events-plugin.com/documentation/event-search-attributes/ and using shortcodes http://wp-events-plugin.com/documentation/shortcodes/

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    could be done, but you'd have to code this yourself, I advise you also check the tutorials here: wp-events-plugin.com/tutorials/

  4. Lee Rickler
    Member
    Posted 2 years ago #

    I changed things around a little bit and came up with this which looks for the owner of the event and checks that against the logged in user.

    So, if you have events 'owned' by you and you're logged in you'll only see those events:

    <?php echo do_shortcode('[events_list category="8" owner="' . $current_user->ID . '"]'); ?>

    Oh .. and trust me, I spent most of yesterday trawling through the very comprehensive support files!

  5. agelonwl
    Member
    Posted 2 years ago #

    thanks for sharing...

  6. Lee Rickler
    Member
    Posted 2 years ago #

    Apologies for changing this to unresolved - I thought it was but obviously I spoke too soon!
    The above works in the instance of narrowing by owner - I need to drill down to only display by attribute.

    For example, if the attribute is:
    #_ATT{Assigned to} how would I use that in this:

    <?php echo do_shortcode('[events_list category="8" owner="' . $current_user->ID . '"]'); ?>

    I tried

    <?php echo do_shortcode('[events_list category="8" att="' . $current_user->ID . '"]'); ?>

    and

    <?php echo do_shortcode('[events_list category="8" #_ATT{Assigned to}"' . $current_user->ID . '"]'); ?>

    but nothing is working.

  7. manderson143
    Member
    Posted 2 years ago #

    I'm not familiar with this plugin, but I'm wondering if there is a place in the code where it states who created this event. Meaning, if you as the admin create the event.. can you then go to that particular event and change the name of the "owner"? Is there such a place to do this on each event?

    Sorry if this isn't a solution, was just thinking of ways the "event" would document who "created" it.

    And if this is a possibility, then this is certainly a plugin I may be interested in implementing!

  8. Lee Rickler
    Member
    Posted 2 years ago #

    @manderson143 - Agreed - I've spent the last few days pondering the different ways of displaying and selecting the events.

    Filtering by attribute seems the only real way as their are so many permutations:
    John can create an event, assign the event to someone else, but not own it
    Jack can create an event and own it, not assign it to anyone except, perhaps, himself
    Jill can create an event and take full ownership, assigned to all functions
    etc

    This plugin is awesomely powerful ... I just need to push it/ myself a bit and it'll be even more awesomer!

    BTW - yes, you can change the 'owner' - The owner panel is on the right side of the 'create an event' page and imports all your members.
    So ... I can create an event but assign you as the owner.

  9. manderson143
    Member
    Posted 2 years ago #

    I do have to apologize.. I AM familiar with it, in fact I'm using it, but as the CALENDAR.. (was thinking the plugin I was using had "calendar" in it's name.. silly me!)..

    Hmmm.. I get what you are trying to do and what a benefit .. So.. there needs to be a way to have the plugin display according to "assigned" field and not "own" field, right?

    So what you are asking if it can do, would be greatly beneficial for anyone using this plugin..

    OK.. I'm thinking of a way it might be done, but I have to figure out how to write it down legibly.. I'll be back! ;)

  10. Lee Rickler
    Member
    Posted 2 years ago #

    Essentially, yes.

    All I'm trying to do is use an added attribute, in my case ATT{Assigned to}, in the shortcode.

    Pushing it further I want to match the 'assigned to' attribute to the logged in user - effectively only showing the logged in user events that have been assigned to him.

  11. manderson143
    Member
    Posted 2 years ago #

    I have a site that I created where USER1 would get his log in information and the first page he sees is HIS login page. And then he'll be able to go to whichever pages I have listed on his page.

    So that part of it I have working.. I can get the exact plugin I used if you need that.

    Still thinking how to create USER1's page and a USER2's page and still allow for anyone to assign an event to them.

    May need a "calendar" page of their own that will let them only see theirs somehow (I know..that's what you're trying to do.. just had to say it out loud, sorta! ;) )

  12. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    warning, don't use the attributes for searching (i.e. SQL)! since they're stored in one field as a serialized array, it wouldn't serve you well in this respect

    the only time I'd recommend filtering by attribute is when looping events in PHP and checking the $EM_Event->attributes array before displaying the event.

    if you want a field like 'assigned to', I'd recommend adding a custom attribute as per our tutorial : http://wp-events-plugin.com/tutorials/

    also, instead of do_shortcode, use something like EM_Events::output(array('owner'=>get_current_user_id())), more powerful

  13. Lee Rickler
    Member
    Posted 2 years ago #

    Marcus - I've read the tuts many times, thanks!

    And thanks on the warning - A few changes I need to make I think.

  14. Lee Rickler
    Member
    Posted 2 years ago #

    EDIT: Reading the files in further depth - How can I include/ exclude a specific category from the results:

    I thought this would do it but, I'm not 100% sure I got it right:
    Include:
    EM_Events::get(array('owner'=>$bp->displayed_user->id, 'category'=>8));

    Exclude:
    EM_Events::get(array('owner'=>$bp->displayed_user->id, 'category'=>-8));

  15. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    we don't have an exclude option, just include (which you got right)

    to exclude you could put a commma seperated string of category IDs minus the ones you don't want.

  16. Lee Rickler
    Member
    Posted 2 years ago #

    Looking good Marcus.
    I sent an email via your site - not sure if you got it.

  17. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    not sure, what was the subject?

  18. the1path
    Member
    Posted 2 years ago #

    Sorry to hijack this thread a bit but I see things that might be useful to my own issue.

    I want a featured event area above the event search on the list page. How do I obtain the category id to create a conditional statement?

    Would I just use: echo do_shortcode('[events_list category="8"]');

    Thanks in advance

  19. agelonwl
    Member
    Posted 2 years ago #

    @the1path

    Yes, you can do that by customizing the events-search.php template

    http://wp-events-plugin.com/documentation/using-template-files/

  20. the1path
    Member
    Posted 2 years ago #

    I did this eventually by adding a "Featured" Category and finding out its ID in my case it was 3.

    I then added this at the top of events-list.php :

    echo "<h2>Featured Events</h2>";
    echo do_shortcode('[events_list category="3"]');

    Does the trick, now just got to add styles.

    I have to say being a non-coder I find the templating system very difficult to follow for this plugin, looks like its all variables passed from other functions.

  21. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    we try to limit the vars passed, but it can't really be avoided.

    out of curiosity, is it just the vars that confuse you?

  22. pitschkac
    Member
    Posted 2 years ago #

    I realize this post is 4 months old but I am hoping someone has created an answer? Basically I have a site set where users login and then create personal events. I only want them to see the events they create and no one else. Can someone created a PHP script that I can just plug into the mu-plugin folder and work?

    Help is greatly appreciated. Thanks

  23. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    This is to do with event ownership and capabilities, which is possible. Downside is that WP shows events of other users in wpadmin but don't show a link for you to edit that event (unless you have permissions)

    If you prevent users from logging in via the backend, you can create pages on your site that users can log in and create events on. This way they don't see other users' events.

  24. John Bueno
    Member
    Posted 2 years ago #

    I was previously using EM_Events::get() to echo get my events as an object. I recently updated to version 4 and for the most part my code is still working though EM_Events::get() no longer seems to get the category. This was my old code:

    <div class="location">
    <span class="city">'.$event->location->town.'</span>
    <span class="category'.$catclass.'">'.$event->category->name.' EM_Events::get()</span>
    <span class="title">'.$event->name.'</span>
    </div>';

    thoughts?

    Thanks!

  25. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    pls post this on a new thread John

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic