WordPress.org

Ready to get started?Download WordPress

Forums

Event Geek
restrict events based on type of user (6 posts)

  1. jcpcosta
    Member
    Posted 9 months ago #

    Hi graphicgeek!

    I'm using your great plugin, goes really well on my website! However, I created different users with different content permissions and I have public and private events which may or may not be seen by different users. Is there a way to control which type of events a specific user can see? For user permission control I'm using Eyes Only and Press Permit Core plugins. Any tips?

    Thank you!

    http://wordpress.org/plugins/event-geek/

  2. jcpcosta
    Member
    Posted 9 months ago #

  3. graphicgeek
    Member
    Plugin Author

    Posted 9 months ago #

    I think it might be possible, but it's going to require some coding. Are you comfortable using WordPress hooks?

  4. jcpcosta
    Member
    Posted 9 months ago #

    Sometimes I am :) I think It won't be a problem,

  5. graphicgeek
    Member
    Plugin Author

    Posted 9 months ago #

    I think you could use event categories to specify which events were for which type of user, and then use the gg_event_widget_date_args hook to do something like this:

    function my_event_dates_filter($args){
    	$category = get_user_category();//you will need to write this function to return the category slug the user is allowed to see (or return false).
    
    	if($category){
    	$args['event_category'] = $category;
    	}
    
    	return $args;
    }
    
    add_filter('gg_event_widget_date_args', 'my_event_dates_filter');

    That should make it so that the widget will only display events in the category for that user.

    Then on your event listing page, you could use the template tag like this:

    $category = get_user_category();
    $args = array();
    if($category){
    	$args['category'] = $category;
    }
    
    event_geek_list($args);
  6. graphicgeek
    Member
    Plugin Author

    Posted 9 months ago #

    I think you could use event categories to specify which events were for which type of user, and then use the gg_event_widget_date_args hook to do something like this:

    function my_event_dates_filter($args){
    	$category = get_user_category();//you will need to write this function to return the category slug the user is allowed to see (or return false).
    
    	if($category){
    	$args['event_category'] = $category;
    	}
    
    	return $args;
    }
    
    add_filter('gg_event_widget_date_args', 'my_event_dates_filter');

    That should make it so that the widget will only display events in the category for that user.

    Then on your event listing page, you could use the template tag like this:

    $category = get_user_category();
    $args = array();
    if($category){
    	$args['category'] = $category;
    }
    
    event_geek_list($args);
  7. jcpcosta
    Member
    Posted 7 months ago #

    Hi graphicgeek!

    I'm trying to put this to work. Just one question: when you say to use this piece of code (the 2nd one) on the event listing page you mean directly on the page, through page editing? I'm reading about template tags but I'm not reaching it.

    Thank you.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.