Title: [Plugin dev] Plugin activation issue : unexpected behavior
Last modified: August 19, 2016

---

# [Plugin dev] Plugin activation issue : unexpected behavior

 *  [primo411](https://wordpress.org/support/users/primo411/)
 * (@primo411)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/plugin-dev-plugin-issue-unexpected-behavior/)
 * Hi! I am encounterig problems developping a plugin. I use a hook to call a function
   when the plugin is activated, it seems to work but it doesn’t call the sub-functions
   called in this function. Let me show you the structure of my code:
 *     ```
       class aixorder{
   
       	function aixorder(){
       		register_activation_hook(__FILE__, array(&$this, 'aixorder_activate'));
       		return true;
       	}
   
       	/* Plugin installation */
       	function aixorder_activate() {
   
                       /* some actions that are well executed */
   
                       /* this call is not done ! */
       		$result = $this->calculate_all_scores();
   
       		return $result;
               }
   
               function calculate_all_scores(){
               /*blabla...*/
               }
       }
       $aixorder = new aixorder;
       ```
   
 * It seems that activate_aixorder() is called and executed, but then calculate_all_scores()
   is not !
    I really don’t understand, because when I call it manually by doing
   this, it works fine and calculate_all_score() is well executed:
 *     ```
       class aixorder{
   
       	function aixorder(){
       		register_activation_hook(__FILE__, array(&$this, 'aixorder_activate'));
       		return true;
       	}
   
       	/* Plugin installation */
       	function aixorder_activate() {
   
                       /* some actions that are well executed */
   
                       /* this call is done ! */
       		$result = $this->calculate_all_scores();
   
       		return $result;
               }
   
               function calculate_all_scores(){
               /*blabla...*/
               }
       }
       $aixorder = new aixorder;
       $aixorder->aixorder_activate();
       ```
   
 * So I guess there is something in the activation context I did not understand,
   as anyone an idea ?
 * Thank you for your help !

The topic ‘[Plugin dev] Plugin activation issue : unexpected behavior’ is closed
to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [primo411](https://wordpress.org/support/users/primo411/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/plugin-dev-plugin-issue-unexpected-behavior/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
