#19790 closed feature request (wontfix)
function request : is_plugin_latest($plugin);
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.3.1 |
Component: | Plugins | Keywords: | |
Focuses: | Cc: |
Description
i am working on a plugin right now an i am at the stage of adding help content to it.
i want to be able to display a contact form for support, but only want this to show if the user makes sure they are using the latest plugin version.
ive searched the core and the codex and i cant find any function that "just" checks if a plugins up to date (i know wordpress does check, but it wrapped up in bigger proccesses).
this would also be usefull to check themes as well, but for now maybe just a plugin version check.
it seems simple enough by just checking the site transient for plugins and checking the response array. if theres a better solution please let me know, because the code below is what i use currently in every plugin of mine:
function _is_latest($plugin){ $info = get_site_transient( 'update_plugins' ); if(isset($info->response[$plugin]['new_version'])){ return false; }else{ return true; }//if }//function
this is really simple, could we get it added to the core?
for themes we could just add a context arg to the funtion like
_is_latest($context, $file);
and call either the theme or plugin transient based on value of $context
Change History (6)
#2
@
13 years ago
ahh didnt spot that (probably because of its name).
it looks a little more complex than what i wanted (but yes does do the same).
i still belive we should action this maybe just as a wrapper of the above mentioned function.
also this doesnt take into account themes and requires more conditionals to return either a true or false value.
and that function requires you load extra files if your not on the right page. and also needs more info to return a result (i belive the $api var needs to be an array of values).
wereas what i propose just needs the plugin/theme file
i think many people after this type of information would have trouble "as i did" trying to find a function like the above due to its name.
especially as wordpress has a naming structure for if functions (is_home, is_admin, etc).
i spent many hours searching for a "is_latest"
thanks for pointing out the above, its great to learn new things, what do you think to my response?
#3
@
13 years ago
- Keywords 2nd-opinion added
Yeah, you do have to take some additional steps before calling install_plugin_install_status(), so a wrapper would be good.
On the other hand, I haven't heard anyone else doing what you're trying to do.
#4
@
13 years ago
no, i havent either, but it seems to me something that we should be encoraging users to do anyway.
i know from my experience that 50% or more support requests i get can usually be avoided by the user keeping there plugins up to date.
this would make it easy for authors to cut down support requests and spend more time developing.
and also provide a quicker solution to the user (if they cant submit a support request to me until they update, and when they update they find the plugin works. this is much quicker than waiting for an email from the plugin developer).
also looking at it to me it seems the above noted example function is less code than making a wrapper for install_plugin_install_status()
so maybe just using the above is the way to go?
#5
@
12 years ago
- Keywords close added; 2nd-opinion removed
- Resolution set to invalid
- Status changed from new to closed
Maybe a note on the top of your support request form that tells them to make sure they are updated to the latest version before submitting.
Couldn't you also use the wordpress.org api to get the latest version and store it as a transient then do a version_compare?
Well, we already have the awkwardly named (but more general) install_plugin_install_status() which I think is close enough for plugins.