Issues with AnsPress 4.0.5

6.10K viewsIssues
0

Hi there,

I’ve found quite a few issues on the plugin. I’m not sure why it is happening so please help. My site is hosted on WP Engine with a staging and production setup.

I’m using AnsPress version 4.0.5 and AskBug theme version 3.0.8

Issue #1

Comments are not loading for questions. See image below:

The ajax call to the load_comments function is returning the following response:

<div id="ap-response">{"success":false,"snackbar":{"message":"Unable to load comments"},"ap_responce":true,"is_ap_ajax":true}</div>

My Guess : The nonce is not matching. Also this works in staging but not in production.

Issue #2

Post Actions are not loading.

The ajax call to the post_actions function returns the following response:

<div id="ap-response">{"message":"Something went wrong, last action failed.","ap_responce":true,"message_type":"error","is_ap_ajax":true}</div>

My Guess: same as issue #1

Issue #3

Bread crumbs in user profile page is not working.

All the profile endpoints point to only one url that is : http://mysite.com/questions/user/

This above URL points to an anonymous user profile page.

Issue #4

Edit profile in user profile is not working. The URL on edit profile link is not showing the edit-profile slug, See image Below. I tried to flush rewrite rules by saving permalinks but it didn’t work.

This issue was not present with AnsPress 4.0.0 but is present with AnsPress 4.0.5 so I don’t know if it is an AnsPress issue or an AskBug issue.

Issue #5

Registered date in about me section of profile page is not working. See image below

Please help me in fixing all the above issues asap.

Thanks.

0

This is the workaround for Issue #3 that I have temporarily put in the functions.php file in my AskBug-child theme.

function fixing_user_profile_page_breadcrumbs($a){

	$current_page = ap_current_page();

	if($current_page == 'user'){
		$current_user = wp_get_current_user();
		$user_id = get_query_var( 'ap_user_id' );
		$title = ap_page_title(); //is in the format <Username> | <profile-sub-page>
		$title = explode('|', $title); 
		$title = $title[1]; // index 1 will contain <profile-sub-page>
		$title = sanitize_title($title); 
		if($current_user->ID === $user_id){
			$a['page']['link'] .= $current_user->user_login.'/'.$title.'/';
		}else{
			$current_user = get_userdata($user_id);
			$a['page']['link'] .= $current_user->user_login.'/'.$title.'/';
		}
	}
	return $a;
}

add_filter( 'ap_breadcrumbs', 'fixing_user_profile_page_breadcrumbs',1,10);
edited comment on answer

Hello Lisa,
Thanks for getting back to us again. Not sure why I am not able to replicate same issue in my dev sites. I will check this workaround and apply it to theme. Thanks

Hello Rahul,

Yeah. I’ll try to setup a remote server and install and activate anspress and askbug there. Will give you access to that server and you can see what is causing that issue.

As I said before, the issue seems to be in anspress and not askbug. As per the latest code(Anspress 4.0.5), the ‘ap_get_link_to()’ function is still using the function ‘ap_opt( ‘user_page_slug’ )’ to set the default slug for user profile pages in the ‘$default_pages’ array.

Even though you said that the ‘user_page_slug’ option has been depricated, it is being used in the above function.

I tried using the ‘ap_default_page_slugs’ filter you have placed for the ‘$default_pages’ array to fix the url for the user profile pages. But it seems like the same filter or ‘$default_pages’ array is being used in multiple places like the top-right menu, user profile page nav menu, etc. So I had to finally use the ‘ap_breadcrumbs’ filter to fix the urls for the user profile pages.

You can find the ap_get_link_to() function in WP_PLUGIN_FOLDER/anspress-question-answer/includes/functions.php

Hoping for this thing to get fixed soon.

Thanks,
Lisa

You are viewing 1 out of 3 answers, click here to view all answers.