Events Made Easy Forums Bug fixed or feature request implemented Can I link events only when members are logged in?

Tagged: , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #42385
    Anonymous
    Inactive

    I’d like to show the Events Calendar to all my visitors, but have the events linked to the Events Detail page only if they are registered and logged in. Any easy way you can walk me through that?

    I tried applying if(is_user_logged_in()) to $results on line 981 of eme_events.php, but that didn’t work, tho it looks like it should.

    Thanks!

    #46036
    Franky
    Keymaster

    For the moment this is not possible without indeed modifying the code. I’ll move this to feature requests.

    #46037
    Franky
    Keymaster

    I created a wordpress filter that you can use:

    eme_event_filter (1 parameter: $event)

    ==> See http://codex.wordpress.org/Function_Reference/add_filter , e.g. in your functions.php:

    add_filter('eme_event_filter','do_my_filtering');

    function do_my_filtering($event) {
    ....
    return $event;
    }

    #46038
    Anonymous
    Inactive

    Ok, I created this function and put it in my functions.php file:

    function soa_event_filter( $event ) {
    if( !is_user_logged_in() && $_REQUEST['event_id']<>'' ) {
    $event = the_title('<h3>- ','</h3>');
    $event .= "<h4>Become a Member so you can book this Event!</h4>";
    }
    return $event;
    }
    add_filter( 'eme_event_filter', 'soa_event_filter' );

    Unfortunately, it breaks the page where the Tag is called. But if I substitute ‘the_content’ for ’eme_event_filter’ in the add_filter function, it works.

    So, not sure what’s going on, but seems like it may be some kind of syntax errors I’m making.

    #46039
    Franky
    Keymaster

    First do a print_r($event}; to see how $event is built, creating a filter doesn’t mean you can change the type of value returned ($event is an assoc. array, you return a string).

    Try this:

    function soa_event_filter( $event ) {
    if( !is_user_logged_in() && eme_is_single_event_page() ) {
    $event['event_notes'] = "<h4>Become a Member so you can book this Event!</h4>";
    }
    return $event;
    }
    add_filter( 'eme_event_filter', 'soa_event_filter' );

    #46040
    Anonymous
    Inactive

    Alright, I get it! You’re replacing the expected $event array with your own values. Very cool! … and works great! Thanks!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Bug fixed or feature request implemented’ is closed to new topics and replies.
Scroll to Top