• Resolved mkbn

    (@mkbn)


    Hello guys,

    There is an issue where the front-end event/location editor list of user created events/locations is being pulled with same hook as default event/location search form.

    This issue was noticed based off using a cookie with prompted user input of stored zipcode to make the default event/location search form list more user oriented.

    The search form successfully works with printing the cookied stored value as an arg for default search list, however the front end list of created locations/events to edit on editor page will only display events/locations users created that are within the search args the same as default form.

    So for example if you specified Connecticut as your default search area (In return Connecticut will be the “default” search list arg) but have events/locations created in California, California or any state besides Connecticut will not show up on list of created locations/events to edit front end editor page.

    The Backend admin pages are not effected..

    The solution to this will be to separate the default list of created locations/events to edit front end editor page args from search form default list args and making it as simple as “If signed on user created -> show list”

    Also a suggestion would be to create a search form possibly ajax to easily sort and find created locations or events from the front end. Currently there is only pagination but the problem becomes harder with more locations/events to seek by selecting next page just to edit.

    Please advice.. thanks

    https://www.ads-software.com/plugins/events-manager/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    can’t replicate this, do you have sample link to this issue for us to see?

    Thread Starter mkbn

    (@mkbn)

    In the Class Folder the file em_events.php contains the following function to specify default search list (List of events or locations that show up with search form before any user input args are specified)

    public static function get_default_search( $array_or_defaults = array(), $array = array() ){
    	    self::$context = EM_POST_TYPE_EVENT;
    		$defaults = array(
    			'orderby' => get_option('dbem_events_default_orderby'),
    			'order' => get_option('dbem_events_default_order'),
    			'bookings' => false, //if set to true, only events with bookings enabled are returned
    			'status' => 1, //approved events only
    			'format_header' => '', //events can have custom html above the list
    			'format_footer' => '', //events can have custom html below the list
    			'town' => false,
    			'state' => $Specifystate,
    			'country' => false,
    			'region' => false,
    			'blog' => get_current_blog_id(),
    			'private' => current_user_can('read_private_events'),
    			'private_only' => false,
    			'post_id' => false
    		);

    Changing the location state or city from false to specific state or city will replicate the issue.

    1)Change the state in array to specific state
    2) Create a location in backend(admin dashboard) using DIFFERENT state then specified
    3) Go to the front-end location Edit locations page and the list of your created location will not display.
    4) Change your state arg above to same state as your created location
    5) Go back to the front-end edit location page and it will show on list

    The front-end editors should not be hooking into this function for list of user created events.

    Thread Starter mkbn

    (@mkbn)

    To add to above in reference of what is the other coding conflict creating it.. On the Front-End’s location.php file the following code is the beginning of an If Statement that determines if the list of locations show (vice versa for events) <?php if ( $locations_count > 0 ) : ?>

    Where is the $locations_count being pulled from? That has to be the same place of the hook pulling default list for search forms instead of list of user created events/etc..

    is $locations the issue?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    yes, that might be possible; what happens if you try to temporarily remove that?

    Thread Starter mkbn

    (@mkbn)

    Okay so additional test was taking place and the front end editor forms are not the only thing effected.

    The $locations is also effecting if Events are shown on Location pages. So if get_default_search attributes do match args of events it will not show.

    Meanwhile to your point I put in an If statement and it corrected the Front end editor however now users who can edit will loose the ability to have the customized default list based off zipcode on search form page..

    Where would be the best location to put the if user can edit statement to reset the args to false??

    I want users who can edit to be able to get the default list and edit there locations on the front end no matter what the default list args. Same applys to events on location pages.

    public static function get_default_search( $array_or_defaults = array(), $array = array() ){
    	    self::$context = EM_POST_TYPE_LOCATION;
    		if(current_user_can('edit_locations')){
    			$defaults = array(
    				'eventful' => false, //Locations that have an event (scope will also play a part here
    				'eventless' => false, //Locations WITHOUT events, eventful takes precedence
    				'orderby' => 'location_name',
    				'town' => false,
    				'state' => false,
    				'country' => false,
    				'region' => false,
    				'status' => 1, //approved locations only
    				'scope' => 'all', //we probably want to search all locations by default, not like events
    				'blog' => get_current_blog_id(),
    				'private' => current_user_can('read_private_locations'),
    				'private_only' => false,
    				'post_id' => false
    			);
    		}else{
    			$defaults = array(
    				'eventful' => false, //Locations that have an event (scope will also play a part here
    				'eventless' => false, //Locations WITHOUT events, eventful takes precedence
    				'orderby' => 'location_name',
    				'town' => false,
    				'state' => $Specifystate,
    				'country' => false,
    				'region' => false,
    				'status' => 1, //approved locations only
    				'scope' => 'all', //we probably want to search all locations by default, not like events
    				'blog' => get_current_blog_id(),
    				'private' => current_user_can('read_private_locations'),
    				'private_only' => false,
    				'post_id' => false
    			);
    		}
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Front End – Events/Location Editor Issue – List Hook Error’ is closed to new replies.