Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 15 replies - 1 through 15 (of 15 total)
  • @antonyc

    Participant

    Hi @shanebp, wondering if you have any more thoughts on how I may proceed with this? Cheers, Ant

    @antonyc

    Participant

    Hi @wettowel, did you manage to resolve this as I’m having issues filtering the members loop too?
    Cheers, Ant

    @antonyc

    Participant

    UPDATE:: I tested this code on a BuddyPress installation I have and get the same results so not a buddyboss issue.

    @antonyc

    Participant

    …my full code currently in bp-custom.php…

    function set_ic_members_var() {
        //set your global var here
        
        global $ic_filter_members_interest_id;
        
        if (isset($_GET["ia"])) {
            $ic_filter_members_interest_id = $_GET["ia"];
        } else {
            $ic_filter_members_interest_id = 'unset!';
        }
    error_log('>>>>>>> set_ic_members_var::  $ic_filter_members_interest_id:'.$ic_filter_members_interest_id.'  >>>> '.$date = date('m/d/Y h:i:s a', time()).' <<<<');
        
    
    }
    add_action( 'bp_ready', 'set_ic_members_var' );
    
    function ic_members_filter( $retval ) {
    
        global $wpdb;
        
        global $ic_filter_members_interest_id;
    
    error_log('>>>>>>> ic_members_filter::  $ic_filter_members_interest_id:'.$ic_filter_members_interest_id.'  >>>> '.$date = date('m/d/Y h:i:s a', time()).' <<<<');
    
        if( $ic_filter_members_interest_id &&  $ic_filter_members_interest_id>0 ){
     
            $prepared_statement = $wpdb->prepare( "SELECT user_id FROM ic_interests_data WHERE interest_id = %d AND (interest_value = 1 OR interest_value = 3)", $ic_filter_members_interest_id );
            $db_custom_ids = $wpdb->get_col( $prepared_statement );
            
    
            if ( $db_custom_ids ) { //!empty( $db_custom_ids )
                
                // convert the array to a csv string
                $retval['include'] =  implode(",", $db_custom_ids);  //$custom_ids_str = 'include=' . implode(",", $custom_ids);
            }
            else{
                
                // don't show any records
                $retval['include'] = array(0);
            }
    
        }else{
            // show all records
            $retval['include'] = '';
        }
     
        return $retval;
    }
    add_filter( 'bp_after_has_members_parse_args', 'ic_members_filter' );

    @antonyc

    Participant

    …apologies, I noticed had another function still running – still not working but here is a cleaner log with just the two functions…

    [23-Feb-2020 18:42:39 UTC] >>>>>>> set_ic_members_var::  $ic_filter_members_interest_id:9  >>>> 02/23/2020 06:42:39 pm <<<<
    [23-Feb-2020 18:42:44 UTC] >>>>>>> ic_members_filter::  $ic_filter_members_interest_id:  >>>> 02/23/2020 06:42:44 pm <<<<
    [23-Feb-2020 18:42:44 UTC] >>>>>>> ic_members_filter::  $ic_filter_members_interest_id:  >>>> 02/23/2020 06:42:44 pm <<<<
    [23-Feb-2020 18:42:44 UTC] >>>>>>> ic_members_filter::  $ic_filter_members_interest_id:  >>>> 02/23/2020 06:42:44 pm <<<<

    @antonyc

    Participant

    Thanks for this suggestion, unfortunately I have the same issue …I placed both functions in bp-custom.php and this is my debug log (you can see the multiple loads of these functions)…

    [23-Feb-2020 18:34:27 UTC] >>>>>>> ic-members-main.php::  $ic_filter_members_interest_id:9  >>>> 02/23/2020 06:34:27 pm <<<<
    [23-Feb-2020 18:34:28 UTC] >>>>>>> set_ic_members_var::  $ic_filter_members_interest_id:9  >>>> 02/23/2020 06:34:28 pm <<<<
    [23-Feb-2020 18:34:33 UTC] >>>>>>> ic-members-main.php::  $ic_filter_members_interest_id:  >>>> 02/23/2020 06:34:33 pm <<<<
    [23-Feb-2020 18:34:33 UTC] >>>>>>> ic_members_filter::  $ic_filter_members_interest_id:  >>>> 02/23/2020 06:34:33 pm <<<<
    [23-Feb-2020 18:34:33 UTC] >>>>>>> ic_members_filter::  $ic_filter_members_interest_id:  >>>> 02/23/2020 06:34:33 pm <<<<
    [23-Feb-2020 18:34:33 UTC] >>>>>>> ic_members_filter::  $ic_filter_members_interest_id:  >>>> 02/23/2020 06:34:33 pm <<<<

    @antonyc

    Participant

    Hi @shanebp, thanks for your quick response.

    Yes, I can but I’ve found that because wordpress loads the theme functions.php/plugins 2-3 times the variable will set ok on one of these iterations but not on the iteration where bp_after_has_members_parse_args() is fired (not sure how best to explain this as not a pro wp developer but have read about this phenomena online (I have disabled plugins/theme to check it’s nothing to do with my code causing multiple loads). I’m assuming that functions.php is loaded again when the members ajax call is made?

    So how to capture using $_GET and then make this available to bp_after_has_members_parse_args()?

    Thanks again,
    Antony

    @antonyc

    Participant

    Hi @mercime, you are right. Sorry I haven’t replied sooner as have been away.
    My theme designer had a couple of forum template pages (archive-forum.php and forum.php) that I added to my buddypress child theme – it’s fixed both my forum issues and my blog.
    Really appreciated your support with this one – a big thank you!
    Cheers,
    Antony

    @antonyc

    Participant

    Hi, Sorry to bombard you with posts here. Latest update…

    On a different install of WP-2013 theme with bbpress and buddypress, everything works – blog, buddypress and forums!!

    When I then activate my theme all works but the bbpress forum root – this again resolves as my blog archive, which is the same issue as reported in the thread link I posted earlier.

    Not sure where to go from here.

    Cheers, Antony

    @antonyc

    Participant

    sry – the archive slug is the root forum slug isn’t it?

    @antonyc

    Participant

    Also, I’ve found this thread regarding the same issue…

    How do I use the shortcode in a template file?

    It’s a longstanding issue with bbpress (over a year now) which many folk are also having as well as me! Any suggestions regarding this?

    @antonyc

    Participant

    Hi, I’m not sure what you mean by forum archive slug – I don’t see that in the settings page. Also, I can’t leave my site on twenty twelve – it’s live and uses a different theme. Whenever I make a change I have been refreshing permalinks.
    Cheers,
    Antony

    @antonyc

    Participant

    PS: I also deleted my .htaccess to start afresh when doing the above.

    @antonyc

    Participant

    Hi, I’ve done all you suggested.

    OK, so with all plugins disabled…
    –When I first switch to WP 2013 theme…
    —-my blog functions fine
    —-the root forum url works fine BUT…
    —-clicking on any forum, topic etc returns a 404 Error.
    –Then, when I refresh the permalinks…
    —-my blog page 2 returns a 404 error.
    —-all bbpress urls seem to be fine.

    –When I switch back to my Theme…
    —-my blog functions fine (using the ‘blog’ slug)
    —-the root forum url works fine BUT…
    —-clicking on any forum, topic etc returns a 404 Error.
    –Then, when I refresh the permalinks…
    —-my blog page 2 returns a 404 error.
    —-the bbpress root forum now returns my blog Archive (which isn’t formatted correctly).
    —-refreshing open pages for forums and topics etc now work fine.

    You can view the pages at…
    http://thechildrensfiremovement.com/discussion/
    and http://thechildrensfiremovement.com/discussion/topic/test-topic-for-first-test-forum/

    If I were to now change the slug of the root forum to ‘cfm-discussions’ (so it’s different to the forum index page slug) it would then function correctly until someone clicks on the breadcrumb taking them to the ‘cfm-discussion’ slug – this would return the blog Archive!) – hope you can follow this!

    So, it’s nothing to do with my plugins, and, although it does return slightly different results depending on the theme it still doesn’t function correctly and does seem to be somthing more core with WP – what do you think?

    Appreciating your support in this,

    Antony.

    @antonyc

    Participant

    Hi @mercime thank you so much for your speedy reply.
    I went through the steps in the link and have managed to get a sitewide forum working <<BUT>> with the same issue I outlined above (which I think is a core issue with my WP) in that I can get a forum index page working if its slug is different to the Forum Root Slug in the settings page. This works until the breadcrumb slug is clicked on (which is defined by the Root slug) and slips back to my blog archive page!! If, as in my initial post, the Root Slug is the same as my index page slug it, displays my blog archive!
    Any thoughts on what seems to be a core post-type/permalink kind of issue?
    Many thanks,
    Antony

Viewing 15 replies - 1 through 15 (of 15 total)
Skip to toolbar