Notification with buddypress and Question list pagination not working.

7.24K viewsCore
1
  1. I am using Anspress with BuddyPress but Notification for Anspress is not working, I don’t have any idea why it is not working.
  2. Pagination for Question list is also not working, when I click on page 2 it’s show page not found.

Please help me with this. I am using BuddyPress 3.0.43 and Anspress 2.4.7 .

Thank you

I have the same problem, when I click on page 2 it’s show page not found!

0

Hey Rahul,

I think my custom code is not the problem.

I am using WordPress 4.2.7, is this can be the problem?

Please let me know

Thanks

edited comment on answer

Did you selected base page as home page?

No I didn’t selected base page as home page.

0

Thank for the reply Rahul. I have tried this solution but it’s not working.
Let me tell you I have customized the plugin core file, see the following code with “——-” what I have added in question-loop.php:

<?php
/**
* Question class
*
*@package AnsPress
*@author Rahul Aryan <[email protected]>
*@license GPL-2.0+
*@link http://rahularyan.com
*@copyright 2014 Rahul Aryan
*/

// If this file is called directly, abort.
if ( ! defined( ‘WPINC’ ) ) {
die;
}

if ( ! class_exists( ‘Question_Query’ ) ) :

/**
* Question
*
* This class is for retriving questions based on $args
*/
class Question_Query extends WP_Query {

public $args = array();

/**
* Initialize class
*@param array $args
*@access public
*@since 2.0
*/
public function __construct( $args = array() ) {

if ( is_front_page() ) {
$paged = (isset( $_GET[’ap_paged’] )) ? (int) $_GET[’ap_paged’] : 1; } else {
$paged = (get_query_var( ‘paged’ )) ? get_query_var( ‘paged’ ) : 1; }

if ( isset( $args[’post_parent’] ) ) {
$post_parent = $args[’post_parent’];
} else {
$post_parent = (get_query_var( ‘parent’ )) ? get_query_var( ‘parent’ ) : false;
}

$defaults = array(
‘showposts’ => ap_opt( ‘question_per_page’ ),
‘paged’ => $paged,
);

$args[’post_status’][] = ‘publish’;
$args[’post_status’][] = ‘closed’;

if ( $post_parent ) {
$this->args[’post_parent’] = $post_parent;
}

$this->args = wp_parse_args( $args, $defaults );

if ( get_query_var( ‘ap_s’ ) != ” ) {
$this->args[’s’] = sanitize_text_field( get_query_var( ‘ap_s’ ) );
}

if ( isset( $this->args[ ‘sortby’ ] ) ) {

—————————————————————————–
$this->orderby_questions($this->args[ ‘global_group_id’ ]);

—————————————————————————–
}

$this->args[’post_type’] = ‘question’;

$args = $this->args;

/**
* Initialize parent class
*/

parent::__construct( $args );
}

/**
* Modify orderby args
*@return void
*/
public function orderby_questions($get_global_group_id) {
$q_g_id = $get_global_group_id;
switch ( $this->args[ ‘sortby’ ] ) {
case ‘answers’ :
$this->args[ ‘orderby’ ] = ‘meta_value_num’;
$this->args[ ‘meta_key’ ] = ANSPRESS_ANS_META;
break;
case ‘unanswered’ :
$this->args[ ‘orderby’ ] = ‘meta_value_num date’;
$this->args[ ‘meta_key’ ] = ANSPRESS_ANS_META ;
$this->args[ ‘meta_value’ ] = 0 ;
break;
case ‘voted’ :
$this->args[’orderby’] = ‘meta_value_num’;
$this->args[’meta_key’] = ANSPRESS_VOTE_META;
break;
case ‘unsolved’ :
$this->args[’orderby’] = ‘meta_value_num date’;
$this->args[’meta_key’] = ANSPRESS_SELECTED_META;
$this->args[’meta_compare’] = ‘=’;
$this->args[’meta_value’] = false;

break;
case ‘oldest’ :
$this->args[’orderby’] = ‘date’;
$this->args[’order’] = ‘ASC’;
break;
case ‘active’ :
$this->args[’orderby’] = ‘meta_value’;
$this->args[’meta_key’] = ANSPRESS_UPDATED_META;
$this->args[’meta_query’] = array(
‘relation’ => ‘OR’,
array(
‘key’ => ANSPRESS_UPDATED_META,
),
);
break;
case ‘with_group’ :
$this->args[’orderby’] = ‘date’;
$this->args[’order’] = ‘ASC’;
//$this->args[’meta_key’] = ‘question_group_id’;
$this->args[’meta_query’] = array(
‘relation’ => ‘AND’,
array(
‘key’ => ‘question_group_id’,
‘value’ => $q_g_id,
‘compare’ => ‘=’,
),
);
break;

// TOOD: Add more orderby like most viewed, and user order like ‘answered by user_id’, ‘asked_by_user_id’
}

}

}
endif;

function ap_get_questions($args = array()) {

if ( is_front_page() ) {
$paged = (isset( $_GET[’ap_paged’] )) ? (int) $_GET[’ap_paged’] : 1;
} else {
$paged = (get_query_var( ‘paged’ )) ? get_query_var( ‘paged’ ) : 1;
}

if ( ! isset( $args[’post_parent’] ) ) {
$args[’post_parent’] = (get_query_var( ‘parent’ )) ? get_query_var( ‘parent’ ) : false;
}

if ( ! isset( $args[’sortby’] ) ) {
//$args[’sortby’] = (isset( $_GET[’ap_sort’] )) ? $_GET[’ap_sort’] : ‘active’;

—————————————————————————–

$args[’sortby’] = (isset( $_GET[’ap_sort’] )) ? $_GET[’ap_sort’] : ‘with_group’;
GLOBAL $global_group_id;
$args[’global_group_id’] = $global_group_id;

—————————————————————————–
}

if ( is_super_admin() || current_user_can( ‘ap_view_private’ ) ) {
$args[’post_status’][] = ‘private_post’;
}

if ( is_super_admin() || current_user_can( ‘ap_view_moderate’ ) ) {
$args[’post_status’][] = ‘moderate’;
}
$args = wp_parse_args( $args, array(
‘showposts’ => ap_opt( ‘question_per_page’ ),
‘paged’ => $paged,
‘ap_query’ => ‘featured_post’,
));
//print_r($args);exit;
return new Question_Query( $args );
///$tmp = new Question_Query( $args );
//print_r($tmp); exit;
}
edited answer

Don’t throw code like this in the post. There is a special function for that: (CODE)

0

Hello,

I am still waiting for the reply from plugin guys.

Thanks

commented on answer

We not more info, just “not working” will not describe issue. Try saving your permalink to check if pagination issue get fixed.

Please let me know what info you need? I will provide you 🙂
Thanks

I have added this to our task list queue, give us some time, we will update you soon.

Thanks Rahul