2014-11-08, 12:36 AM
Hello all.
Just having my hand at making a plugin to share but a little stuck on the basics.
What I'm aiming for is that when a user heads to the avatar section, they click an 'Update' button and my plugin gets their avatar from an external source and saves it locally and to the database.
Things I'm not sure of:
I don't want too much detail, just a point in the right direction or some keywords.
Have a good one,
- Jason.
EDIT: If this belongs in Plugin Development could it please be moved, sorry about that.
Just having my hand at making a plugin to share but a little stuck on the basics.
What I'm aiming for is that when a user heads to the avatar section, they click an 'Update' button and my plugin gets their avatar from an external source and saves it locally and to the database.
Things I'm not sure of:
- when/how to call a function to get the user avatar (using their username) - can the function be called from a button within the usercp - $plugins->add_hook("usercp_do_avatar_start", "myplugin_downloadandsetavatarfunction");?
- how to edit the usercp template from within the plugin (call 'find_replace_templatesets()' on plugin install?)
- what do these mean within the templates section {$something->somethingElse} (hooks?)
- how to safely update the db (is this safe, what params to pass (just username), and how to call it
function myplugin_updatefunction() {
global $db;
$db->query("UPDATE ".TABLE_PREFIX."users SET avatar=SOME/AVATAR/STRING/LOCATION WHERE username=USERNAME);
}
)I don't want too much detail, just a point in the right direction or some keywords.
Have a good one,
- Jason.
EDIT: If this belongs in Plugin Development could it please be moved, sorry about that.