0

So, after making a new youtube page, I noticed that some of my current users who have linked their youtube channels via youtube API and into our database, some of those users channels now give Error, where they no longer exist.

https://gyazo.com/d2ca429e408c9d843ee6e848ac8c4dda

So I am basically creating the subscribe buttons from this code in an echo in my function.

<div class="g-ytsubscribe" data-channelid="'.$youtube_info['channel_id'].'" data-layout="full" data-count="default" data-onytevent="onYtEvent"></div>

So as you can see, I fetch that data from my database and it then contacts youtube to fetch that channel info. But some of my users channels now no longer exist, so I wondered if there was a way to detect this? and then to not display that particular user from being displayed at all?

so my query is this for the function.

    $query = "SELECT user_id, yt_channelTitle, channel_id FROM points WHERE channel_id !='' AND yt_channelTitle != '' ";
$query .="ORDER BY channel_id DESC LIMIT " . ($objectsPerPage*2) . " OFFSET " . $_SESSION['last_record'];

I mean I was maybe thinking accross the lines of some type of maybe str_replace? method perhaps? but then it would be a question of what is it detecting the word Error because that is what gets displayed in the youtube button instead of the channel subscriber count and profile image, it just shows a red icon with Error.?? I am open to ideas :)

Thanks

1 Answer 1

0

I just wanted to post an answer to my question, and say I sorted a workaround out to this issue.

I basically just created a section in our admin section where we can now just easily edit the channel_id very easily, and made it blank. :)

https://gyazo.com/8c73c62ecceb61c2b6d1599a159bc819

So basically I just made a function for it :) so now all I need to do is click the link and it takes me to their channel. For ease of access :)

I will probably look into a automatic method, if it is needed, but this is sufficient for now.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.