Plugin Author
myCred
(@designbymerovingi)
Hey gogott.
I recommend the following article on how to build your own shortcodes. You can also find more information in the WP Codex for the Shortcodes API.
In your custom shortcode you can then use the mycred_get_settings function to award points and to check for previous point awards to make sure the user only gets it once.
Example:
// if the submitted text is the one we were looking for:
if ( $text = 'mycustomtext' ) {
// Load myCRED
$mycred = mycred_get_settings();
// If the user has not yet received points for this text
if ( ! $mycred->has_entry( 'points_for_text', '', $current_users_id, 'mycustomtext' ) ) {
$mycred->add_creds(
'points_for_text', // just as in the has_entry()
$current_user_id, // ID of the user to award points
1, // number of points
'Points for correct word', // the log template
'', // we have no reference id to save
'mycustomtext' // instead we save the text as the data
);
}
}
Thread Starter
gogott
(@gogott)
Hi Gabriel, I went through your recommended links and tried to put together a short code. Unfortunately I am having much difficulty and keep getting errors. Do you think you can help put your example into a working shortcode? Thanks so much.
Plugin Author
myCred
(@designbymerovingi)
Hey gogott
If you are a member of the myCRED website you can always post a request in the “Feature Request” forum which I use as my list of things to do. I would then look at helping you out as soon as I can. Since myCRED is a free plugin I have to prioritise paid jobs but I go though customisations request when ever possible.