Issues with AnsPress 4.0.5

6.18K 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

0

Hello Lisa,
Thanks for reporting issues. I just fixed edit profile page issue. Please get new version.
Cheers.

commented on answer

Hello Rahul,

I just updated the theme. The user edit-profile page is now working. But whenever I make changes and save, there is no message displayed anywhere that the user details have been updated. the data does get updated, just that it doesn’t show any update message.

Also Issue #3 is still existing. Please look into that too.

Thanks,
Lisa

0

Hello Lisa,

Comments and actions are not loading because ajax url is set to non https. Please make sure to force https for everything from wpengine setting. Earlier I had this this issue on wpengine.

Please save your permalinks and user page will be fine. Not sure about registration date issue, is this happening on staging site as well? Can you send me file and site access so that I can further investigate this issue.

commented on answer

Hello Rahul,

The ajax issue got resolved when I started using https. Thanks for that.

But the user profile issue is yet to be resolved. As I already said. I saved permalink settings but the issue hasn’t resolved.

As far as the registration date issue is concerned, I checked the database and the registered date field for the above user was blank hence it showed incorrect date. I think that user was added via the database.

Apart from the user’s edit profile link, even the breadcrumbs on the user profile page are not working for me. This is the case in staging as well. I tried it in a local setup as well. there also the breadcrumbs and edit user profile links are not working.

Thanks for your response.

Are you using latest version of AskBug?

Yes. The first time I downloaded it from the pdf that came in my email with purchase details on 20th June. Now I downloaded it again from My orders page, and installed the theme again. but the problem is still persisting.

I just want to add that, if I use AnsPress version 4.0.0 instead of version 4.0.5, I can see the edit-profile page. Only when I use the latest version of Anspress, I can see the problem.

Hello,

I just installed the latest version of anspress(4.0.5) from wordpress and the latest version of Askbug(3.0.8) from your site in a local machine via xampp.

There are no additional plugins installed and only these two plugins. Still I’m facing breadcrumb issue and the edit-profile issue on the user profile page. Please help me fix this problem asap.

Thanks

Hello, Lisa. I am checking it right now.