fracek / better-github-widget

Wordpress widget to display your GitHub projects
http://fracek.github.com/better-github-widget
BSD 2-Clause "Simplified" License
5 stars 4 forks source link

hook 'plugin_row_meta ' to add GitHub link to plugins page #12

Closed cfoellmann closed 11 years ago

cfoellmann commented 11 years ago

@fracek I hope you can help me. I am one step away from a complete meltdown :imp:

This site seems to be the "main" reference for the hook: http://wpengineer.com/1295/meta-links-for-wordpress-plugins/

and I would like to implement this code example:

    function set_plugin_meta($links, $file) {
    $plugin = plugin_basename(__FILE__);
    // create link
    if ($file == $plugin) {
    return array_merge(
    $links,
    array( sprintf( '<a href="options-general.php?page=%s">%s</a>', $plugin, __('Settings') ) )
    );
    }
    return $links;
    }
    add_filter( 'plugin_row_meta', 'set_plugin_meta', 10, 2 );

I thought: Learning by doing. Lets get a little better at PHP - after trying and reading... nothing. OOP seems to be devils work for a non-programmer.

fracek commented 11 years ago

I tried it and found 2 way to do it:

I'm a PHP newbie too so I may be wrong, but it worked :D

fracek commented 11 years ago

If you want to see just the change this is the commit, I added a link to the issues page. https://github.com/fracek/better-github-widget/commit/223e0f3f2ee74742b088fde421b4c3e3554c346c

cfoellmann commented 11 years ago

I am not sure what the problem is but it is not working for me. The first way exactly what I did and something is blocking it on my installation. Your implementation is not working either.

fracek commented 11 years ago

I don't know what it is, can you read the php logs on your system? They might help us.

cfoellmann commented 11 years ago

No errors there. I even cranked up the log level to the max. Nothing. What WP version are you using? I am on 3.5

plugins

On other plugins its working :-1:

fracek commented 11 years ago

After a bit of trial and error I noticed you need to activate the plugin to view the additional links with our plugin and "Wp-Piwik", somehow "WordPress HTTPS" displays it even when not active. I'm gonna investigate this.

cfoellmann commented 11 years ago

The WordPress HTTPS code is here on GitHub: https://github.com/Mvied/wordpress-https I can ask @Mvied . He is pretty nice, too. :-) (now he gets a notification)

He is using his own "framework" maybe that could help figure it out. https://github.com/Mvied/mvied

fracek commented 11 years ago

BTW can you confirm that it works when you activate it? One thing less to worry about :smiley:

cfoellmann commented 11 years ago

Yes, after activation it is displayed. But I do not think that is a good thing.

cfoellmann commented 11 years ago

if you like, you can send me an IM address via email to foellmann@foe-services.de, ICQ, Facebook, Skype

fracek commented 11 years ago

I'm leaving this issue open until we can display the links even if the plugin is not active.

picandocodigo commented 11 years ago

Having this same issue as @cfoellmann commented on my plugin. Maybe this is on purpose? Perhaps it makes sense not to see the links if someone didn't activate the plugin. I deactivated other plugins on one of my blogs which also use meta links, and their links are not working either.

cfoellmann commented 11 years ago

I dont know if you know https://github.com/Mvied/wordpress-https but maybe you can test it. It is providing meta links while deactivated

headstash commented 11 years ago

I can't reliably get my plugin to show the meta links while deactivated. Are you using a multisite installation? On a multisite, if the plugin is enabled for any site, it seems to make the meta links show up.

cfoellmann commented 11 years ago

@Mvied I have a WP 3.5 multisite and your plugin is displaying all the additional links in activated and deactivated state.

headstash commented 11 years ago

Is it deactivated on every site?

cfoellmann commented 11 years ago

I did a complete deactivation and I now see that all of you are right. All meta links are only displayed when the plugin is activated. :disappointed:

headstash commented 11 years ago

It seems strange that it does that. Do other plugins do that as well or is it because of the way I coded it?

https://github.com/Mvied/wordpress-https/blob/master/lib/WordPressHTTPS/Module/Admin.php#L22 https://github.com/Mvied/wordpress-https/blob/master/lib/WordPressHTTPS/Module/Admin.php#L62

cfoellmann commented 11 years ago

It seems to be the case for all plugins. The hook might have this limitation. Nothing about it on the WordPress Trac though

fracek commented 11 years ago

Mystery solved then :neckbeard:

I'll close this issue because it's more a WP issue than mine.