0

I have two systems in my websites: Wordpress and myBB forum. I want to connect them, everyone who register in wordpress (my main site) will be registered in myBB.

I started to write plugin that will be bridge. and i have the global file of myBB, when I include this file i see this error:

Fatal error: Cannot redeclare get_attachment_icon() ...

Now, how can I include the file but keep the functions seperate? can I include the functions into namespace or variable?

Thanks for help!

SaarED
  • 1
  • 2

2 Answers2

0

You could:

  1. Create a class and turn this functions in static methods
  2. Rewrite the name of the functions and refactor the code
  3. Or you can try this answer: https://stackoverflow.com/a/23426311/1906372
Fabiano Araujo
  • 876
  • 6
  • 19
  • Thanks for your answer, but there are to many functions to disable.there is a way to include function into class or namespace?? I – SaarED Jul 17 '17 at 16:43
0

Is the function get_attachment_icon really declared in both WP and MyBB? It seems unlikely somehow.

If it is in a single file, then that file has to be included or required with include_once or require_once, not with include or require.

LSerni
  • 55,617
  • 10
  • 65
  • 107
  • Thanks for your answer, but yes. I tried to disable the function but there are more functions that redeclared. there is a way to include function into class or namespace?? I must both files.. – SaarED Jul 17 '17 at 16:42
  • First you need to understand *what is happening*. So: you have **two files** and the same function with the same name is in both? What are the file names? Can you include **the full text of the error with file names and line numbers**? – LSerni Jul 17 '17 at 19:42