J.D. Grimes
Forum Replies Created
-
Forum: Plugins
In reply to: [WordPoints] displayed user's wordpointsI added this shortcode for displaying a users points in version 1.3.0. The shortcode is
[wordpoints_points]
. You can read more about it here.Forum: Plugins
In reply to: [WordPoints] displayed user's wordpointsHi @nyan-nyan,
There is no shortcode for this at present. I plan to add a shortcode to display the current user’s points in the next version of the plugin. I also plan to add more features for BuddyPress in the near future.
Yeah, I just ignored it for a long time. I don’t think it really affects the plugin very much.
@darkpollo – The issue is in
/inc/class-tracking.php on line 113
. If you change the code yourself, take care, and save a copy of the original file in case you accidentally mess something up.Forum: Plugins
In reply to: [WordPoints] Add points hookHi Jose,
I haven’t written much documentation for the plugin yet, unfortunately. I do plan to write up some docs soon. If you are fluent in PHP, you can probably figure out what is needed by looking at the source code. Specifically, you will want to take a look at /components/points/includes/hooks.php, which is where the code for the default points hooks is.
Basically, a hook is an extension of the
WordPoints_Points_Hook
class. It is registered withWordPoints_Points_Hooks::register()
. This child class displays the settings form on the administration panel, saves the new settings when that form is submitted, hooks into an action or filter to award the points, and generates the description of the transaction for the logs.So for example, the registration hook hooks into the
'user_register'
action with this line in the class constructor (the constructor is called automatically by the plugin):add_action( 'user_register', array( $this, 'hook' ) );
The
'user_register'
hook is called by WordPress each time that a new user registers. Then the class’shook()
function awards the points.For your custom code, you will likely create a custom action:
do_action( 'my_custom_action' );
And then you will hook into that in your points hook’s constructor:
add_action( 'my_custom_action', array( $this, 'hook' ) );
Right now there is no built-in way to add/get points via AJAX. I plan to add something like that in the near future though. For now, you can create your own custom AJAX callbacks. The function to get the number of points that a user has is
wordpoints_get_points( $user_id, $type )
, and the one to add points iswordpoints_alter_points()
. (That function can also subtract points when passed a negative number.)If you don’t care about having settings for your custom hooks in the admin, you could just call the add points function directly, wherever you need to add points for a user. However, I would encourage you to use the points hook class instead.
I hope that helps. If you have more questions, or need clarification, leave a reply and I’ll be happy to help.
I’m sorry there isn’t any online documentation yet, that is on my to-do list.
Forum: Plugins
In reply to: [WordPoints] UninstallHi Migo,
Thank you for reporting this. It seems that there is indeed a bug in the plugin, which I will fix in the next release. You can manually delete the files, but it is better to wait and let the plugin uninstall itself, because it will clean up the database too.
Forum: Plugins
In reply to: [WP Power Stats] Database errors on multisiteYou are welcome. Thank you for the quick response.
Forum: Plugins
In reply to: [Zia3 CSS JS] Javascript issuesI have also experienced this error with the plugin running on one of my clients sites. The error is caused by the JS for this plugin being loaded on every single page in the administration panels. This plugin’s JS is trying to initialize the syntax highlighting for the two textboxes, but the textboxes are only on the edit/add post screens, and so on the other screens it gives this error.
Serkan, you should stop hooking the enqueue functions from the actions that you have them hooked to, and only call them inside of the function that displays the metaboxes. That way the JS will only be loaded on the administration panels where it is actually needed. I edited the plugin to do this, and the error was fixed. And the plugin still worked on the add/edit post screens.
Forum: Hacks
In reply to: $current_user global – Is it automatically loaded?I’ve found that the current user will be set up on each page load, and can safely be accessed from
'init'
and later by callingwp_get_current_user()
. The only time you would need to implement code such as I posted above would be if you must have the current user’s info before'init'
(for example, on'plugins_loaded'
action).Yes, I’ve had this as well:
PHP Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GoogleSitemapGeneratorLoader::Enable() should not be called statically in /home/efield5/public_html/.codesymphony.co/wp-includes/plugin.php on line 406 [17-Aug-2013 13:44:07 UTC] PHP Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GoogleSitemapGeneratorLoader::RegisterAdminPage() should not be called statically in /home/efield5/public_html/.codesymphony.co/wp-includes/plugin.php on line 406 [17-Aug-2013 13:44:07 UTC] PHP Strict Standards: Non-static method GoogleSitemapGeneratorLoader::GetBaseName() should not be called statically in /home/efield5/public_html/.codesymphony.co/wp-content/plugins/google-sitemap-generator/sitemap.php on line 114 [17-Aug-2013 13:44:07 UTC] PHP Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GoogleSitemapGeneratorLoader::CallHtmlShowHelpList() should not be called statically in /home/efield5/public_html/.codesymphony.co/wp-includes/plugin.php on line 173 [17-Aug-2013 13:44:07 UTC] PHP Strict Standards: Non-static method GoogleSitemapGeneratorLoader::GetBaseName() should not be called statically in /home/efield5/public_html/.codesymphony.co/wp-content/plugins/google-sitemap-generator/sitemap.php on line 199
I hope this will be fixed in the next release.
Forum: Plugins
In reply to: [Multiple Featured Images] Integrate into has_post_thumbnail@pha3z – No, I meant
get_featured_image_id
, but I forgot to leave out the$size
parameter, so it should be this:<?php if ( (int) kd_mfi_get_featured_image_id( 'featured-image-2', 'page' ) != 0 ) { ?>
the_featured_image()
would display the image, and we just want to check if it exists. The image would show in the wrong spot.Forum: Plugins
In reply to: [Akismet Anti-spam: Spam Protection] Automatically empty my spam commentsIt doesn’t delete them immediately, but after one day. I don’t know if it will delete them faster if you set replace the
1
with0
. Maybe try that if you want it to delete them faster.define( 'EMPTY_TRASH_DAYS', 0 );
Forum: Plugins
In reply to: [Akismet Anti-spam: Spam Protection] Automatically empty my spam commentsI really don’t see how that error could be related. Are you sure that the code on line 88 is what you added to empty the spam? If you could post what is on that line it would be helpful.
Forum: Plugins
In reply to: [WP DB Driver] PHP Warning: Error while sending QUERY packetNo, its a fairly small site which I just use for testing and development. But it looks like the error was caused by the MySQL server timing out before WordPress was entirely loaded. So I guess this really has nothing to do with the plugin exactly, but just the fact that WordPress doesn’t always maintain the database connection. I actually have had this problem before on some of my other sites, and so I’ve increased the timeout interval for them. I’ve never had the issue on this one though, which is why it threw me off.
On a side note, it would be great if it was easier to set the database connection timeout interval in WordPress, like just setting a constant in
wp-config.php
. E.g.:define( 'WP_DB_TIMEOUT', 300 );
Maybe I should open a ticket for that.
Forum: Plugins
In reply to: [Akismet Anti-spam: Spam Protection] Automatically empty my spam commentsJust add this to
wp-config.php
:define( 'EMPTY_TRASH_DAYS', 1 );
I think that should work. Though it will also empty the trash.