Comments (20)
Hey Jason,
Sorry that you had trouble installing the class. Hopefully these instructions will help some.
-
Download the class from github and make sure all the files are contained within the folder
tgm-plugin-activation
. -
Next, upload the class via FTP into your theme. I tend to place all included things like this in a
lib
folder at the root of my themes. You could also do anincludes
folder or whatever you prefer. -
Next, before you copy the code from the example.php file, you need to make sure you run a require_once to instantiate the class, like this:
require_once( get_stylesheet_directory() . '/lib/tgm-plugin-activation/class-tgm-plugin-activation.php' );
Change the lib
to whatever folder you have placed tgm-plugin-activation in.
- Do like you did and copy the example.php contents to your functions.php file below the require_once call.
Everything should work now. You can change out the default plugins to those of your own choosing. Let me know if you have any other questions or issues. :)
Thomas
from tgm-plugin-activation.
Thanks Thomas!
I added the folder into my /lib/ folder within my child theme folder.
I ran the require once, in as much as I pasted it into my functions.php file for my child theme and saved it.
I am guessing that I did that wrong since when I went back and pasted the code from the example.php, I got the same breakage as before?
I guess its obvious this is my first child theme, sorry to be such a noob.
from tgm-plugin-activation.
Keep the require_once statement in your functions file because the example code will need it as a reference for the API function. And no worries, everyone starts somewhere. :)
from tgm-plugin-activation.
A slightly simpler alternative method of installation:
- Copy the class-tgm-plugin-activation.php file into the root of your theme (next to style.css, functions.php et al)
- Copy ALL of the contents of example.php into your functions.php file.
- Amend the
require_once
line from those copied contents to be:
require_once get_stylesheet_directory() . '/class-tgm-plugin-activation.php';
Refresh the admin dashboard, and you should be getting a couple of admin notices (if you've not got the default registered plugins installed and active already).
I prefer to keep this class file in lib/plugins/
but get it installed in the theme root first, and you can move it (and the require_once
reference to it), once you're happy it's all working.
from tgm-plugin-activation.
Thanks guys!!!! I used Gary's install steps and the admin notices are there.
When I move it to my lib/plugins/ directory, I only move the class-tgm-plugin-activation.php into the folder tgm-plugin-activation, correct?
Thanks for the help!
from tgm-plugin-activation.
Correct, but you'll need to update the require_once
reference (now in your functions.php along with the rest of example.php that you copied) to point to the new location e.g.:
require_once get_stylesheet_directory() . '/lib/plugins/class-tgm-plugin-activation.php';
should do it (which I think is what the original example.php file comes with anyway).
from tgm-plugin-activation.
Thanks again! Awesome, just awesome.
from tgm-plugin-activation.
Glad you got it sorted out! I plan on making a video to explain step by step how to do this so that there isn't any confusion. I'd love to see this adopted by a large portion of developers, so explaining the process of getting it setup would be a good investment.
from tgm-plugin-activation.
Video would certainly help simplify its use.
Any idea why the admin prompt remains even though the plugin is installed and active? Only happening with the one that I supplied the plugin zip file within the lib/plugins/ directory.
Here is how its setup, in case:
array(
'name' => 'Google Maps Lite Plugin', // The plugin name
'slug' => '33490_wordpress-google-maps-plugin-lite-2.1.1.zip', // The plugin slug (typically the folder name)
'source' => get_stylesheet_directory() . '/lib/plugins/33490_wordpress-google-maps-plugin-lite-2.1.1.zip', // The plugin source
'required' => false,
),
from tgm-plugin-activation.
You have a screenshot or a link I can look at to see the issue in action?
from tgm-plugin-activation.
Its still on my local server at this time but here is a screenshot of the plugin, bottom one, which is active:
http://cl.ly/AhRy
Here is the admin notice:
http://cl.ly/AhZq
Is there a way to give the user an option to kill the notice? I am using this more as a way to suggest and simplify the process of tracking down the plugins, would be nice if they could kill the notice in the event they do not want a or some plugins that are suggested.
from tgm-plugin-activation.
I think the issue you are running into is that the plugin name you've specified (Google Maps Lite Plugin) is not that same name as the actual plugin (WPMU DEV Maps Lite). Try changing the plugin name in the array to WPMU DEV Maps Lite and see if that fixes the issue for you.
We are currently working on this issue you mentioned about dismissable admin notices here: #35
You can following along with the progress of that. I tried somewhat unsuccessfully to implement a solution based on adding options and checking them, but for some reason I can get the add_option() function to work with a foreach statement. :(
from tgm-plugin-activation.
With debug on, I get this error with that plugin:
Notice: Use of undefined constant AgmPluginInstaller - assumed 'AgmPluginInstaller' in /home/seoinfo/public_html/wp-content/plugins/wordpress-google-maps/wpmu_dev_maps_plugin.php on line 59
And I checked and it wasn't naming that was the issue. It must be the error code that the plugin is spitting out that is causing the issues.
from tgm-plugin-activation.
I will follow along on #35, that will be a nice add to a really nice plugin!
I thought the same thing after posting here and went and changed the name (I had originally named it based on the .zip file name) but still same thing. I also, removed the plugin and reinstalled it using the notice link but the notice is still there.
from tgm-plugin-activation.
I just fixed the error and it is still appearing as an admin notice like you have posted. I'm going to re-open this so we can see about getting the issue fixed.
from tgm-plugin-activation.
My guess is that it is an issue with this particular plugin. It is spitting out a lot of unwanted header information and is throwing up bugs for me left and right in debug mode. I know our code isn't completely polished yet, but I've tried a vast array of plugins and have never had this issue. Nevertheless we will still look into it, but I'd like to check it and see again when that plugin gets some of the bugs ironed out.
from tgm-plugin-activation.
I zipped a copy of my child theme and installed it on a test server of mine after removing the Maps plugin, so there were 2 plugins from the repository, woocommerce and jetpack, and it worked. :)
from tgm-plugin-activation.
Awesome! I'm pumped that it did :) Be sure to open up another issue ticket if something else arises so we can tackle it. :)
from tgm-plugin-activation.
The clue appears to be in your code:
'slug' => '33490_wordpress-google-maps-plugin-lite-2.1.1.zip', // The plugin slug (typically the folder name)
You've specified a zip file name, rather than a plugin slug, which I would expect to be something like wordpress-google-maps-plugin-lite
or google-maps-plugin-lite
(or whatever the folder name is that it extracts into).
We add comments to the example file for a reason ;-)
from tgm-plugin-activation.
Yep, my bad, I mixed up the slug and the file source. So the slug should be the folder that the plugins unzip into. Pertinent, since that plugin I was trying, unzips into something different than its .zip name. Thanks guys!
from tgm-plugin-activation.
Related Issues (20)
- Dynamic Content for Elementor HOT 1
- Wordpress 5.5 - Automatic Plugin Updates
- Fails on PHP 8.0 HOT 22
- Improve Separation of Concerns HOT 5
- Instal, activate buttons showing a full URL
- Failing latest Theme Check HOT 6
- Generator Does Not Create Text Domain
- tgm plugin does not work on php version 8 HOT 3
- Warning: sprintf(): Too few arguments in \wp-admin\includes\class-bulk-upgrader-skin.php on line 156 HOT 3
- Is this dead? HOT 6
- Declaration of TGM_Bulk_Installer_Skin::before() must be compatible with Bulk_Upgrader_Skin::before($title = '') and other php warnings HOT 1
- Bulk plugin installation and activation error HOT 4
- Theme demo import error HOT 1
- Improve translation sv_SE
- Can this library help me auto-update a premium plugin? HOT 2
- Download failed. Forbidden
- Windows Defender finding it as Trojan Virus HOT 2
- Fatal Error on PHP 8.2 (Tested on localhost with wamp) HOT 1
- Bulk Installation Issue
- Request for SSL Certificate to Secure Website Downloads
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tgm-plugin-activation.