Forum Replies Created

Viewing 15 replies - 1 through 15 (of 54 total)
  • Thread Starter Pierre from DesignBots

    (@mecanographik)

    Justin,
    I have found the solution, but i had to replace a line in your plugin.
    Your method to retrieve current permalink is not ‘universal’ because it doesn’t work with content like buddypress profile or group page (they are not CPT).
    So, in class-ga-top-content, around the line #545, replace :

    $permalink = get_permalink( $atts['post_id'] ); // original method

    with this :

    /*
    Get current page URL in WordPress
    for Buddypress compatibility
    With this method, It doesn’t matter if you need it on single post, page, home, 
    category, tag, Buddypress user profile, group, custom post type or any other WordPress template.
    */
    global $wp;
    $permalink = home_url(add_query_arg(array(),$wp->request));
    /*
    end custom code
    */

    now it works!
    I will post an issue on your Github repo

    Thanks again, hope you will update your plugin soon or add a apply_filter to manipulate the current url.

    regards,

    Thread Starter Pierre from DesignBots

    (@mecanographik)

    Hi, i have just realised that even without any add_filter on your shortcode doesn’t work anywhere on my wordpress site. For example when i paste the shortcode in my “contact” page i dont get anything… so this shortcode doesnt work :

    [google_analytics_views]count[google_analytics_views]

    but this one does work:

    [google_analytics_views]

    Thread Starter Pierre from DesignBots

    (@mecanographik)

    Thanks Justin,
    I have been trying do accomplish this during 6 hours without luck.
    I think [google_analytics_views] shortcodes use the current page url to generate the results. Are you able to make this filter (gtc_modify_request_metric) working on your sandbox (if you change ‘membres’ slug with another slug you use on your site ?
    My question is: With this shortcode, can i display on “Page A” the number of GA views of page “B” ? do we have to modify ‘$link_uri ‘ founded in plugin class in function views_shortcode() ? Please help.

    Thread Starter Pierre from DesignBots

    (@mecanographik)

    Where do you define this filter ‘gtc_analytics_top_content_shortcode_request_params’ ?
    This filter seems to work, i would like the same filter for ‘google_analytics_views’ shortcode. it looks like there are other params which generates 0 results when i apply only one filter (ga:pagePath=~/membres/*’;)
    thank for your help !

    to compare, this works:

    
    function gtc_modify_request_metric( $params ) {
      
      $params['dimensions'] = 'ga:pageTitle,ga:pagePathLevel2'; // 2nd level page
      $custom_filters = 'ga:pagePath=~/membres/*';
      $params['filters'] = urlencode( $custom_filters );
     
      return $params;
    }
    add_filter( 'gtc_analytics_top_content_shortcode_request_params', 'gtc_modify_request_metric' );

    this does not works (only the add_filter change):

    function gtc_modify_request_metric( $params ) {
      
      $params['dimensions'] = 'ga:pageTitle,ga:pagePathLevel2'; // 2nd level page
      $custom_filters = 'ga:pagePath=~/membres/*';
      $params['filters'] = urlencode( $custom_filters );
     
      return $params;
    }
    
    add_filter( 'gtc_views_shortcode_ga_filters_param', 'gtc_modify_request_metric' );

    Thanks again if you have a clue πŸ˜‰

    Thread Starter Pierre from DesignBots

    (@mecanographik)

    I have tested on this url :
    https://www.time2sail.com/membres/time2sail/profile/analytics/?delete-trans=1

    but it didn’t change anything, no rows…
    thanks for the tip i will keep this get param during my test…

    Thread Starter Pierre from DesignBots

    (@mecanographik)

    I have also noticed that your gist doesn’t neither work with the top-content widget on my wordpress installation:

    https://gist.github.com/jtsternberg/918238ff899c2762b41b

    when i applis those filters, i get no result with this param $params[‘metrics’] = ‘ga:uniquePageviews’ …

    but this works:

    function gtc_modify_request_metric( $params ) {
      
      // test for 'membres' slug
     
          $custom_filters = 'ga:pagePath=~/membres/*';
          $params['filters'] = urlencode( $custom_filters );
     
      return $params;
    }
    add_filter( 'gtc_analytics_top_content_shortcode_request_params', 'gtc_modify_request_metric' );
    add_filter( 'gtc_analytics_top_content_widget_request_params', 'gtc_modify_request_metric' );

    Interesting…

    Thread Starter Pierre from DesignBots

    (@mecanographik)

    In addition, i have tested my google analytics query with this awesome tool:
    https://ga-dev-tools.appspot.com/query-explorer/

    in this tool, with those filters i get some results (i have changed my GA account ID in the example) :

    https://www.googleapis.com/analytics/v3/data/ga?ids=ga%123456798&start-date=30daysAgo&end-date=yesterday&metrics=ga%3Apageviews&dimensions=ga%3ApagePathLevel2

    when i convert it to use it with your filters ‘modify_gtc_views_shortcode_ga_filters_param()’ i have this:

    $filters = 'ids=ga:123456798&start-date=30daysAgo&end-date=yesterday&metrics=ga:3Apageviews&dimensions=ga:3ApagePathLevel2';

    Ok? But the filter doesn’t work… any idea?

    Thread Starter Pierre from DesignBots

    (@mecanographik)

    Hi Justin,
    Thanks for your quick answer. I’ve tried your snippet with different filters ga combination, but without luck.
    i want to display some goggle analytics stats for example on this page:
    https://www.time2sail.com/membres/jean-baptiste-gellee/

    I’ve some stats in my dashboard for this page path: ‘/jean-baptiste-gellee/’

    to display the stats on the same page i use this code:

    echo do_shortcode( '[google_analytics_views]Your profile has been visited count times.[/google_analytics_views]' );

    is this correct?
    so, what could i do?

    Thanks

    +1 how to show the form after user profile update with group interests checkboxes checked ?

    Hi itaybd,
    This is a work in progress for me, and this is what i’m trying to do using ajax, because, obviously, the best way is to have only one instance of fullcalendar and just change the events list thanks to ajax and some $args filters, here the thread :

    https://wordpress.org/support/topic/ajax-refetch-events-with-wpfc_fullcalendar_args?replies=1

    Hope they reply soon than i will be happy to share the entire solution πŸ˜‰

    Regards,

    Hi,
    i’m modified this snippet to set a buddypress member type during the registration using wordpress social login and it works if i use a default string.
    But what i can’t do is to get a parameter from the url using php GET method, here is my code:

    add_action('wsl_hook_process_login_after_wp_insert_user', 'wsl_hook_process_login_after_wp_insert_user_callback', 10, 3);
    function wsl_hook_process_login_after_wp_insert_user_callback($user_id, $provider, $hybridauth_user_profile) {
    
        $u = new WP_User( $user_id );
    
        if (isset($_GET['mtype'])) {
          // this doesnt work for now, cant get the "GET" parameter
            $member_type =  $_GET['mtype'];
        }
        else {
          // this works for now
          $member_type =  'my-default-member-type'; // default value
        }
    
        bp_set_member_type( $user_id, $member_type );
    
    }

    any idea what i can do to catch the get parameter ? here is the corresponding url i was able to generate during the registration process, after the user has manage to connect is Facebook account and his account was successfully created:

    https://www.time2sail.com/wp-login.php?action=wordpress_social_authenticated&provider=Facebook&mode=login&mtype=my-selected-member-type

    Thanks for your help!

    Thread Starter Pierre from DesignBots

    (@mecanographik)

    Thanks angelo i’ve managed to do what i wanted: enable booking programmatically during the event creation.
    The trick was to create a new ticket in the db using the $EM_Ticket object

    Here is my code :

    $EM_Event = new EM_Event();
    
    /*
    // time strings for test
    $EM_Event->event_start_date = "2016-01-26";
    $EM_Event->event_end_date = "2016-01-26";
    $EM_Event->event_start_time = "16:30:00";
    $EM_Event->event_end_time = "18:30:00";
    */
    
    $cur_time = current_time( 'timestamp', 1 );
    $timestamp_start = strftime("%Y-%m-%d %H:%M:%S", $cur_time + 720*60*60); // 720 hours = + 30 days
    $timestamp = strftime("%Y-%m-%d %H:%M:%S", $cur_time + 744*60*60); // 720 hours = + 30 days
    
    //$date_start_default = date( 'Y-m-d', current_time( 'timestamp', 1 ) );
    $date_start_default = date( 'Y-m-d', strtotime($timestamp_start) ); // time + 1 year to enable booking
    $date_end_default = date( 'Y-m-d', strtotime($timestamp) );
    $date_time_default = date( 'H:i:s', strtotime($timestamp_start) );
    //$date_time_default = date( 'H:i:s', current_time( 'timestamp', 1 ) );
    
    $EM_Event->event_start_date = $date_start_default;
    $EM_Event->event_end_date = $date_end_default;
    
    $EM_Event->event_start_time = $date_time_default;
    $EM_Event->event_end_time = $date_time_default;
    
    $EM_Event->start = strtotime($EM_Event->event_start_date." ".$EM_Event->event_start_time);
    $EM_Event->end = strtotime($EM_Event->event_end_date." ".$EM_Event->event_end_time);
    
    $EM_Event->event_private = 0;
    $EM_Event->event_status = 1;
    $EM_Event->event_rsvp = 1;
    $EM_Event->event_rsvp_date = $date_end_default;
    $EM_Event->rsvp_end = $date_end_default;
    $EM_Event->event_rsvp_time = $date_time_default;
    $EM_Event->event_rsvp_spaces = 0;
    $EM_Event->event_spaces = 10000;
    $EM_Event->event_all_day = 0;
    
    $EM_Event->event_owner = $user_id;
    
    // attach the event to a buddypress group
    // we presume you've got the related group_id
    $EM_Event->group_id = $group_id;   
    
    $EM_Event->post_content = $post_content;
    $EM_Event->post_excerpt = '';
    $EM_Event->event_slug = $post_slug;
    $EM_Event->event_name = $post_title;
    
    // we could save booking information on event creation
    // for eg. If we want the event creator to have automaticaly his booking recorded
    
    // create the event post to link with the bp group
    
    $EM_Event->save();
    $EM_Event->save_meta();
    
    /*
    // we need now to save a new ticket for this event to enable booking
    // in db table 'wp_em_tickets'
    // see function 'save' in classes/em-ticket.php
    * ===================================================================
    */
    
    // we need to catch back the event id
    $current_event = em_get_event($EM_Event->ID,'post_id');
    $current_event_id = $current_event->event_id;
    
    $EM_Ticket = new EM_Ticket();
    $EM_Ticket->event_id = $current_event_id;
    $EM_Ticket->ticket_name = $EM_Event->event_name;
    $EM_Ticket->ticket_end = $EM_Event->rsvp_date;
    
    if ($current_event && $EM_Event->event_rsvp == 1) {
    $EM_Ticket->save();
    }

    Thanks for your support
    Hope that helps someone else πŸ˜‰

    This topic is resolved, here the solution

    Thread Starter Pierre from DesignBots

    (@mecanographik)

    Heads up:
    The Buddyboss Team has kindly reply to my ticket within the official Buddyboss support section, so here is the working snippet in case someone need it!

    /*
    * custom code for Buddypress Global Search
    * filter search types
    * We override bb_global_search_default_items_to_search()
    * see: includes/class.BBoss_Global_Search_Helper.php
    */
    
    function bboss_global_search_filter_search_types( $search_types ){
    
      if( !empty( $search_types ) ){
    
        //$items_to_remove = array( 'posts' ); // test excluding only this search type
        $items_to_keep = array( 'posts' ); // test including only 'posts' search type for eg.
    
        if ( is_search() ) {
          $items_to_keep = array( 'members' ); // test: applied only on search results page
        }
    
        $filtered_search_types = array();
        foreach( $search_types as $search_type ){
          // if( !in_array( $search_type, $items_to_remove ) ){
          if( in_array( $search_type, $items_to_keep ) ){
            $filtered_search_types[] = $search_type;
          }
        }
        $search_types = $filtered_search_types;
    
        /*
        // for debug
        echo '<pre>';
        print_r($search_types);
        echo '</pre>';
        */
    
        return $search_types;
      }
    }
    remove_filter( 'buddyboss_global_search_option_items-to-search', 'bb_global_search_default_items_to_search' );
    add_filter( 'buddyboss_global_search_option_items-to-search', 'bboss_global_search_filter_search_types');

    It works great on auto completion, thanks a lot BB Team!

    Hi,
    This method works for search results page but doesn’t work for ajax search result (jquery autocomplete)
    Is there another filter or action hook we can use to filter out default items to search in ajax search?

Viewing 15 replies - 1 through 15 (of 54 total)