Forum Replies Created

Viewing 15 replies - 1 through 15 (of 34 total)
  • Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @tugbucket Thanks for your reply. Yes, using ajax improved loading time,but when I try to inject huge numbers of rows via ajax response to the table, browser is stuck and stop working for a few seconds.

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @prashantvatsh I considered checkboxes of WordPress posts in admin panel. The event of clicking checkbox are processed in load-scripts.php page. I think there is something in this page that makes conflict.

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @prashantvatsh I did all of your suggestions. Click event for checkbox is triggered properly and I can see ‘hello’ message per click. JS conflicts are very odd!

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @prashantvatsh Thanks for your reply. I tested it in different browsers and I checked web console. There is no error or warning. I don’t know how can I solve this problem?!

    Plugin Author Mostafa Shahiri

    (@mostafadeveloper)

    In above code, please change ‘echo’ to ‘return’ in last line of the function.

    Plugin Author Mostafa Shahiri

    (@mostafadeveloper)

    Hi
    This plugin is created to show the number of followers/followings based on user’s profile you visit and you must be a user of website (you must login) to see followings/followers information. Now, if you like to display followings/followers count for current logged in user, please follow this steps:

    step 1) open shortcode.php file, go to the end of file and add following code:

    
    function bbpf_display_follow_count(){
     $user_id = get_current_user_id();
     $output ='';
     if(!empty($user_id))
     {
        $follow_info = array_map( function( $a ){ return $a[0]; }, get_user_meta( $user_id ) );
        $followers_count = (!empty($follow_info['bbpress_followers']))? intval($follow_info['bbpress_followers']):0;
        $following_count = (!empty($follow_info['bbpress_following']))? intval($follow_info['bbpress_following']):0;
            $output ='<div class="follow_box_container">';
        $output .= '<div class="bbpf_followers" >'.__('Followers:','follow-for-bbpress').' '.$followers_count.'</div>';
        $output .= '<div class="bbpf_following" >'.__('Following:','follow-for-bbpress').' '.$following_count.'</div></div>';
    
     }
     echo $output;
    }
    add_shortcode('bbpress_follow_count','bbpf_display_follow_count'); 
    

    We define a shortcode (bbpress_follow_count) for displaying followers/followings count.
    step 2) Now you can use [bbpress_follow_count] shortcode to display followers/followings count. Place it everywhere you want.

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    I change font-family to test it. yes, you’re right. The problem is here. Now how can I solve this problem and add asterisk to this font?

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    I work on localhost. Please see following screenshots:

    Asterisk is not shown in that cell of table:
    https://imgur.com/BdRvx6A

    When I see the HTML code of this page, I can find asterisk sign in this cell:

    https://imgur.com/WyNXdEh

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @bcworkz Thanks for your explanation, I changed my code and I used template_include filter to load my template file, but it still redirects to home page. I don’t know why! I searched more for similar questions. All answers say using template_include filter can solve this problem. It seems this solution works for all but me!

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @bcworkz thanks for your reply. You are right. “route” is not a proper term for my question. I just want to define a custom URL structure for links in my plugins. When user clicks on the link, I want to display proper page. For example, in Woocommerce plugin file structure, different pages have been defined in templates directory, but I don’t know (I didn’t find the code) how does Woocommerce load the proper template page based on related request? I want to learn more about loading template files for different URLs in plugins.

    Thanks

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @jnashhawkins Thanks for your reply. I tested following commands, but none of them not working:
    1. /home/path_to_mysite/public_html/wp-cron.php?doing_wp_cron=1 >/dev/null 2>&1

    2. /usr/local/bin/php -q /home/path_to_mysite/public_html/wp-cron.php?doing_wp_cron=1 >/dev/null 2>&1

    3. wget https://mysite.com/wp-cron.php?doing_wp_cron=1 > /dev/null 2>&1

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @etiennep Thanks for your reply. When I search in postmeta table for orders meta values, I find some meta values like date_completed, completed_date, date_paid, paid_date. date_completed meta key has a timestamp value and completed_date has a datetime value, but I don’t know what data type should I set for date_paid and paid_date values?

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @mikedmoore Thanks for reply. Well I turn off loading Woocommerce.php in wp-settings.php file because I just want to include Woocommerce manually in my code when I need it. Also, I don’t want to include and use all files of Woocommerce. I just want to create objects of Order and Product classes, but I don’t know which files of Woocommerce should I include. I use following code before creating the objects of Order and Product classes, but it doesn’t solve my problem and I receive the error :”Call to a member function get_product() on null”.

    
            require_once( plugin_dir_path(__DIR__) . '/woocommerce/woocommerce.php' );
             WC_Post_Types::register_taxonomies();
             WC_Post_Types::register_post_types();
             WC_Post_Types::register_post_status();
            do_action( 'woocommerce_after_register_post_type' ); 
            do_action( 'woocommerce_init' );
            global $woocommerce;
    
    

    Please guide me.

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @bcworkz I searched again and I found a solution for minimum loading of WordPress with setting SHORTINIT constant as true. I tried to load necessary file for my plugin:

    
    if(SHORTINIT)
    {
    require( ABSPATH . WPINC . '/formatting.php' );
    require( ABSPATH . WPINC . '/capabilities.php' );
    require( ABSPATH . WPINC . '/class-wp-roles.php' );
    require( ABSPATH . WPINC . '/class-wp-role.php' );
    require( ABSPATH . WPINC . '/class-wp-user.php' );
    require( ABSPATH . WPINC . '/date.php' );
    require( ABSPATH . WPINC . '/user.php' );
    require( ABSPATH . WPINC . '/embed.php' );
    require( ABSPATH . WPINC . '/class-wp-embed.php' );
    require( ABSPATH . WPINC . '/class-oembed.php' );
    require( ABSPATH . WPINC . '/class-wp-oembed-controller.php' );
    require( ABSPATH . WPINC . '/http.php' );
    require( ABSPATH . WPINC . '/class-http.php' );
    require( ABSPATH . WPINC . '/class-wp-http-streams.php' );
    require( ABSPATH . WPINC . '/class-wp-http-curl.php' );
    require( ABSPATH . WPINC . '/class-wp-http-proxy.php' );
    require( ABSPATH . WPINC . '/class-wp-http-cookie.php' );
    require( ABSPATH . WPINC . '/class-wp-http-encoding.php' );
    require( ABSPATH . WPINC . '/class-wp-http-response.php' );
    require( ABSPATH . WPINC . '/class-wp-http-requests-response.php' );
    require( ABSPATH . WPINC . '/class-wp-http-requests-hooks.php' );
    require( ABSPATH . WPINC . '/rest-api.php' );
    require( ABSPATH . WPINC . '/rest-api/class-wp-rest-server.php' );
    require( ABSPATH . WPINC . '/rest-api/class-wp-rest-response.php' );
    require( ABSPATH . WPINC . '/rest-api/class-wp-rest-request.php' );
    require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-controller.php' );
    require(PATH_TO_MY_PLUGIN);
    return false;
    }
    
    

    In my plugin, I register routes and callbacks functions with register_rest_route function and callback functions get rest_request objects as input and return rest_response objects as output, but when I send a request, it returns nothing.

    Thread Starter Mostafa Shahiri

    (@mostafadeveloper)

    @bcworkz I try following code to remove query hook from $wp_filter, but after do_action(‘init’), the query hook is still available in $wp_filter array.

    
    function turnoff_hooks()
    {
    remove_all_filters('query',10);
    }
    add_action('after_setup_theme','turnoff_hooks');
    
Viewing 15 replies - 1 through 15 (of 34 total)