TGMPA / TGM-Plugin-Activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins). It allows your users to install, update and even automatically activate plugins in singular or bulk fashion using native WordPress classes, functions and interfaces. You can reference bundled plugins, plugins from the WordPress Plugin Repository or even plugins hosted elsewhere on the internet.
http://tgmpluginactivation.com/
GNU General Public License v2.0
1.76k stars 430 forks source link

ABSPATH not accepted in ThemeForest theme. Need a solution! #616

Closed cristianstan closed 8 years ago

cristianstan commented 8 years ago

I got a new rejection on ThemeForest because TGMPA uses some functions not allowed on themes. The functions are:

  1. ABSPATH
  2. dirname( FILE )

Any idea what can replace these two functions?

cristianstan commented 8 years ago

Update:

For point #1 The dirname( FILE ) can be replaced with get_template_directory().

But for point two we tried to replace for example:

require_once ABSPATH . 'wp-admin/includes/plugin-install.php';

with:

require_once( get_template_directory() . '/../../../wp-admin/includes/plugin-install.php' );

Its working well but they still rejects the theme!

jrfnl commented 8 years ago

Unfortunately, neither of the two suggestions would be acceptable for TGMPA as this library is used by both themes as well as plugins and your suggestions would not work for plugins.

Pinging @Stephen-Cronin for an official ThemeForest stance.

cristianstan commented 8 years ago

Thank you @jrfnl I'll wait for the answer from Stephen-Cronin

justintadlock commented 8 years ago

This was asked of me by one of the TF reviewers. I'm just sharing my thoughts here too.

There are legit uses for both ABSPATH and dirname( __FILE__ ) in themes. Neither of these should be blocked. This is probably just a matter of being a little overzealous with some guidelines about including functions files with get_template_directory().

As far as I can tell, these are both used correctly in TGMPA.

Stephen-Cronin commented 8 years ago

Hey everyone, sorry for the slow reply. Didn't get to this until a couple of days ago. I threw it to the team to discuss before taking a day off. We've now finished that discussion and confirmed that there's no issues from our point of view with this (or anything else inside class-tgm-plugin-activation.php).

@cristianstan - can you please resubmit the theme (Edit > Upload again) and leave a note to the reviewer pointing to this issue?

@justintadlock - thanks for the advice, much appreciated! :)