Forum Replies Created

Viewing 15 replies - 61 through 75 (of 284 total)
  • the incorrect url happened to me when i selected to export only the posts.
    If i select everything, then the img urls would be correct.

    This ca be fixed with the plugin search & replace.

    Thread Starter Doug

    (@nicoblog)

    Solved must have been some persistent cache. Thanks!

    Thread Starter Doug

    (@nicoblog)

    Hello thanks for the answer, i think i will do it this way with a little variant. Instead of using categories i’ll create a custom post type for each subsite, when all posts are consolidated into the main one, i want too create a couple of custom taxonomies to use https://wordpress.org/plugins/beautiful-taxonomy-filters/
    So people would be able to filter the old sites i think it would be pretty neat feature but it will take a lot of work, some sites have thousands of posts and ten thousands of comments…i don’t wanna know how many files is that because the importer only accept 5mb files… sounds scary.

    Thread Starter Doug

    (@nicoblog)

    I’ve made all changes suggested on your last post, the counters show up so i assume all went OK, it’s a twenty fourteen child so it should be coded by the book.
    Thanks for the help!

    PS: On the post linked by aut0poietic they are doing wp_cache_flush() before every switch_to_blog. I don’t know what that does but if it’s clearing the W3 total cache…then it would have a negative effect on busy server, the load would be huge it might even crash. So i’m not doing it.

    Thread Starter Doug

    (@nicoblog)

    str_replace() was also replacing the “title” attribute of the menu items.
    I solved this by typing the anchor text in upper case, changed the str_replace to match the strings in upper case only. Since the theme already has a css rule “text-transform: uppercase;” for this items nobody notice the difference.

    Now i’m sure the replace only happens once for each item.

    How would i go about using wp_nav_menu? Is this enough or i have to change something else too?

    //change this line:
    add_filter( 'walker_nav_menu_start_el', 'prefix_nav_description', 10, 4 );
    //like this?
    add_filter( 'wp_nav_menu_args', 'prefix_nav_description', 10, 4 );

    Thanks!

    Thread Starter Doug

    (@nicoblog)

    @bcworkz, thanks for the input. I followed your post carefully and came up with new code, is this doing what i wanted? I mean only updating only every 24hs? What do you think of it?

    function prefix_nav_description( $item_output, $item, $depth, $args ) {
    $posts_counters = array(
        "Volvo" => 0,
        "Mazda" => 0,
    	"BMW" => 0,
    	"Mercedes" => 0,
    	"Porsche" => 0,
    	"Mitsubishi" => 0,
    	"Hyundai" => 0,
    	"Fiat" => 0,
    	"Ferrari" => 0,
    	"Citroen" => 0,
    	"Renault" => 0,
    );
    
    if ( false === ( $posts_counters = get_transient( 'posts_counters' ) ) ) {
    
    $original_blog_id = get_current_blog_id();
    switch_to_blog(2);
    $count_posts = wp_count_posts();
    $posts_counters["Volvo"] = $count_posts->publish;
    switch_to_blog(3);
    $count_posts = wp_count_posts();
    $posts_counters["Mazda"] = $count_posts->publish;
    switch_to_blog(15);
    $count_posts = wp_count_posts();
    $posts_counters["BMW"] = $count_posts->publish;
    switch_to_blog(18);
    $count_posts = wp_count_posts();
    $posts_counters["Mercedes"] = $count_posts->publish;
    switch_to_blog(20);
    $count_posts = wp_count_posts();
    $posts_counters["Porsche"] = $count_posts->publish;
    switch_to_blog(22);
    $count_posts = wp_count_posts();
    $posts_counters["Mitsubishi"] = $count_posts->publish;
    switch_to_blog(21);
    $count_posts = wp_count_posts();
    $posts_counters["Hyundai"] = $count_posts->publish;
    switch_to_blog(6);
    $count_posts = wp_count_posts();
    $posts_counters["Fiat"] = $count_posts->publish;
    switch_to_blog(16);
    $count_posts = wp_count_posts();
    $posts_counters["Ferrari"] = $count_posts->publish;
    switch_to_blog(17);
    $count_posts = wp_count_posts();
    $posts_counters["Citroen"] = $count_posts->publish;
    switch_to_blog(19);
    $count_posts = wp_count_posts();
    $posts_counters["Renault"] = $count_posts->publish;
    switch_to_blog( $original_blog_id );	 
    
         set_transient( 'posts_counters', $posts_counters, 24 * HOUR_IN_SECONDS );
    }
    
           $item_output = str_replace( "Volvo", "Volvo (".$posts_counters["Volvo"].")", $item_output );
    	   $item_output = str_replace( "Mazda", "Mazda (".$posts_counters["Mazda"].")", $item_output );
    	   $item_output = str_replace( "BMW", "BMW (".$posts_counters["BMW"].")", $item_output );
    	   $item_output = str_replace( "Mercedes", "Mercedes (".$posts_counters["Mercedes"].")", $item_output );
    	   $item_output = str_replace( "Porsche", "Porsche (".$posts_counters["Porsche"].")", $item_output );
    	   $item_output = str_replace( "Mitsubishi", "Mitsubishi (".$posts_counters["Mitsubishi"].")", $item_output );
    	   $item_output = str_replace( "Hyundai", "Hyundai (".$posts_counters["Hyundai"].")", $item_output );
    	   $item_output = str_replace( "Fiat", "Fiat (".$posts_counters["Fiat"].")", $item_output );
    	   $item_output = str_replace( "Ferrari", "Ferrari (".$posts_counters["Ferrari"].")", $item_output );
    	   $item_output = str_replace( "Citroen", "Citroen (".$posts_counters["Citroen"].")", $item_output );
    	   $item_output = str_replace( "Renault", "Renault (".$posts_counters["Renault"].")", $item_output );
    
        return $item_output;
    }
    add_filter( 'walker_nav_menu_start_el', 'prefix_nav_description', 10, 4 );

    Thanks.

    Thread Starter Doug

    (@nicoblog)

    I think that’s too much for me.. can you tell me if this would work?

    register_activation_hook(__FILE__, 'my_activation');
    
    function my_activation() {
    	wp_schedule_event(time(), 'daily', 'my_daily_event');
    }
    
    add_action('my_daily_event', 'do_this_daily');
    
    function do_this_daily() {
    	$original_blog_id = get_current_blog_id();
    switch_to_blog(2);
    $count_posts = wp_count_posts();
    $site1 = $count_posts->publish;
    switch_to_blog(3);
    $count_posts = wp_count_posts();
    $site2 = $count_posts->publish;
    switch_to_blog(15);
    $count_posts = wp_count_posts();
    $site3 = $count_posts->publish;
    switch_to_blog(18);
    $count_posts = wp_count_posts();
    $site4 = $count_posts->publish;
    switch_to_blog(20);
    $count_posts = wp_count_posts();
    $site5 = $count_posts->publish;
    switch_to_blog(22);
    $count_posts = wp_count_posts();
    $site6 = $count_posts->publish;
    switch_to_blog(21);
    $count_posts = wp_count_posts();
    $site7 = $count_posts->publish;
    switch_to_blog(6);
    $count_posts = wp_count_posts();
    $site8 = $count_posts->publish;
    switch_to_blog(16);
    $count_posts = wp_count_posts();
    $site9 = $count_posts->publish;
    switch_to_blog(17);
    $count_posts = wp_count_posts();
    $site10 = $count_posts->publish;
    switch_to_blog(19);
    $count_posts = wp_count_posts();
    $site11 = $count_posts->publish;
    switch_to_blog( $original_blog_id );
    }
    
    function prefix_nav_description( $item_output, $item, $depth, $args ) {
    
           $item_output = str_replace( "Volvo", "Volvo ($site1)", $item_output );
    	   $item_output = str_replace( "Mazda", "Mazda ($site2)", $item_output );
    	   $item_output = str_replace( "BMW", "BMW ($site3)", $item_output );
    	   $item_output = str_replace( "Mercedes", "Mercedes ($site4)", $item_output );
    	   $item_output = str_replace( "Porsche", "Porsche ($site5)", $item_output );
    	   $item_output = str_replace( "Mitsubishi", "Mitsubishi ($site6)", $item_output );
    	   $item_output = str_replace( "Hyundai", "Hyundai ($site7)", $item_output );
    	   $item_output = str_replace( "Fiat", "Fiat ($site8)", $item_output );
    	   $item_output = str_replace( "Ferrari", "Ferrari ($site9)", $item_output );
    	   $item_output = str_replace( "Citroen", "Citroen ($site10)", $item_output );
    	   $item_output = str_replace( "Renault", "Renault ($site11)", $item_output );
    
        return $item_output;
    }
    add_filter( 'walker_nav_menu_start_el', 'prefix_nav_description', 10, 4 );
    Thread Starter Doug

    (@nicoblog)

    Thread Starter Doug

    (@nicoblog)

    @james It shows the first person of the author list, but i doubt it was him.

    @artur But how do i know his IP?

    Thread Starter Doug

    (@nicoblog)

    Yes, but i don’t know who they are. The author comes up blank.

    Thread Starter Doug

    (@nicoblog)

    Thanks, this will stop new offenders for sure, but what do i do about the ones that already registered?

    Thread Starter Doug

    (@nicoblog)

    Well, subscribers can’t do anything. I need users to be able to post under moderation. It was all good except for this new blank author posts.

    Thread Starter Doug

    (@nicoblog)

    I haven’t. Any particular plugin that would do the job?

    Thread Starter Doug

    (@nicoblog)

    Hi thanks for helping me solve this.

    When a user a register they have by default “contributor” status so they can submit posts but not publish them.

    When we find a spammer we degrade him to “subscriber” so he can’t send anything else. This system works well for us.

    With the use of recaptcha for registration we don’t have spam at all.

    Today i found this posts that have no author, so i don’t know who is creating them therefore i cannot degrade his account.

    Is there any way to tell who created these?

    I’m sure after they become simple subscribers they won’t be able to post anymore and bots are unlikely to bypass recaptcha v2. But first i must identify the offender account.

    Thread Starter Doug

    (@nicoblog)

    Did anyone got this working on the latest WP?

Viewing 15 replies - 61 through 75 (of 284 total)