Tips and Tricks HQ Support Portal › Forums › WP Lightbox Ultimate › Lightbox Ultimate PHP Functions?
Tagged: Lightbox PHP Functions
- This topic has 3 replies, 2 voices, and was last updated 7 years, 5 months ago by wzp.
-
AuthorPosts
-
June 19, 2017 at 7:10 pm #14328MagicTHSpectator
I need Lightbox Ultimate PHP Functions. Found eStore and eMember PHP, but can’t find Lightbox. Can you post a link? In particular I just need the function to display Amazon S3 from an anchor as I’m generating that page in PHP to list all my available videos (the list is different depending on the membership level).
Thanks.
June 19, 2017 at 7:40 pm #75899wzpModeratorAt his current time, that information is not available. Would this suffice, instead?
https://support.tipsandtricks-hq.com/forums/topic/embed-shortcode-in-php-file
June 20, 2017 at 9:45 pm #75900MagicTHSpectatorThanks for the link. I figured it out using something similar (by looking at your lightbox*php functions). This is the shortcode I was using:
[wp_lightbox_anchor_text_protected_s3_video link=”https://s3.us-east-2.amazonaws.com/your-bucket-name/Your_Case_Sensitive_Filename.mp4″ text=”Flowplayer S3 protected video”]
/*
Here is the PHP code necessary to do the same thing.
NOTE: Using s3.amazonaws.com as described in the training video did not work for me. I needed the path shown in my amazon mgmt console which is included below. Yours will be different depending on the amazon server you have chosen.
*/$video_bucket = “https://s3.us-east-2.amazonaws.com/your-bucket-name/”;
$video_name = “Your_Case_Sensitive_Filename.mp4”;
$video_link = $video_bucket . $video_name;
$video_text = “Whatever your anchor text is”;
//Next line compresses the 2 args into an array.
$vargs = ;
//I loop thru all pages with videos on them and output a table.
//Then I return $output from my function when it’s done.
//echo should work too, but I didn’t test.
$output .= ‘<html table formatting>’;
$output .= wp_lightbox_anchor_text_protected_s3_video_display( $vargs );
$output .= ‘<html table formatting>’;
//That’s it.
/*
I also created a “programmatic user” in amazon and gave it the following policy. It cannot login. It can only lookup and read. It has key/secret key you need for lightbox settings.
Note the arn: must be from your amazon mgmt console, not likely the one shown. Do not change the “Version” which looks like a date. It will fail if you do. There is a ‘helper’ in amazon to build this semi-automatically. Choose S3 read only as the condition. You should probably do this in case the Version changes in the future.
*///amazonaws Policy to allow programmatic read access to your videos.
{
“Version”: “2012-10-17”,
“Statement”: [
{
“Effect”: “Allow”,
“Action”: [
“s3:ListBucket”
],
“Resource”: [
“arn:aws:s3:::your-bucket-name”
]
},
{
“Effect”: “Allow”,
“Action”: [
“s3:Get*”,
“s3:List*”
],
“Resource”: [
“arn:aws:s3:::your-bucket-name/*”
]
}
]
}
June 20, 2017 at 10:19 pm #75901wzpModeratorThank you for sharing!
-
AuthorPosts
- You must be logged in to reply to this topic.