« first day (429 days earlier)      last day (4501 days later) » 

 
1 hour later…
11:14 AM
@Brady short javascript Q :)
 
go for it
 
// js:
var whatever = getValue();
<?php
$something = // How do I get my var whatever value in here?
thanks!
 
submit via GET or POST to PHP script
 
not possible :/
 
I dont know of any script that can render client side script on the server
 
11:17 AM
unless you are using node.js or something
what is the issue with GET ?
 
I'm just searching for an easy way to get lat/lng values from post_meta data into a query to render markers in a map. Needed for a meta_query BETWEEN lat_min/lat_max, lng_min/lng_max - based on the bounds/viewport
So my problem is that I get the bounds from the map. When I can't pass the bounds directly to my query, I need to add a button and run this all through ajax script...
 
11:48 AM
any good for you?
does a nice bit of the processing bit
^^ only radius check though
but puts post lat/lng cords in a better optimized table for quicker post searching
 
@Brady Thanks. So what exactly does this plugin do? Re-route post meta save process to a stand-alone table?
 
pretty much that yeah
also has built in API for radius checks
so no need to worry about those complicated SQL queries :)
 
Only thing is that the meta keys have to be named lat and lng?
 
no
 
Ah, ok. Filter there. When should the filter be hooked?
 
12:01 PM
from theme functions file works fine
so anywhere from there or before
 
Doesn't solve my problem, but nice tough :)
 
No I wasnt saying it would
just showing you it as it might help you with other part
 
Absolutely. And query has to be run with accessing the class or did I oversee some public API?
 
been a long time since i did this let me look
nope you do the query by the class.
	if (!isset($sc_gds)) {
		$sc_gds = new sc_GeoDataStore();
	}
$_SESSION['homes_for_sale_map_search_results'] = $sc_gds->getPostIDsOfInRange("homes-for-sale", $dist, $_SESSION['s_property_address_lat'], $_SESSION['s_property_address_lng']);
^^ thats how I use it
I should maybe wrap an API around it but I don't have the time now.
 
Ah, ok. Thanks.
 
12:09 PM
who the heck favourite my post "submit via GET or POST to PHP script"?
 
me
 
@Brady btw: I get unexpected output during activation. Either undefined index or unexpected output :)
 
haha
you break it somehow?
turn notices off :P
 
WP_DEBUG true...
 
@Brady: I have been trying to do this other than GET/POST method a long time ago... but could not find any better solution
@Brady: I have been trying to do this other than GET/POST method a long time ago... but could not find any better solution
 
12:13 PM
@booota double post FTW!
 
@Brady Needs isset check for $_GET on line 138. Then works fine
 
@Brady: caz of timeout error :(
 
@kaiser cheers :) if you have any other development you want to add then feel free to and then submit to me. I'll then update the repository and pass it off as my own work ;)
 
@Brady Yea. btw: Why are those defaults for the query functions? borders of UK?
 
its co-ords of London
i think
remember the radius is done in miles
if you want in km you need to convert to miles
Wish @Jan was back with us. He helped me so much with the SQL in the GEO Data store plugin
 
12:42 PM
@Brady When looking at getPostIDsOfInRange(), then the result is only the post_id, because of $wpdb->get_col(). Why not $wpdb->get_row()? This way you get the distance too...
 
becuase i just pass the ID's to a wp_query() using post__in and order by post__in too
I've never needed to show the distance before so never returned it
plus the idea of this is to be as quick as possible. No point returning uneeded data as they say
 
@Brady getPostIDsByRange is failling with unknown column t.lat...?
 
@kaiser stop breaking things...
hang on looking into
 
@Brady :P
t not defined anywhere...
 
lol that function would never work as t doesnt exist
			// Create sql for distance check
			$sqldistancecheck = "
			SELECT
				`$this->tablename`.`post_id`,
				3956 * 2 * ASIN(
					SQRT(
						POWER(
							SIN(
								( ".(float) $search_lat." - `$this->tablename`.`lat` ) * pi() / 180 / 2
							), 2
						) + COS(
							".(float) $search_lat." * pi() / 180
						) * COS(
							`$this->tablename`.`lat` * pi() / 180
						) * POWER(
							SIN(
								( ".(float) $search_lng." - `$this->tablename`.`lng` ) * pi() / 180 / 2
							), 2
						)
^^ should be
 
12:57 PM
@Brady Already tried fixing that this way before. doesn't work... for some reason Unknown column '$wpdb->prefix_geodatastore.post_id' in 'field list' is the error...
(me added $wpdb->prefix only here for reading)
 
ummm
 
guess something with the quotes
 
but .post_id does exist
I'm missing the obvious here aint I?
 
@Brady Something with the quotes. Surely..
 
		public function getPostIDsByRange($post_type, $search_lat = 51.499882, $search_lng = -0.126178, $orderby = "ASC") {
			global $wpdb;// Dont forget to include wordpress DB class

			// Create sql for distance check
			$sqldistancecheck = "
			SELECT
				`{$this->tablename}`.`post_id`,
				3956 * 2 * ASIN(
					SQRT(
						POWER(
							SIN(
								( ".(float) $search_lat." - `{$this->tablename}`.`lat` ) * pi() / 180 / 2
							), 2
						) + COS(
							".(float) $search_lat." * pi() / 180
						) * COS(
try that
@kaiser does that work?
 
1:05 PM
@Brady tried that and missed the last $this->tablename for FROM ... that's why it didn't work before...
now works
 
ur fault then ;)
 
@Brady got mail
 
looking now
 
EOF
 
Cheers for that I'll tap that onto the end of my modified version
 
1:15 PM
Wait.
For some reason custom table doesn't get updated
 
brb got brainstorm lunch
 
left for a while, 71 unread... sometimes I feel that people are afraid to talk when I am in chat :P
crickets
 
1:41 PM
@Brady Now works again, but for delete post meta, you're hooking into 'deleted_post_meta' action, which doesn't exist...
 
1:53 PM
@Brady hook would be 'delete_post_meta', but dunno what that's supposed to do... I'd expect to it to delete the table row
 
2:08 PM
@All wow
 
@kaiser just poorly worded
 
@Rarst imho no. guy speaks good english and knows what he's saying.
 
@kaiser back
 
@Brady you got mail
 
i saw
when i was in meeting i figured out why updating wasnt working
its cos you removed the class on load
but you figured that out anyway
 
2:26 PM
@Brady Yea, but delete doesn't work for some reason
 
1
Q: How to hook update_post_meta and delete_post_meta?

BradyI'm still struggling to get my head around this whole hooking into things, so I'm really stuck on trying to do the following task: If update_post_meta is fired then check to see if the meta_key is equal to something (I want to trigger some code if a particular meta_key is used). If the meta key ...

thats where i got it from
i think the last answer has something to do with it
 
@Brady puh. c-o-m-p-l-i-c-a-t-e-d ...
(but got my upvote)
 
haha
so yeah dont delete or update your post from edit post screen
@Kaiser I'm gonna have a play around with it now, try and figure all this mess out
toilet break first though
 
@Brady Haha! TOO much detail, mate!
 
TMI? are you kidding me?
 
2:54 PM
@Brady No? Toilet = tmi :)
 
why is saying "going for a toilet break" tmi?
tmi would be: im of to the toilet to take a huge sh*t
 
@Brady :D
 
just for the record that wasnt the case for my toilet break
 
3:13 PM
@kaiser delete_meta() has royally fucked it up :(
because only $mid is given I got to pull info on that mid to determine if I can delete it or not
And the way I hook means this check will be added to all meta. Which seems like a huge waste
 
@Brady sssshht.
Btw: How would you delete something if not from edit.php?
 
f*****g WordPress!
 
@Brady I buy an "u" :D
 
eh?
ah
lol
i cannot think of a good way to sort this
best way is that I store the the meta_id in my table too
 
@Brady Guess that would be most easy solution...
 
3:27 PM
Aaaargh!
0
Q: Google not index my Custom 404 page ?why?

realcoderI have a movie site when i create First Look of that movie there also created further links related to that movie in the end of the Post using meta tags For Example Movie HD Videos Movie Mp3 Songs Movie Trailer and in future whenever i create same links with which created in the end of every P...

 
@kaiser your just agreeing with me cos you have no idea what im talking about?
@toscho lol
 
@Brady No, I've already tried to dig in and ended up with jungle-link-mess of filters. Storing meta_id sounds like bypassing the "wtf" in this...
 
yeah but it still means I add a DELETE FROM on every deletemeta request
I want to avoid changing the table at this stage
looking at: get_post_meta_by_id($mid); atm
maybe that will give me the info I need
 
@Brady Currently fighting on three sides with code. Tell me when I have to jump in.
 
@kaiser ok
ffs! i get a server error 500 when I do this:
$mid = 1292;
$meta_data = get_post_meta_by_id($mid);
print_r($meta_data);
 
3:44 PM
@Brady inside deleted_post_meta?
 
no in functions.php of theme. I wanted to test what was returned
I'm thinking is cos that function is not available at that point
 
@Brady works for me from functions.php into admin_footer
 
urm ok
 
@Brady tested with 3 IDs and all work without a problem. sure you got a valid meta id?
 
yup
nvm I copied the function and renamed and it worked
so I could see what was returned
		/**
		 * Hooked into deleted_post_meta
		 *
		 * @param array $deleted_meta_ids Array of Meta data row ID's that were deleted
		 * @param int $post_id Post ID
		 * @param string $meta_key Meta data key name
		 * @param array $only_delete_these_meta_values Dunno whats here but dont need it anywway...
		*/
		public function deleted_post_meta($deleted_meta_ids, $post_id, $meta_key, $only_delete_these_meta_values) {
			$this->meta_data_captured($post_id, $meta_key, "delete");
		} // End deleted_post_meta function
			add_action('deleted_post_meta', array(&$this, 'deleted_post_meta'), 10, 4);
            add_action('delete_postmeta', array(&$this, 'delete_postmeta'), 10, 1);
 
3:47 PM
@Brady ???
 
^^ that should now work on delete from ajax method
gonna tidy up and Ill send you v1.3
and you can test :)
 
@Brady jo!
merci!
 
@kaiser you've got mail!
 
@Brady Thx. You made this out of the first mail I sent you? (one API parameter too much)
@Brady Just delete the $full
 
4:04 PM
ok one mo
but that working correctly now?
is it removing from the table?
if its working I'll push the update to the repository
 
@Brady When in CPT list view edit.php?post_type=CPT_NAME&deleted=1 => no
 
ummm
 
Still full entry for post ID in geodatastore
 
add_action('deleted_post_meta', array(&$this, 'deleted_post_meta'), 10, 4);
because the hook becomes:
add_action('deleted_CPT_NAME_meta', array(&$this, 'deleted_post_meta'), 10, 4);
FFS!
 
So maybe $GLOBALS['hook_suffix']
 
4:12 PM
how is that gonna work here?
 
@Brady hook_suffix is wrong. $post_type should be doing it, but not present during deletion... grmpf
 
maybe I adjust my filter:
	add_filter('sc_geodatastore_meta_keys', 'homes_for_sale_geodata');
	function homes_for_sale_geodata($keys) {
		$keys['lat'][] = "chb_homes_for_sale_address_latitude";
		$keys['lng'][] = "chb_homes_for_sale_address_longitude";
		return $keys;
	}
to include post_type
what you think?
 
@Brady Also thought about this. Not too sure.
What if you don#t need the filter?
 
or I run get_post_types() and just hook into all of them
 
@Brady or the filter is a multi dimensional array and has the post type as key and the meta keys as sub array.
this would allow adding different inputs for different post types. else it would break
 
4:18 PM
nah it wouldnt break
 
function plugin_index_latlng( $meta_keys )
{
	$meta_keys['POST_TYPE_A']['lat'][] = 'a_lat';
	$meta_keys['POST_TYPE_A']['lng'][] = 'a_lng';
	$meta_keys['POST_TYPE_B']['lat'][] = 'b_lat';
	$meta_keys['POST_TYPE_B']['lng'][] = 'b_lng';

	return $meta_keys;
}
add_filter( 'sc_geodatastore_meta_keys', 'plugin_index_latlng' );
 
because the keys are tied to post_id which is unique even if diff post_types
umm ok lets see how that works out
but my filter is not going to be ready at __construct()
__Construct is where im doing my hooks
 
yea...
 
ideas?
if you setup the filter in your theme functions file is it ready when wordpress fires init ?
but then the hooks would be hooked too late...
this is too complicated
DAMN YOU KAISER!! This plugin suited my needs fine until you got ahold of it!
 
@Brady thought about a) checking for current_filter b) trigger via static function from outside, etc. all crap
@Brady ;)
 
4:25 PM
Now this plugin is slowly becoming a complicated mess ahahaha
hang on a min here
so why does the hook added_post_meta work for your CPT?
 
            if (! isset( $_REQUEST['post_type'] ) )
            {
				$post = get_post($_REQUEST['post']);
				$post_type = $post->post_type;
            }
            else
            {
            	$post_type = $_REQUEST['post_type'];
            }
			add_action("deleted_{$post_type}_meta", array(&$this, 'deleted_post_meta'), 10, 4);
should work...
 
ill let you test first
 
ok, doesn't. Shure about deleted_{$post_type}_meta<-- Name?
Can't find 'deleted_post_meta' in core...
 
right the reason why add_metadata() works for your CPT is because there are only two types. Post or User
do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
^^ does exist in core
but im thinking meta_type can only be post or user
so this CPT business is seen as post
function delete_post_meta($post_id, $meta_key, $meta_value = '') {
	// make sure meta is added to the post, not a revision
	if ( $the_post = wp_is_post_revision($post_id) )
		$post_id = $the_post;

	return delete_metadata('post', $post_id, $meta_key, $meta_value);
}
^^ in core
always passed as post....
 
0
Q: List category posts - thumbnail_size problem

Nika BeridzeI'm using the list category posts plugin, and can't get the thumbnail_size parameter to work with a given pixel size. The parameter can be a word, but also a size in X- and Y-dimension, as I understand it. Can someone give me an example of how to write this? Thanks.

 
4:39 PM
@Rarst - sort it out ;)
 
what?
 
@Brady Yea. But don't get around it. Somehow meta data doesn't get until there...
Also, if I use add_action("delete_post_metadata", array(&$this, 'deleted_post_meta'), 10, 4);, then for some reason lat always stays 0.000000000...
@Brady This is what gets passed by $meta_data from get_post_meta_by_id( $mid );:
object(stdClass)#150 (4) { ["meta_id"]=> string(1) "1" ["post_id"]=> string(1) "2" ["meta_key"]=> string(17) "_wp_page_template" ["meta_value"]=> string(7) "default" }
No real meta data inside
 
hang on im lost
give me five mins I need to upload a change for a client
 
4:55 PM
@Brady n/p
 
@kaiser ok done I'm back
ok in the past delete_post_meta hooks worked for me fine on a CPT
so why are they not working for you
I thought it was bcause you were deleting via ajax
so thats why I added the extra hooks
and its still not clearing out the DB...
 
@Brady edit.php -> hover -> Delete Permanently
 
ok i need a test setup
hang on
 
meta_key and _value are empty during delete_metadata() call
 
hang on
why are they empty for you?
 
5:05 PM
The filter doesn't get called. It triggers delete_metadata straight without filter
 
im not on a filter though
im on an action
 
If I attach your deleted_post_meta, Then the $meta_key = _wp_trash_meta_status
yea, sry.
action
 
im hooking do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
and thats in delete_metadata()
 
and it's "post" for CPT too
 
yeah i've established that
but why is $meta_key empty when that action is fired...
 
5:09 PM
Mom. You missunderstood me (my fault).
"delete_post_meta" doesn't get triggered.
'delete_post_metadata' instead
highly confusing filter stuff...
'delete_post_metadata also triggers during save post...
 
where is this delete_post_metadata hook in core?
 
meta.php > delete_metadata()
 
$check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all );
 
whole stuff makes no sense to me
no
do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
both
same function
 
no there are diff
you are getting confused now :P
do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
one is run before the delete and one is run after the delete
notice the delete and deleted
 
5:19 PM
Yea. But: Problem is the query before the actions. Empty $meta_value and $meta_key is "_wp_trash_meta_status" passed
 
which query before empties these values?
 
So if no $meta_ids => return false
inside delete_metadata() fn
$object_id is fine. $meta_type = post. But meta key & value seem to fail for some reason
 
$meta_ids should always be 1 or greater at that point?
so should never return false
 
Only if query returned nothing.
Ok. currently inspecting: Geo Storage class and meta_data_captured() fn
Ok, problem simply is that the hook doesn't get fired. If I add it to the 'delete_post_metadata' hook too, then it gets also fired on save_post or update_post, which is wrong.
No clue
 
can i use get_userdata() to get multiple users information at once?
 
5:34 PM
@kaiser how are you deleting your post with lat/lng in? i want to reproduce here
 
@Brady /wp-admin/edit.php?post_type=CPT_NAME (list view) >> hover with mouse over post >> "Delete Permanently"
@Sisir WP_User_Query
 
@kaiser: got it! :)
 
@kaiser im able to reproduce
 
@Brady :P
confirmed error..
 
but now i just want to go to bed
 
5:45 PM
detto
 
ditto?
 
ehm, probably?
@Brady the net says: dito = wrong, ditto = ok and detto also (in german)
 
Used in accounts and lists to indicate that an item is repeated (often indicated by ditto marks under the word or figure to be repeated).
Used to indicate that something already said is applicable a second time.
ditto = repeated
so when I said when i wanted to go to bed I thought you meant ditto which would mean you want to go to bed too :)
but never seen detto before
now I know it means OK
but surely it would be easier to say OK rather than detto
 
@Brady It means "yes, me the same" :)
 
then you meant to say ditto not detto :)
fuck it I carnt be arsed to argue anymore :'(
wp_delete_post() is called when you delete permantly
just following that through to see how attached meta is deleted
do_action( 'delete_postmeta', $post_meta_ids );
so an array of all meta_id's are passed
so my function that im hooking onto:
public function delete_postmeta($mid) {
    $meta_data = get_post_meta_by_id($mid);
    $this->meta_data_captured($meta_data->post_id, $meta_data->meta_key, "delete");
}
is no good because im only reading one of the meta ids
not all of them
btw urbandictionary.com/define.php?term=detto detto is not nice slang word in English :)
 
6:04 PM
@Brady oh...
 
@Brady out! night all
 
@Brady same to you
 
 
5 hours later…
11:13 PM
Question 4 all: Why doesn't wp_list_pages have a taxonomy/category argument? What if I wanted to list pages based on taxonomy and not the usual parent/child depth relationship?
 
@AlxVallejo because you can mount a walker
 
I forgot - do pages even have any taxonomies natively?..
 
@Rarst ehm, no :P
but walker is like 42 :)
 
So my walker would say something like "if category = 'category1'"
 
yay... upgraded web stack. only took like forever thanks to major Uniform server release and me being "smart" with custom config
 
11:24 PM
@AlxVallejo Do you have a taxonomy called "category" on your pages?
 
sure
actually
i have competitor as a taxonomy
and then a list of competitors
it's hierarchical
 
i've added walkers in the past
actually i'm thinking what would be more helpful is if i could list categories (the taxonomies) in a hierarchical form (wp_list_categories ('hierarchical' => true)) and for each category list the pages
but the walker would say where category = "categories of the hierarchy"
 
@AlxVallejo Sry, don't understand and honestly ain't got time for that now.
 
haha ok
 
11:38 PM
damn script works local and aborts on server... wtf?
@Rarst My js breaks on server when I echo php vars. Any idea where start searching? currently clueless.
 
when JS breaks good first step is Firebug console, it usually spits JS errors with details in fiel and line
 
Not in this case. everything is set to true in wp-config. dev server...
 
JS doesn't really care about PHP settings...
 
Damn. Me idiot... I thought @Brady commited to new version already to the official repo.
Old version no public API. debug.log then told me...
@Rarst Ty for holding my hand while going crazy :)
 

« first day (429 days earlier)      last day (4501 days later) »