How to print a message when my plugin is being activated?

Discussion in 'WordPress' started by lelkoun, Aug 6, 2010.

  1. #1
    I want to print a specific message when my plugin is being activated.
    To do this, I need to get a name of my plugin after activation.

    For example, this tells me a name of a plugin when an activation fails: $_GET['plugin'].
    But when the activation is succesfull, it does not work.

    Can you help me out?
    Thanks!
     
    lelkoun, Aug 6, 2010 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I am not sure but I think you use register_activation_hook.

    Write a function to print the message, then register it with <?php register_activation_hook($file, $function); ?>

    Hope that works :)
     
    Cash Nebula, Aug 6, 2010 IP
  3. lelkoun

    lelkoun Active Member

    Messages:
    288
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Sadly, this does not work. I tried it as my first idea.
     
    lelkoun, Aug 6, 2010 IP
  4. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yeah, there are lots of complains about that one. It should work if everything is in the main plugin file.

    The only other function I know of is plugins_loaded, but I think that gets called a lot more often.
     
    Cash Nebula, Aug 7, 2010 IP
  5. lelkoun

    lelkoun Active Member

    Messages:
    288
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #5
    But how can I recognize that a specific plugin has been activated? If there would be 2 or more plugins installed using the same notification code, it might not work properly.
     
    lelkoun, Aug 7, 2010 IP
  6. lelkoun

    lelkoun Active Member

    Messages:
    288
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Any ideas?
     
    lelkoun, Aug 9, 2010 IP