Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by Jonathan

  1. <?php
    if($user->hasRole("editor")){ echo ""; }
    elseif(!$user->allowed_screeners->has($page)){ $session->redirect("/screening-room/"); }
    $fredi = $modules->get("Fredi");
    echo $fredi->renderScript();
    			<!-- Main -->
    				<section id="main" class="container">
    					<section class="box special">
    						<header class="major">
    							<div> <?php include("./screener.php"); ?>
    							<script src="http://jwpsrv.com/library/xxxxxxxxxxxxxx.js"></script>
    							<div id="myElement">Loading the player...</div>
    							<script type="text/javascript">
    							file: "rtmp://xxxxx.xxxxxxx.com/cfx/st/mp4:<?=$canned_policy_stream_name; ?>",
    							width: "100%",
    							aspectratio: "16:9"
    							<?php echo $fredi->hideTabs('delete|settings')->renderAll(); ?>
    							<br />
    							<h2> <?php echo $page->get('headline|title'); ?> </h2>
    							// Render Year
    							echo $page->year; echo " | ";
    							// Render Runtime
    							echo $page->runtime; echo " mins | ";
    							// Get Classification and Render
    							foreach($page->classification as $rating) {
                        		echo $rating->title; echo " | "; }
                        		// Get Genre and Render
                        		foreach($page->genre as $genre) { echo "{$genre->title} "; }
    						<hr />
    							<?php echo $page->body; ?>
    						<?php foreach($page->images as $banner) echo "<span class='image featured'><img src='../../../site/assets/files/{$page->id}/{$banner->name}' alt='' /></span>"; ?>
    			<!-- CTA -->
    				<section id="cta">
    					<h2>Want to know more about <b><?php echo $page->title; ?></b>?</h2>
    					<p>Enter your email and we'll be in touch shortly.</p>
    						<div class="row uniform 50%">
    							<div class="8u 12u(mobilep)">
    								<input class="fit" type="email" name="email" id="email" placeholder="Email Address" />
    							<div class="4u 12u(mobilep)">
    								<input type="submit" value="Sign Up" />
    <?php include('./_footer.php'); ?>

    Here's the current code from the template. Thanks Apeisa!

  2. ProcessWire 2.5.19 dev

    Maybe I should test it with a new and clean PW install...

    Adding pages sounds good. Parent and template could be set as param by code or an default like current page. With hidden tabs frontend create pages will be comfortable for all users.

    Did a clean PW install fix the issue?

    I'm having same issue - If I hide settings tab, can't save any changes to the page. 

  3. Any ideas?

    Solved the first problem of showing up on the first user. I moved the $freid->hideTabs function to the top of the page where I call in the fredi module. But, if I follow the instructions on the fredi module page and have 

    echo $fredi->hideTabs

    it echos 'fredi' on the page as text. Removing the echo fixes this.

  4. I'm using Fredi to allow other site admins to edit users. I have specified that the delete tab should be hidden but for some reason it still shows on the first user/page, but not on any others - I've deleted all users and started from scratch but the problem persists.

    Maybe I'm not using the 'hide tabs' function in the correct place? This is from my template file:

    echo $fredi->render('title|email|pass|allowed_screeners', $user); echo $fredi->hideTabs('delete');

    This is echoed for each user with a specific role. Any ideas?

    Also, in future I might want to give some admins visibility of the delete tab but currently, if I delete a user, the iframe refreshes and shows the entire page tree from the home page. Is it possible to make it have the same function as when a user saves the changes? ie. refresh the entire page/close the modal and show the changes on the page?

    Hope that makes sense!

    Thanks in advance.


    I'm using 2.5.3

  5. Thanks Adrian, I knew it was a simple fix and had been trying to get implode working but found PHPs manual a bit confusing. Ryan's examples made it much easier to understand.


    $gt = $genre->implode(' ', 'title');
  6. Hi PW community,

    Here's my code: 

    $films = $pages->find("template=film");
    foreach($films as $film){
    $poster = $film->poster->size(200, 280);
    $g = $film->genre;
    echo "..."

    If I echo $g, I get the page id of each array item (eg. 1159|1245|1291 etc), but if I echo $g->title I get nothing.

    I'm quite confused as if I echo $poster->url or path or name, that echoes out just fine.

    Thanks in advance!

  7. My next coming project might need secure files download probably.

    Take a look at the AmazonS3CloudFront module - I was using Hani's .htaccess method but am now using S3/CloudFront + signed URLs to deliver content securely.

    Works great and also takes the load of supplying the file off the web server.

    • Like 3
  8. I'm hoping you smart folk can help me out. I cannot for the life of me figure out why fancybox is not working in my PW install - 2.5.2

    Here's my head code

    <!-- FANCY BOX -->
                  <!-- Add jQuery library -->
                  <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
                  <!-- Add fancyBox -->
                  <link rel="stylesheet" href="<?php echo $config->urls->templates?>fancybox/source/jquery.fancybox.css" type="text/css" media="screen" />
                  <script type="text/javascript" src="<?php echo $config->urls->templates?>fancybox/source/jquery.fancybox.pack.js"></script>
                  <!-- END FANCYBOX -->

    Template code (I'm pointing to the assets with the method below because I have Amazon S3 module install which changes $file->url to the cloudfront URL, which I don't want for this. 

    foreach($page->images as $file) {
      $large = $file->width(500);
      $thumb = $file->width(300);
    echo "<a href='../../site/assets/files/$page->id/$large->name' class='fancybox' rel='group' ><img src='../../site/assets/files/$page->id/$thumb->name' ></a>";

    And lastly, the footer

    <script type="text/javascript">
    	$(document).ready(function() {

    I'm getting thumbnails but when I click them, it simply goes to the actual url of the file, instead of opening in fancybox.

    Any help is greatly appreciated!



  9. Great module!

    I'm creating a film database site with private content that authenticated users can download.

    I've used your plugin and configured it to work with signed URLs so users can't distribute the download link.

    Is signed urls the best method to ensure that downloads are only available for authenticated users?

    is it possible to have a setting within a file upload field to flag whether to upload the file to S3/cloudfront or store it locally on the PW server?


  10. Hi Hani,

    Quick question: How are you redirecting to the passthrough page?

    I've created a template file with the PHP code you posted and created a page using that template but now I'm a little stuck.

    I've also got the .htaccess file in assets/files/xxxx/

  11. That does answer my questions, thanks.

    Is there a simple way to only do the above check if the current user has a specific role e.g. 'viewer'?

    There will be a couple of users who will have access to every film, but I don't want to have to add each film for those users.

    Am I on the right track if if use:


    and then do the check based on whether that returns true or false?



  12. It's late so forgive me if I make no sense. 

    context: This is for a film database

    How can I pull a specific image from another page based on a selection from the current page?

    So, I am selecting a classification/rating for the film (e.g PG) - this works great and I am outputting the title of the selected page on the front-end.

    On each of the classification pages, I created an image field for a single image and uploaded the respective classification image/logo.

    Here's the code I used to echo the page title:

    <?php $rating = $page->classification; echo "<a href='{$rating->url}'>{$rating->title}</a>";

    I thought I'd be able to echo the image by adding:

    <img src='{$rating->image}'>

    but no such luck.

    Thanks in advance!


  13. I've got the field to specify the pages the user has access to setup - no problem there.

    I'm just not sure of the correct code to check between the current page id and the users allowed pages list. Is this something "if else" could do?

    I've been trying to get things working with the if else syntax but have had no luck. 

    If you could post some example code that would be a great help to push me in the right direction. 

  14. Thanks for your fast reply Adrian. 

    So when you say 'check whether the user has the film selected', would this check be done using a hook (either in the template file or in a module)?

    I also came across Ryan's Custom Page Roles module here which I believe is basically what you're talking about here, except slightly backwards and uses roles, not users. I've been trying to re-write this to work with users but am having no such luck.

    I'm new to hooks and modules but am keen to learn!

  15. Hi PW community,

    I've been on this forum for a few months and it has been a great help! I am just a little stumped now though with an issue which I think should be simple to fix/overcome.

    So a little background to this project...This is for a film distribution company who wants a secure film screening service for clients to view films. I need to set it up so that when a client logs in, they can only see the list of film pages that have been specified in the back-end. So the settings need to be on a per user basis, not per role.

    Ideally, I'd like it so that under the 'user' edit page, there'd be a section to add specific films.

    I'll mention that all of the films will have the same template. if that changes anything.

    This is basically the same as the 'Page Edit Per User' module that Ryan created.

    Any help is much appreciated!

  • Create New...