Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 653971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:26:31+00:00 2026-05-13T22:26:31+00:00

here is my plugin activation code $classified_category_name = ‘classified’; $credit_table_name = ‘credits’; $credit_table_version =

  • 0

here is my plugin activation code

$classified_category_name = 'classified';
$credit_table_name = 'credits';
$credit_table_version = 0.1;

register_activation_hook(__FILE__, 'LBH_Classifieds_Activate');

function LBH_Classifieds_Activate()
{
    global $wpdb;
    global $classified_category_name;
    global $credit_table_name;
    global $credit_table_version;
    $table_name = $wpdb->prefix . $credit_table_name;
    if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
            $sql = "CREATE TABLE " . $table_name . " (
                    time bigint(11) DEFAULT 0 NOT NULL,
                    amount tinyint(3) DEFAULT 0 NOT NULL,
                    username varchar(50) NOT NULL,
                    UNIQUE KEY username (username)
            );";
            require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
            dbDelta($sql);
    }
    add_option('lbh_db_version', $credit_table_version);
}

but the global variables are empty.

Also, is there any way to print any information from within a plugin? I’ve tried returning a WP_Error, throwing a WP_Error, and all I can ever get is a big yellow box, mostly empty, with “Plugin could not be activated because it triggered a fatal error.”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:26:32+00:00Added an answer on May 13, 2026 at 10:26 pm

    When activation occurs, your plugin is included from another function and then your myplugin_activate() is called from within that function (specifically, within the activate_plugin() function) at the point where your plugin is activated. The main body variables are therefore in the scope of the activate_plugin() function and are not global, unless you explicitly declare their global scope

    See the rest of this note on variable scope: http://codex.wordpress.org/Function_Reference/register_activation_hook#A_Note_on_Variable_Scope

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this http://code.drewwilson.com/entry/autosuggest-jquery-plugin Here is my html <h1>Category : </h1> &nbsp;<input type=text
I am trying to combine ajaxSubmit with the validate plugin Here is my code
I'm trying to use the qTip jQuery plugin here: http://craigsworks.com/projects/qtip2/demos/#mouse I got the code
How to dynamically change the timeout of the cycle plugin here is my attempt
I'm using the jQuery multi-file upload plugin found here: http://www.fyneworks.com/jquery/multiple-file-upload/ I don't see in
We use the excellent validator plugin for jQuery here on Stack Overflow to do
I am using the superfish plugin for jquery here: clicky it works fine in
Hoping some learned Rails developers here can recommend an existing Ruby on Rails plugin
I am useing the superfish jquery plugin If you view the superfish menu here:
Refer original post here for a reference to the original issue. What plugin should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.