« first day (1406 days earlier)      last day (3524 days later) » 

7:50 AM
does require_once adds empty line breaks? I was requiring wp-load.php on a php file but it seems there is a empty line beaks happen when i do this..
 
8:20 AM
@Sisir no. you have whitespace issues somewhere in files
 
tried to require another file instead of wp-load.php inside my plugin it went fine :/
 
@Sisir Hidden by your adblocker?
 
probably the js cdn wasn't loading for a minute. Seems fine now..
 
8:52 AM
@Sven long live the trolls!
 
 
2 hours later…
10:40 AM
SE network updates: In case of an edit conflict resulting in automatic rejection of a suggested edit, a message is no
posted on August 19, 2014

In case of an edit conflict resulting in automatic rejection of a suggested edit, a message is now displayed to explain what happened.

SE network updates: \"You can only submit a comment vote every 5 seconds\" throttle removed.
posted on August 20, 2014

"You can only submit a comment vote every 5 seconds" throttle removed.

SE network updates: When a user without full editing privileges suggests a new edit, he now sees a warning if some of
posted on August 21, 2014

When a user without full editing privileges suggests a new edit, he now sees a warning if some of his edits were rejected.

 
 
2 hours later…
 
1 hour later…
1:33 PM
@toscho "This worked for me after working on it for 6 hours" - that's pretty dedicated for a first time answer.
 
@birgire Indeed.
 
I upvoted it, hopefully he will continue working on other questons as well with this kind of dedication - cool ;-)
 
1:48 PM
So how can I reduce the cyclomatic complexity of this baby?
public function get_names( $type, $site_id = 0 ) {

	$site_id = $this->prepare_site_id( $site_id );

	if ( self::TABLES_NETWORK_CORE === $type )
		return $this->get_core_network_tables();

	if ( self::TABLES_SITE_ALL === $type )
		return $this->get_all_site_tables();

	if ( self::TABLES_SITE_CORE === $type )
		return $this->get_core_site_tables( $site_id );

	if ( self::TABLES_SITE_CUSTOM === $type )
		return $this->get_custom_site_tables( $site_id );

	return array();
}
My brain is in weekend already. :/
 
 
1 hour later…
2:56 PM
@kaiser do you know you're site is down?
 
Question regarding this:
http://wordpress.stackexchange.com/a/8431/22728

For my CPT the default columns are:
[Title][Date]

I've multiple columns added to my CPT list-table.
So they are respectively:
[Title][Date][ID][Thumbnail[]Shortcode]
 
*your
@MayeenulIslam What's the q?
 
How can I sort them to this order:
[ID][Thumbnail][Title][Shortcode]
?
Do I have to write multiple filters?
 
@MayeenulIslam I re-assembled the array passed when adding the column
so I created a new array and put them in the order I wanted and returned the new array
 
@MayeenulIslam No, just write one callback to add/sort them all.
 
3:04 PM
@toscho perhaps something simpler like using a convention with method_exists;
public function get_names( $type, $site_id = 0 ) {

    $site_id = $this->prepare_site_id( $site_id );

    if ( method_exists($this, $type) )
        return $this->{$type}($site_id);

    return array();

}
 
@userabuser That’s hard to read
 
not with proper doc block
otherwise you dont have much choice but to go with what you have really
 
I'll leave it as it is
 
Here's my code:
<?php
function set_custom_CPT_columns($columns) {
$columns['p_id'] = __( 'ID', 'textdomain' );
$columns['p_excerpt'] = __( 'Details', 'textdomain' );
$columns['p_image'] = __( 'Preview', 'textdomain' );
$columns['until'] = __( 'Until', 'textdomain' );
$columns['p_shortcode'] = __( 'Shortcode', 'textdomain' );

return $columns;
}

add_filter( 'manage_edit-CPT_columns', 'set_custom_CPT_columns' );

function reset_columns($columns) {
$new = array();
foreach( $columns as $key => $title ) {
can I get a way to sort 'em out?
With this I can only sort the Thumbnail column before the Title column
 
@TomJNowell @MayeenulIslam that assumes no other columns have been added. I would use array_search() to get an index of a column and array_slice() to insert columns after it.
 
3:15 PM
@TomJNowell Can I have any of your code (if no bound), so that I can understand the procedure?
 
$new = array();
		foreach($columns as $key => $title) {
			if ( ( $key == 'username' ) || ( $key == 'login' ) ) {
				$new['new_column'] = 'new column';
			}
			$new[$key] = $title;
		}
		return $new;
something like that, there i'm adding a new column just before the username/login column
it's not directly applicable to what you're doing I guess but what you're trying to do is more fiddly
 
} catch ( phpmailerException $e ) {
continue;
}
 
It's exact same to http://wordpress.stackexchange.com/a/8431/22728
I's looking for a multiple column sort-code
 
was going to comment recommending WP_DEBUG but why even bother...
 
@MayeenulIslam thats probably where I got it from
 
3:21 PM
@MayeenulIslam Add more if conditions as appropriate.
 
@StephenHarris I tried that, and that's the problem, it's not working
If I put another condition after
`if ($key=='title') $new['p_image'] = 'Preview';`

like:
`if ($key=='until') $new['date'] = 'Test';`
 
You have two functions. set and reset - just merge them. Loop through existing columns and add columns to $new array, and add in the new column(s) when you're at the point in the array where you want them. Finally return the $new array.
 
it renders replacing the title of the 'Date' column to "Test"
 
@MayeenulIslam Why are you setting the title of date? You shouldn't need to be touching that.
 
@StephenHarris With not much PHP background it's hard to understand, I'm afraid.
@StephenHarris Actually I's not touching, I's trying to sort the "Until" column before "Date" column
 
3:28 PM
@MayeenulIslam Don't add them in and sort them. Add them in, in the order you want them.
@MayeenulIslam That's more complicated, if you want to add a column in before another one, then you either need to look ahead or use the array_search/array_splicemethod.
 
3:38 PM
Actually the [Title] and [Date] column are by-default. I'm not adding 'em again. I'm just adding my columns: [ID][Thumbnail][Shortcode].
But you know by default they are adding after the default columns:
[Title][Date][ID][Thumbnail][Until][Shortcode]

But I want them to be:
[ID][Thumbnail][Title][Date][Until][Shortcode]

If I `unset()` any column, I can't reset 'em. And I already explained that, even with multiple `if()` conditions, I failed to sort 'em.
 
@MayeenulIslam See this for inserting values at specific location: gist.github.com/stephenharris/94246e7b5d709ba6a6ec
 
3:58 PM
@StephenHarris That's a very good one. Let me try it. Thanks a lot in advance.
 
4:31 PM
Holy shit, the close votes!
 
5:06 PM
@toscho after you
 
haha, no time for that
 
the weather swings and work brain block are having me... not very functional this week :)
 
 
2 hours later…
7:31 PM
public function get_names( $type, $site_id = 0 ) {

$site_id = $this->prepare_site_id( $site_id );

$cbs = array(
self::TABLES_NETWORK_CORE => 'get_core_network_tables',
self::TABLES_SITE_ALL => 'get_all_site_tables',
self::TABLES_SITE_CORE => 'get_core_site_tables',
self::TABLES_SITE_CUSTOM => 'get_custom_site_tables',
);

return in_array( $site_id, array_keys( $cbs ), TRUE )
? $this->$cbs[$site_id]
: array();
}
@toscho
 
8:10 PM
@toscho well you somehow had time for 1k rep this month... :[
 
 
2 hours later…
9:44 PM
@G.M. That was my first idea, but then it is hard to track used vs unused methods.
@Rarst oh, indeed. that's strange
 

« first day (1406 days earlier)      last day (3524 days later) »