2010-10-01, 11:42 PM
I'm working on the plugin part of GoMobile, and I can't get this hook stuff down pat. A feature requested is to show an icon beside a post when it's sent from a mobile device.
My idea of executing this was to include a hidden field with a value of 1 on the mobile theme, so that when a user makes a post I can pull either a 0 or a 1 and display an image accordingly.
Now, my problem is I have absolutely no idea what the heck I'm doing when it comes to hooking in and whatnot. I've looked through the Wiki a bit here and there but it doesn't seem to clearly outline exactly how one would go about inserting additional code. I would assume that when hooking into 'newreply_do_newreply_start', for example, the code I place into my plugin would simply get filled in there.
Here is what I would assume will work (not the final revision by any means, this was/is for testing purposes):
gomobile_posts() hooks into the hook I mentioned above. I would think that I would define $post['mobile'] with a value of 1, and it would post that data to the database but that isn't so. I have the column set up, and the rest of the code is correct as far as I know.
Can someone at least point me in the right direction? Thanks. I'm new to this so go easy pl0x
Never mind, this isn't the function I need to use :|
My idea of executing this was to include a hidden field with a value of 1 on the mobile theme, so that when a user makes a post I can pull either a 0 or a 1 and display an image accordingly.
Now, my problem is I have absolutely no idea what the heck I'm doing when it comes to hooking in and whatnot. I've looked through the Wiki a bit here and there but it doesn't seem to clearly outline exactly how one would go about inserting additional code. I would assume that when hooking into 'newreply_do_newreply_start', for example, the code I place into my plugin would simply get filled in there.
Here is what I would assume will work (not the final revision by any means, this was/is for testing purposes):
function gomobile_posts()
{
global $post, $mybb;
$is_mobile = 1;
// Hopefully this will post to the processor correctly
$post['mobile'] = $is_mobile;
}
gomobile_posts() hooks into the hook I mentioned above. I would think that I would define $post['mobile'] with a value of 1, and it would post that data to the database but that isn't so. I have the column set up, and the rest of the code is correct as far as I know.
Can someone at least point me in the right direction? Thanks. I'm new to this so go easy pl0x
Never mind, this isn't the function I need to use :|