Good Morning...
I want to make a snippet that when creating a user in a blog add it automatically to another blog (this number 1 always) with the same roll that was created.
For this I am using this:
$ Blog_id = 1;
$ User_id = get_current_user_id ();
$ Role = 'publisher';
Add_action ('user_register', add_user_to_blog ($ blog_id, $ user_id, $ role));
.....And it does not work,
but if I do this....
$ Blog_id = 1;
$ User_id = 127; // 127 is a specific number of a user that already exists
$ Role = 'publisher';
Add_action ('user_register', add_user_to_blog ($ blog_id, $ user_id, $ role));
Then yes that works.
Can someone help me understand why the first (generic) solution does not work with:
$ User_id = get_current_user_id (); ?
Add_action
should give a PHP fatal error for the upper caseA
, and there are spaces in strange places.add_action
also expects acallable
type value as the second parameter, e.g. a function name