joneiseman
Forum Replies Created
-
No, you don’t need to add any Capabilities to the Artist role. Here’s information on creating a drop down: https://www.w3schools.com/tags/tag_select.asp
Here’s the code to create a drop down in the attributes.php template:
<select name="em_attributes[<?php echo $name ?>]">
<?php foreach($attributes['values'][$name] as $attribute_val): ?>
<?php
if ($name == "ARTIST") {
$userid = get_user_id_by_display_name($attribute_val);
$valstr = $userid > 0 ? "value=" . $userid : "";
}
if( array_key_exists($name, $EM_Event->event_attributes) && $EM_Event->event_attributes[$name]==$attribute_val ): ?>
<option <?php echo $valstr; ?> selected="selected"><?php echo $attribute_val; ?></option>
<?php else: ?>
<option <?php echo $valstr; ?> ><?php echo $attribute_val; ?></option>
<?php endif; ?>
<?php endforeach; ?>
<select name="em_attributes[<?php echo $name ?>]">
<?php foreach($attributes['values'][$name] as $attribute_val): ?>
<?php
if ($name == "ARTIST") {
$userid = get_user_id_by_display_name($attribute_val);
$valstr = $userid > 0 ? "value=" . $userid : "";
}
if( array_key_exists($name, $EM_Event->event_attributes) && $EM_Event->event_attributes[$name]==$attribute_val ): ?>
<option <?php echo $valstr; ?> selected="selected"><?php echo $attribute_val; ?></option>
<?php else: ?>
<option <?php echo $valstr; ?> ><?php echo $attribute_val; ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>The link to the Artist can be stored as a Custom Attribute. Custom Attributes are stored as post meta so you can use get_post_meta($EM_event->post_id, “artist”) to get the user id for the Artist. Assuming that UM stores the user fields such as “profile image” in the user meta table. You can then retrieve these fields by using get_user_meta. Then you can display these fields in the event page by creating Custom Placeholders for each field and then using these placeholders in the single event template.
Here’s the documentation: https://wp-events-plugin.com/documentation/recurring-events/
When I edit a recurring event it says: Modifications to event dates will cause all recurrences of this event to be deleted and recreated, previous bookings will be deleted.
But you can make other edits to the recurring event that doesn’t involve changing the dates.
WARNING: This is a recurring event.
Modifications to recurring events will be applied to all recurrences and will overwrite any changes made to those individual event recurrences.
Bookings to individual event recurrences will be preserved if event times and ticket settings are not modified.
I’m not able to right click on the page to view the html/css.
Did you disable any of the formatting in Events Manager in Events > Settings and then in the General tab: Styling Options (Advanced)?
Here’s a way to register a new shortcode to do this without modifying any template files. Just add the following code snippet:
add_shortcode('events_list_searchform', 'my_events_list_searchform');
function my_events_list_searchform($args = []) {
$selector = 'form#em-search-form-' . $args['id'] . ' button.em-search-submit';
$args = em_get_search_form_defaults($args);
$args['search_action'] = 'search_events';
$args['search_url'] = get_option('dbem_events_page') ? get_permalink(get_option('dbem_events_page')):EM_URI;
$args['css_classes'][] = 'em-events-search';
$args['css_classes_advanced'][] = 'em-events-search-advanced';
if (!empty($args['scope']['name'])) $args['scope'] = $args['scope']['name'];
$script = '<script>
jQuery(document).ready( function($){
$(window).on("load", function() {
$("' . $selector . '").click();
});
})</script>';
ob_start();
em_locate_template('templates/search.php', true, array('args'=>$args));
return ob_get_clean() . $script;
}You can then use the [events_list_searchform] shortcode instead of [events_list] (it takes the same search attributes).
You can use the Code Snippets plugin to add this code snippet.
Try adding the following to your wp-config.php file:
define( 'EM_AJAX', false );
Let’s say you already assigned the existing members a role that has the edit_events and and edit_other_events capability. Let’s call that role “member”. You could then add a code snippet to assign the member role when someone becomes a member or removes the member role when they are no longer a member.
add_action('pmpro_after_change_membership_level', 'my_change_membership_level', 10, 3);
function my_change_membership_level($level_id, $user_id, $old_level)
{
$user = get_userdata($user_id);
if (!$user)
return;
if (false !== $level_id && $level_id > 0) {
$user->add_role('member');
}
else {
$user->remove_role('member');
}
}You could use the Code Snippets plugin to add this code snippet.
You can use the Members plugin to create roles and to assign roles to users.
When they don’t have the edit_events capability, the “Add New” button will not appear.
Here’s an improved version that handles the javascript in the correct way and will work in the case when the shortcode is instantiated more than once on the same page:
$selector = $args['id'] . ' button.em-search-submit';
wp_enqueue_script( $args['id'] );
wp_add_inline_script( $args['id'],
'
jQuery(document).ready( function($){
$(window).on("load", function() {
$("' . $selector . '").click();
});
});
');
/* @var $args array */
$args['search_action'] = 'search_events';
$args['search_url'] = get_option('dbem_events_page') ? get_permalink(get_option('dbem_events_page')):EM_URI;
$args['css_classes'][] = 'em-events-search';
$args['css_classes_advanced'][] = 'em-events-search-advanced';
if (!empty($args['scope']['name'])) $args['scope'] = $args['scope']['name'];
em_locate_template('templates/search.php', true, array('args'=>$args));
?>If you do instantiate the shortcode more than once it might be a good idea to specify a unique id for each shortcode (but it’s not necessary). For example:
[events_search_form id=1 full="1" has_search="1" sorting="0" show_advanced="0" search_geo="0" show_search="1" long_events="1" category=12]
[events_search_form id=2 full="1" has_search="1" sorting="0" show_advanced="0" search_geo="0" show_search="1" long_events="1" category=13]I came up with a solution to this problem using the event_search_form shortcode: https://www.ads-software.com/support/topic/search-not-working-with-events_list/#post-18140767
[event_search_form view="grid" pagination=1]
It requires overriding the events_search.php template.
Here’s an improved version.
First create the directory wp-content/plugin-templates/events-manager/templates and then create a file in that directory called events-search.php with the following content:
<script>
jQuery(document).ready( function($){
$(window).on('load', function() {
$('button.em-search-submit').click();
});
});
</script>
<?php
/* @var $args array */
$args['search_action'] = 'search_events';
$args['search_url'] = get_option('dbem_events_page') ? get_permalink(get_option('dbem_events_page')):EM_URI;
$args['css_classes'][] = 'em-events-search';
$args['css_classes_advanced'][] = 'em-events-search-advanced';
if (!empty($args['scope']['name'])) $args['scope'] = $args['scope']['name'];
em_locate_template('templates/search.php', true, array('args'=>$args));
?>Then you can use the following shortcode:
[event_search_form full="1" has_search="1" sorting="0" show_advanced="0" search_geo="0" show_search="1" long_events="1"]
This is the same problem reported here: https://www.ads-software.com/support/topic/please-fix-broken-calendar-category-filtering/
I reported this to @msykes
If I comment out line 127 in wp-content/plugins/ninjafirewall/lib/utils.php it fixes the problem
// add_filter('wp_insert_post_empty_content', 'nf_wp_insert_post_empty_content', 10000, 2 );
So, I guess the problem is related to that filter.
I verified the problem but I’m not able to determine what is causing the incompatibility.
I hope so.
Forum: Plugins
In reply to: [Events Manager - Calendar, Bookings, Tickets, and more!] Events by locationThe search parameters are documented here: https://wp-events-plugin.com/documentation/event-search-attributes/
It says the location search parameter takes a location ID. So, the slug or location name will not work. To find the location ID go to Events > Locations and then in Screen Options enable Location ID.
I verified using the location ID works for both the events_list and events_calendar shortcodes.