On fresh install of 7.41, no other modules installed or enabled but default.

With Drush:
Fatal error: Can't use function return value in write context in sites/all/modules/media_youtube_upload/media_youtube_upload.module on line 285
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Can't use function return value in write context in /sites/all/modules/media_youtube_upload/media_youtube_upload.module, line 285

Through website:
Fatal error: Can't use function return value in write context in /home/azzriel1/public_html/pozitivtveu/sites/all/modules/media_youtube_upload/media_youtube_upload.module on line 285

Comments

BigBrother2010 created an issue. See original summary.

alexverb’s picture

Assigned: Unassigned » alexverb

Thx for being the first to give feedback on the module. I'm on it ASAP.

alexverb’s picture

Title: Fatal error on fresh » Fatal error: Can't use function return value in write context
Status: Active » Needs review
StatusFileSize
new829 bytes

This is probably a PHP version thing because I don't get the error you are getting on a fresh install. I'm using PHP version 5.5.12. What version are u using?

The error is most likely because I was using a function within an empty statement. Could you try again using this patch?

BigBrother2010’s picture

Applied the patch, tried to enable it 2 times, module page refreshed but module was left unticked.
On 3rd try i got this error:

Fatal error: Can't use function return value in write context in /sites/all/modules/media_youtube_upload/media_youtube_upload.ytapi.inc on line 132

PHP: 5.4.43

BigBrother2010’s picture

On fresh DevDektop, Php 5.5.30 it all goes fine (drush, without the patch applied).

After composer install i get to the page to write app. credientials but not sure how to make it work from local as readme.txt is not quite like UI from google.

alexverb’s picture

Yes you are right, I forgot to update the README.txt while Google's UI has changed. Give me a day and I will:

  • Remove all these function return value errors
  • Update the README.txt
  • Update the online documentation page with screenshots from Google.

But if you can't wait:

PS: I also think the new UI is not intuitive.

BigBrother2010’s picture

Ill rather wait, check your readme with screens and test it out.

alexverb’s picture

Sorry it took me a while to get round to it. I had to change and setup a new dev machine in between.

Although I haven't tested the new commit with your older version of PHP I'm pretty confident those errors should be gone now. I also updated the README.txt and the documentation page with screenshots.

Could you please review the latest dev version? If everything is a okey I'll push it to the release candidate.

alexverb’s picture

You also need to enable the YouTube Data API. I forgot to put this into the documentation. I'll add this need to know thingie too :)

BigBrother2010’s picture

I went through all the steps and got the following:
* Configuration successfully saved.
* Token acquired from Google

x A client error occurred: { "error": { "errors": [ { "domain": "usageLimits", "reason": "accessNotConfigured", "message": "Access Not Configured. The API (YouTube Data API) is not enabled for your project. Please use the Google Developers Console to update your configuration.", "extendedHelp": "https://console.developers.google.com" } ], "code": 403, "message": "Access Not Configured. The API (YouTube Data API) is not enabled for your project. Please use the Google Developers Console to update your configuration." } }

Refreshed the page and error is gone.

Going to settings:
- admin/config/media/media_youtube_upload/page_settings
- admin/config/media/media_youtube_upload/block_settings
- admin/config/media/media_youtube_upload/media_settings
i get warning on each: "No categories in field yet. You need to authenticate the application on this page."
Can not to save any changes made on these pages and getting this error:
Notice: Undefined index: youtube_redirect in media_youtube_upload_upload_settings_form_submit() (line 410 of sites/all/modules/media_youtube_upload/media_youtube_upload.module).

Youtube Data API v3 was disabled in google dev, after enabling it i still get same results.

In your tutorial, step 9 is the product name which i added to module page as App. name. Not sure is this correct.

In Dev console, on tab next to OAuth there is Doman verification where i also added domain where the videos are uploaded from. Not sure is this needed.

I still tried adding media field on content type and choosing youtube upload, i get to the screen to pick video, add title and decription, i get same error as above. and video field hangs with "preparing upload..." underneath i get "No categories in field yet. You need to authenticate the application on this page. "

alexverb’s picture

Thank you for the detailed description of your problems. Indeed the system doesn't work without the YouTube Data API. And I've noticed whenever you enable it (after credential creation). It takes a while for it to come through. But mine did after a couple of minutes.

Now you are correct that there are some issues still with the application authentication. So I've corrected it so that if an error like this occurs the token is not saved. And you will keep getting the error until it is resolved. This way the user is aware that something is wrong and the error doesn't just disappear.

I've also taken care of the README.txt and help text on the settings page to include the enabling of the YouTube Data API. So now people should know to enable it before creating credentials.

Please let me know if the latest dev know is more intuitive regarding the YouTube Data API problem. I'm not committing these changes until you are pleased with the results.

BigBrother2010’s picture

It is perfectly clear now, very easy to follow. All is working good!

My primary need was to give users option to upload videos on website, that would be stored on youtube (private by dafault), and after i check them, make them public.

Today i read that even if the video is private, youtube scans it for any unapropriate content, pornography, copyright etc... So this leaves me no other option but to save them on my server first, check them out and then upload them.

Can you recommend a way to do this ?

alexverb’s picture

I'm making the exact same thing. That's the reason I made this module. To switch from private to public as a review process. Yes YouTube scans it for bad content. But I'm willing to make the bet that if you write a decent user agreement and don't publish videos that have bad content you are pretty safe. You won't encounter any user complaints when doing a review process... And Youtube will give you serveral chances before shutting down your channel. Offcourse I can't say you will never encounter a malicious user that is out to get you.

The alternative is to have users just use the regular file upload and do the youtube upload process manually. But that will massively increase server load. And you have no real way to detect copyrighted material. So you are in the same position as before.

I will try to get a hold of Googles' people and ask them how vulnerable you are to getting your channel shut down with a review process.

Ps: I'll commit the changes to the release candidate this evening.

BigBrother2010’s picture

Cant wait to see what will google people repsond to you.

There are few minor things for better user friendliness in the module. Want it here or to create new topic ?

alexverb’s picture

Status: Needs review » Closed (fixed)

You can create a new topic I'm closing this issue since I've just committed the changes to rc2. I'll only update this issue on your last question about the review process.

alexverb’s picture

Hey BB2010, from what I gather you are right about the restrictions around inappropriate content. So I'm afraid if you don't have a userbase with good intentions you will eventually get into trouble. I've opened up a feature request at Google to implement a buffer for channels with a public upload (https://code.google.com/p/gdata-issues/issues/detail?id=7826&thanks=7826...). But that truely is a long shot...

So I can't really give you any other viable solutions to this problem. What I'm probably going to try out is an invitational registration system. So you start out with people you know. And they will vouch for other users. I know, eventually this will again get out of hand.

If you really want to be safe a 100% you should probably use the regular upload field. Check the videos yourself and upload them to YouTube yourself. If you would like to see such functionality incorperated into this module to automate such a process you can make a feature request for it. But it's not too high up on my own wish list...

BigBrother2010’s picture

Hey Alex,

Would this somehow speedup the process of review/publish and keep the channel safe from ban, but still not saving files to web server ?

https://developers.google.com/youtube/ytdirect

alexverb’s picture

As I understand, YouTube Direct uploads videos to the clients account and not the website account. This way the risk of getting banned stays with the client. I really don't think there's any way yet to review videos before YouTube itself does. I've asked Google for such a feature request, but never got a response.