Jump to content

Sinmok

Members
  • Posts

    57
  • Joined

  • Last visited

Posts posted by Sinmok

  1. Hi all, I'm trying to figure out how to set the Admin theme for the login and reset password pages.

    I copied the AdminThemeUIKit, folder from core into site/templates/modules and renamed the module and my modifications work fine once you have logged in.

    The issue is that the login page and reset password pages still use the default theme under from core.

    Things I've tried

    • Assigning this new theme against the guest role
    • Updating $config->defaultAdminTheme in site/config.php
    • Checking the box "Use this admin theme for login screen"

    All with no luck. Any suggestions?

    Thanks.

  2. I'm trying to filter pages based on the values of one or more of their descendant pages.

     

    Here's my tree

    Project 1

        Tasks folder

            Task group 1

                 Task 1 (assigned_to_user=user1)

                 Task 2

    Project 2

        Tasks folder

            Task group 1

                 Task 1 (assigned_to_user=user2)

                 Task 2

    I'm trying to find all "projects" where one of the descending "tasks" assigned_to_user field = user1

     

    So in the example above only "Project1" should return because project 2 has no tasks assigned_to_user=user1 

     

    How can I do this as efficiently as possible considering there may be 100's of projects and several thousand tasks?

    I hope this makes sense!

    Thanks!

  3. Hi all,

    Been a while ?

    I'm trying to achieve two kinds of selectors. One to select pages based on a parents field value and one to select pages where all children match a condition.

    For example, I am hoping to do something like this:

    <?
    //I want pages of template type task where the PARENT page field "closed" = 0
    $groups = $pages->find("template=task,parent-of-page.closed=0")
    ?>

    Finally, I would like to select pages where all children follow a condition

    <?php
    //I want pages of template type group where ALL of the pages children field called my_int_field = 0
    $matches = $pages->find("template=group, children.my_int_field=0");
    ?>

    Are these two scenarios currently possible without iterating over a simpler selector first?

    Thanks!

  4. I was hoping to get some ideas on how to implement "interactive elements" within CKEditor fields.

    For example, one of the requests is to be able to embed a clickable button/image that brings up a Lightbox and shows some sort of content.

    Bearing in mind the majority of users editing the CKEditor fields are not at all tech savvy and barely understand what HTML is.

    I know about and have used Hanna code before to solve this issue but I was wondering how else you could accomplish this sort of task?

    How have you overcome these sorts of issues before?

  5. The version was 2.3.0, I don't know if it affects newer versions.

    This has most certainly affected other projects because I remember asking questions and being told has_parent was the answer, but no matter what I did, has_parent just wouldn't work. That project was using a lot of cloned pages, too..

    I won't be using Page cloning any more as a safety pre-caution until we can get verification!

  6. Also worth noting that the following does not work either:

    $p = $pages->get(1080) // returns the page I wanted
    
    $r = $p->find("") //returns empty..
    
    //as does
    
    $r = $p->find("id>0") //also returns empty

    however

    $p->children //DOES return a page array

    This DOES work on other pages that has children. Whaaa

  7. Hello,

    I'm having trouble with a has_parent selector..which seems to work..only sometimes.

    I've got a page tree like so (ids are made up for demo purposes)

    Home
        Page 1 (id = 1050)
            sub 1
            sub 2
       Page 2 (id = 1080)
            sub 3
            sub 4
       Page 3  (id = 1090)
            sub 5
                sub 6
                     sub 7
                sub 8
                      sub 9

    The really weird thing is that the same selector with different page id returns something unexpected..despite the only change being the page id

     

    for example, i'm getting

    $result = $pages->find("has_parent=1050") //returns a page array of 2 pages
    
    $result = $pages->find("has_parent=1080") // returns an empty page array (WHY?!)
    
    $result = $pages->find("has_parent=1090") //returns a page array of 5 pages
    

    is there anything that could be causing the selector for page id 1080 to return nothing? the templates, access control and all that are all exactly the same

    Are there any other known variables that might affect the result of a 

    has_page

     selector?

    I'm using ProcessWire 2.3.0

    Edit: Basically, all I need is a PageArray of all descendants of a given page - do you know of another way of doing this?

  8. Hi all,

    Trying to create a simple script that iterates over each page and simply calls the save function. I've got a file called saveall.php with the following code:

    <?php
    
    include 'index.php';
    
    function sitemapListPage($page) {
    
        $page->save();
        
        if($page->numChildren) {
    
            foreach($page->children as $child){
                sitemapListPage($child);
            }
    
        }
    
    }
    
    sitemapListPage(wire("pages")->get("/"));
    
    ?>

    This code sample is adapted from the ProcessWire sitemap plugin, but I've tried other methods and nothing seems to work.

    I want to call save() as I have a beforeSave hook from a module that I want to run.

    However for some reason, running this script causes me to get the follow error, on every page:

    Error: Uncaught exception 'Wire404Exception' with message 'Unknown page' in /var/my_site/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module:59

    If I loop through each page and print out the id/title of each page in the loop, they display fine.

    Any idea what might be causing this?

    I'm using PW 2.3.0

    EDIT:

    Never mind - figured out the error was coming from the installed module -_-

  9. Hello all,

    Need a bit of advice.

    I have a page structure where users with a specific role either can or can't view the page.

    The problem is, is that I need to be able to have users who can add other users..but only assign them to specific roles.

    For example:

    A manager can add users and assign the roles: 

    Supervisor or worker

    A supervisor can add users but only assign the new users with the role of worker

    A worker can't add any users.

    Is this currently possible to do in processwire? If not, how would you go about doing it?

  10. Don't know if you can already do this, but implementing PHPs array_chunk method would be pretty useful..

    For example

    $list = $pages->find("template=something"); // Returns 5 pages
    
    $chunked = $list->chunk(3);
    
    print_r($chunked);
    
    /*prints*/
    
    array(
      0=> array(
                 Page,
                 Page,
                 Page
             )
      1=> array(
                 Page,
                 Page
             )
    )

    Especially useful if you're trying to print pages into columns.

    Can you already do this?

    • Like 4
  11. How do you clone the home page? There's no copy option. Does it have to be done via the API?

    Edit: Just tried cloning the homepage and setting the clone's parent as the homepage through the API and I'm getting an error saying I can't edit the ID of a system page =\

  12. Hi all,

    I need to switch out which page represents the home page. I have a lot of field data in the existing home page but have been advised that the home page needs to be swapped out for another existing page.

    Both pages already have a lot of data so re-doing them would take a lot of time and effort. Is there a way I can switch out the home/root page? I can't seem to move them.

    Alternatively, is there a way I can copy the home page? Then I could just call $pages->get("/")->home_page->render() in the home template without losing everything I've done.

    Cheers

  13. What are the licensing restrictions on the CKEditor pwlink and pwimage plugins?

    I'm working on a new front end editor and the only thing that doesn't work is the linking and image selecting. I reckon i could get it to work by modifying the existing plugins to work with the module I am building instead.

    Am I allowed to do this? I don't see any license files

    Cheers

×
×
  • Create New...