• This shortcode is no longer executed, right?

    In former times, it would display the name of the buddypress group the event belonged to.

Viewing 8 replies - 1 through 8 (of 8 total)
  • That placeholder doesn’t exist in the current release of Events Manager. I don’t know about earlier versions.

    Thread Starter Achim

    (@ar7)

    Hi Jon, thank you ??

    Is there ANY way to display the group an event belongs to?

    Add the following code snippet to create this placeholder:

    add_filter('em_event_output_placeholder', 'my_em_styles_placeholders', 1, 3);
    function my_em_styles_placeholders( $replace, $EM_Events, $result ) {
    if( preg_match( '/#_EVENTBPGROUPNAME.*/', $result ) && !empty($EM_Event->group_id) && function_exists('groups_get_group') ) {
    $group = groups_get_group( array( 'group_id' => $EM_Event->group_id) );
    $replace = $group->name;
    }
    return $replace;
    }

    You can use the Code Snippets plugin to add this code snippet.

    Thread Starter Achim

    (@ar7)

    Thank you, Jon.

    This doesn′t seem to work for us though… Changes nothing…

    Thread Starter Achim

    (@ar7)

    … in bp-custom.php, it makes a critical error.

    <code>

    <?php
    add_filter('em_event_output_placeholder', 'my_em_styles_placeholders', 1, 3);
    function my_em_styles_placeholders( $replace, $EM_Events, $result ) {
    if( preg_match( '/#_EVENTBPGROUPNAME.*/', $result ) && !empty($EM_Event->group_id) && function_exists('groups_get_group') ) {
    $group = groups_get_group( array( 'group_id' => $EM_Event->group_id) );
    $replace = $group->name;
    }
    return $replace;
    }
    ?>
    </code>
    joneiseman

    (@joneiseman)

    I’ve already tested the code so I know it doesn’t generate a critical error. The problem is you added the following line before the code snippet:

    <?php

    And then the following after the code snippet:

    ?>

    That’s what’s causing the critical error.

    Remove those lines and the critical error will go away.

    Thread Starter Achim

    (@ar7)

    Thank you, Jon.

    Unfortunately, this code is not having any effect in our code.

    I just tested this and after adding the code snippet. I can add #_EVENTBPGROUPNAME to the format for the single event and it will display the group name. I’m not sure what you mean when you say it’s not having any effect in your code.

    Here’s the code I added to add support for #_EVENTBPGROUPNAME

    <?php
    add_filter('em_event_output_placeholder', 'my_em_styles_placeholders', 1, 3);
    function my_em_styles_placeholders( $replace, $EM_Events, $result ) {
    if( preg_match( '/#_EVENTBPGROUPNAME.*/', $result ) && !empty($EM_Event->group_id) && function_exists('groups_get_group') ) {
    $group = groups_get_group( array( 'group_id' => $EM_Event->group_id) );
    if ( !empty( $group ) ) {
    $replace = $group->name;
    }
    }
    return $replace;
    }
    ?>
    • This reply was modified 2 months, 4 weeks ago by joneiseman.
Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.