Jump to content

Robin S

Members
  • Posts

    5,009
  • Joined

  • Days Won

    333

Everything posted by Robin S

  1. It looks like you have some filters set in the Users lister. Does the error still occur if you remove the filters? Also, the title of your post is a little unclear - you have added "user-admin-artist" as a permission and not the name of a role, right? Just to confirm, you followed a procedure like this... Installed user-admin permission: Access > Permissions > Add New > Install predefined system permissions > user-admin Installed user-admin-all permission: Access > Permissions > Add New > Install predefined system permissions > user-admin-all Installed user-admin-artist permission: Access > Permissions > Add New > Install predefined system permissions > user-admin-artist Gave user-admin and user-admin-artist permissions to a role: Access > Roles > artist (or whatever) > checked 'user-admin' and 'user-admin-artist' Welcome to the forums BTW
  2. Thanks for the update. In Firefox the jumplinks show the green highlight but aren't triggering a scroll. In IE11 there is no highlight or scroll.
  3. First thing would be to check that those two "if" tests are being passed. You can do this by logging a message after each test. Or it's really easy with Tracy Debugger: $fu->addHookAfter('FrontendUser::save', function($event) use($fu, $input) { if($event->return === true) { bd('test one passed'); if(!empty($input->post->password) && !count($fu->form->getErrors())) { bd('test two passed'); // the rest of your code } } });
  4. @Jennifer Stock, I've been working on a module for this purpose for a while now. Figured it's time to finish it off and release it. Find it here:
  5. ConnectPageFields Allows the connecting of two related Page fields so that changing one updates the other. Purpose of module An example: suppose your website is about movies. You have a template "movie" with Page field "actors". For each movie you add the actors that appear in the movie. All good, but what if you want to find results like... the 10 actors who have appeared in the most movies actors who haven't appeared in any movies since 1990 You cannot retrieve these pages with a single efficient $pages->find() query, and must load a large PageArray into memory in order to iterate or filter it. For the sake of making these types of queries more efficient you could structure your templates/fields so that movies are added to actors instead, but this may be a less comfortable workflow and can run into equivalent problems (e.g. "find the 10 movies with the largest cast"). The solution is to have a two-way relationship so that movie pages have an "actors" Page field and actor pages have a "movies" Page field. This module will keep these two Page fields in sync so that adding "Ryan Gosling" to "Drive" automatically adds "Drive" to "Ryan Gosling". Also, you can select the same Page field in both Page field A and Page field B. For example, create a "Related" Page field for related pages. Choose "Related" for both fields in a pair in the module config. Now when you add "Orange buffoon" to Related for "Donald Trump", "Donald Trump" is automatically added to Related for "Orange buffoon". Usage Install the ConnectPageFields module. If you haven't already done so, create the two Page fields you want to connect and add them to templates. In the module config select the two Page fields in a "Connected field pair" row as Page field A and Page field B. You can add rows as needed using the "Add another row" button. Troubleshooting Make sure you have set the "Selectable Pages" settings for each Page field correctly: The settings for Page field A should allow pages using the template(s) that Page field B has been added to. The settings for Page field B should allow pages using the template(s) that Page field A has been added to. http://modules.processwire.com/modules/connect-page-fields/ https://github.com/Toutouwai/ConnectPageFields Module config: Demo showing how changing one Page field updates the other:
  6. I was wrong about the bug in PageTable - I misinterpreted what the purpose of the 'reloaded' event was. So unfortunately there's no event that's guaranteed to trigger when the inputfield does an AJAX reload. Instead we have to check the PageTable field with every ajaxComplete(). But that's not actually a bad thing because we want the check to fire if the PageTable was inside an AJAX loaded field. If you placed a modified InputfieldPageTable in /site/modules/ please remove this and install LimitPageTable v0.0.2: LimitPageTable.zip 1. This is straightforward - in "Table fields to display in admin" just use template.label instead of template, and change the module to match against tpl_label: return $(this).text() == tpl_label; I considered making this the default for the module but I don't like the header given to the table column when this option is set. 2. Not sure what you mean here - the button is disabled in the PageTable field, isn't it?
  7. I started changing over my default site profile that I use as a base for new projects to use the functions API and region() function. Then I realised that neither of these will suit me because the functions can't be interpolated in strings the way variables can. I much prefer string interpolation over concatenation - I find it more concise and easier to read. The main attraction to me was the IDE code completion. Pasting the following at the top of each template file does the trick and isn't much hassle. namespace ProcessWire; /** * ProcessWire API variables * * @var $page Page * @var $pages Pages * @var $modules Modules * @var $user User * @var $users Users * @var $permissions Permissions * @var $roles Roles * @var $input WireInput * @var $sanitizer Sanitizer * @var $session Session * @var $log WireLog * @var $cache WireCache * @var $datetime WireDateTime * @var $files WireFileTools * @var $mail WireMail * @var $config Config * @var $database WireDatabasePDO * @var $fields Fields * @var $templates Templates * @var $languages Languages * @var $wire ProcessWire * @var $procache \ProCache **/ A similar thing can be done for region variables to avoid IDE 'undefined variable' notices. /** * Template region variables * * @var $headline * @var $content * etc **/ I've set these up as a file template in PhpStorm so they appear automatically for each new PHP file created in the project.
  8. This seemed like a fun challenge so I put together a little proof-of-concept module. For this to work you need to do a couple of things: 1. Correct a bug in InputfieldPageTable.js - hopefully will be fixed in the core soon. In the meantime you can copy the InputfieldPageTable directory to /site/modules/ and change line 18 of InputfieldPageTable.js to: Edit: sorry, I was wrong about this 2. Include "template" or "template.label" in "Table fields to display in admin" for your PageTable field. A screenshot of the module config: Download v0.0.3: LimitPageTable.zip
  9. The docs for MSN do cover this. If your parent page has a particular template you can use the xtemplates and xitem_tpl options. For more advanced targeting you can use a hook, for example: $nav = $modules->get('MarkupSimpleNavigation'); $nav->addHookAfter('getItemString', function($event) { $page = $event->arguments('page'); if($page->children->count()) { $event->return = "<button class='$page->name'>$page->title</button>"; } });
  10. Just looked at this issue recently. This seems to do the job: $this->addHookAfter('FieldtypeRepeater::wakeupValue', function($event) { $field = $event->arguments('field'); // Only for a particular repeater field // Could also use page argument for other tests if($field->name !== 'my_repeater') return; $pa = $event->return; $pa->sort("-created"); // or whatever sort you want $event->return = $pa; });
  11. Could this go in a linked JS file rather than directly in the template?
  12. Could be you need to increase post_max_size
  13. iOS devices actually handle links with hover states quite well - first touch triggers hover behaviour. For Android/cross-platform check out @bernhard's solution: Using a hash in a link href is not great because it usually triggers a page jump when clicked. Using href="javascript:void(0)" is a bit better, but if you don't actually have an href you should probably be using a button element instead of a link. But my suggestion is if you're using Javascript to trigger your menu then just leave the parent href untouched and use preventDefault() in your Javascript. $('#my_link').click(function(e){ e.preventDefault(); // no page reload // show dropdown menu });
  14. A typical way to do this sort of menu doesn't involve a hash in the parent href, but rather you use CSS to show/hide the nested lists of child pages. li > ul { display:none; } li:hover > ul { display:block; }
  15. How about... foreach($pages->get("/filme/")->children() as $p) { $genres[$p->name] = $p->children("sort=random, limit=2"); } for($i = 0; $i <= 1; $i++) { foreach($genres as $genre) { if($genre->eq($i)) { echo $genre->eq($i)->title; } } }
  16. I'm seeing a layout issue in the default admin theme where tabs are overlapping the breadcrumbs. The "hasWireTabs" class is not added to the body.
  17. The inputfield you choose for your Page field has no impact on how you access the field value using the API. So it's just like any other Page field. The important setting is "Dereference in API as" and this determines whether your field value is a PageArray or a Page object.
  18. @ottogal An easy solution would be to change... [[audio file="LINK"]] ...to... [[audio file='LINK']] If you want Hanna Code Helper to insert single quotes around attributes I think you'll have to modify the module code. Change line 124 to: $attrs .= " $attrName='$attrValue'"; You can use SimpleXML in your Hanna Code to get the href from the link: $a = new SimpleXMLElement($file); $path = $a['href']->__toString();
  19. Not sure why it wouldn't work in your case, but try getting the page by ID instead: $p = $pages->get(1234); This may be something that has changed in PW3, because I found this old post from Soma that suggests you need to add 'include=all' when getting a page by path:
  20. I can get an unpublished page okay with: $p = $pages->get('/path/to/page/'); Are you sure your path/name is correct?
  21. @Michael van Laar, you could use a hook to set the value of the Page field after a new article page is added. In /site/ready.php: $this->pages->addHookAfter('added', function($event) { $page = $event->arguments('page'); if($page->template->name != 'article') return; // your logic here to find the right author ID $page->setAndSave('author', $my_author_id); });
  22. To avoid editing core admin themes you could use the Admin Custom Files module and append to the document title with jQuery: $(document).prop('title', $(document).prop('title') + ' • ProcessWire');
  23. @majake I did a bit of sleuthing and I think your website may be using the Spex module. http://modules.processwire.com/modules/spex/ I don't think this module is very widely used (it doesn't come up often in the forum) so there may not be many members here who can help you with it. But check out the links above and that may point you in the right direction. One more thing - your site seems to already have an RSS feed with the same content you are trying to output: http://www.roofcoonline.com/blog/rss
  24. @majake - I suggest you remove the config info in your previous post for the sake of security. You don't want to be posting your DB username/pass etc in a public forum. A couple of other ways that "main.php" might be appended: 1. The file is pulled in with an include in your RSS template. Probably not as I expect you would have noticed this. 2. It would be unusual, but I suppose the file could be appended in a hook. So you could try this: In your RSS template, insert this: <?php $no_main = true; ?> And at the first line of "main.php" (or whatever the file is called that contains your header/footer markup): <?php if(isset($no_main) && $no_main) return; ?> Edit: actually, could you post the contents of your RSS template file? That will help get to the bottom of the problem.
  25. Hi @majake and welcome to the PW forums. I haven't used this module before, but I think you're right about the problem being related to a "delayed output" strategy. There is probably a template file being auto-appended to your RSS template - typically this would be called "main.php", "main.inc" or something similar. The instruction to auto-append this template file will be in your site config: probably in the /site/config.php file unless your site is using the ProcessWire Config module that stores additional config settings in separate JSON file. If there is a template file being auto-appended you should see a checkbox to disable this for the RSS template: Setup > Templates > rss (or whatever your template is called) > Files tab
×
×
  • Create New...