WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Events Manager] Display by Attribute

[Plugin: Events Manager] Display by Attribute

  • Lee Rickler
    Member

    @bigbadboy

    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/

Viewing 15 replies - 1 through 15 (of 24 total)
  • agelonwl
    Member

    @angelonwl

    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/

    Plugin Author Marcus
    Participant

    @netweblogic

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

    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!

    agelonwl
    Member

    @angelonwl

    thanks for sharing…

    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.

    manderson143
    Member

    @manderson143

    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!

    @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.

    manderson143
    Member

    @manderson143

    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! 😉

    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.

    manderson143
    Member

    @manderson143

    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! 😉 )

    Plugin Author Marcus
    Participant

    @netweblogic

    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

    Marcus – I’ve read the tuts many times, thanks!

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

    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));

    Plugin Author Marcus
    Participant

    @netweblogic

    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.

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

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘[Plugin: Events Manager] Display by Attribute’ is closed to new replies.