Jump to content

saschapi

Members
  • Posts

    63
  • Joined

  • Last visited

Posts posted by saschapi

  1. 1 hour ago, wbmnfktr said:

    Did you perform an ProcessWire upgrade recently? Otherwise something else must have changed.

    With "suddenly" I meant after installing language support field. After I uninstalled it the selector worked again. 

    Point is: it shouldn't be a feature if alternate language field is used. At least to my understanding. 

    Might need to test some more on my site. 

  2. Hi there,

    i have a selector that goes like this:

    $pages->find("has_parent!=2,created<$ts,title=''");

    This has worked fine in the past and should get me certain pages that are older than a certain period ($ts) and have an empty title (happens in a circumstance).

    However I have no installed Languages Support - Fields. This is only because in ONE Template I wanted to have a language alternate title. I called this field "title_german" and it works as expected.

    However: Suddenly the above selector gives me ALL the pages that do not have the field "title_german" filled IF the user has German as his language. In English, everything is fine. 

    First of all: Only one template has "title_german" the others only have "title" and it is certainly not empty. Still, they all get selected.
    Second of all: Shouldn't looking for "title" in a selector check "title_german" first and if that is empty fallback to "title"? 

    I mean, I could check the user language and modify my selector to "title_german" but what if "title_german" is empty and "title" is not?

    Any idea how to do this? What did I do wrong? 

    Thanks for any input. Sascha

  3. In one of my projects editors "constantantly" create pages without titles and abandon them (see screenhot). Due to some circumstances I had to activate the "Name for children" and autogenerate the name. So when the editors create a page in that section it is automatically saved with an cryptic name when they add a new page. When the editor just closes the browser or due to other reasons does not use this page there are several "empty" pages that no one uses. I would love to delete those empty pages after 24 hours or so. 

    Question: What would be a good way to achieve this? I'm thinking aloud here:

    1. Use a hook that is regularly fired? (Which and how)
    2. Check if there are any pages with empty title (and/or other factors) and that are created 24 hours+ ago?
    3. Delete the page?

    I have never really used any hooks and so I'm a bit lost where to start and how to "cron" this task.

    Any hint would be helpful, maybe I even miss something that could be used to more clean up those abandond pages more easy. 

    Thanks in advance for any help, Cheers Sascha

    SCR-20230509-tzc.png

  4. On 2/14/2023 at 7:54 PM, matjazp said:

     

    private function _isPageAllowed($page)
        {
            return ($page instanceof Page && $page->editable() && $page->template != 'admin' && $this->wire('user')->isLoggedin());
        }

    As you can see, page with admin template is not allowed.

    Thanks for looking into it. I wonder why the Superuser is able to do it... 🤔

    Anyway. I will have to write my own way to handle it. 

  5. Hi guys,

    I'm using FEEL on a project and it works very well.

    Unfortunately I'm not able to use the add-new Mode for users and also not the edit button for users for non superusers.

    I have a list of all users and would like a specific user role (and superusers) be able to open the edit screen for a user via FEEL. The user role can add and edit these users without a problem in the backend and superusers can also see the FEEL Button. But the "normal" user role cannot. This is probably because of the fact that they don't have access to admin template pages? 

    The other issue ist the add-new Mode for users. I have tried something like this with page 29 being the parent of all user pages:

    <?php echo $pages->get(29)->feel(array('mode' => 'page-add', 'text' => __('Add user'))); ?>

    Regardless of the user permissions of the logged in user, the button to add new users doesn't show, not even for superusers.

    Any idea how to use FEEL with users, specifically with a nonsuperuser role?

    Thanks for any input 😉

    Sascha

  6. @kongondo absolutely understandable. :) I have maneuvered myself into a strange setup with two sites with different systems (one that I inherited form another freelancer). One page imports stuff from the other but only in a certain frequency. My problem resulted in something changing on the source page (PW) and the reference on the other site being wrong at that point (different file name). 

    I just managed to fix this (5 minutes ago) by changing the import on the other page (importing the images instead of linking to them). So this topic is resolved. My reflex to fix things on the PW site must be, because it is always easy to do stuff in PW and the other system is a different kind of breed. :) 

    Thanks for trying to pitch in. :) you were right, to fiddle with this issue on the site of the source was not the right way. 

    • Like 1
  7. Hi guys,

    I would like to send out an email to the admin group if a page get's published or unpublished. I found this old topic on that matter:

    But I guess there have been some changes since 2012 ? Is there a "page gets published" hook yet? 

    Or is there any other quick way to do this? I did not find anything with a quick search.

    Cheers, stay healthy and thanks Sascha

  8. Hi Guys,

    I'm trying to get Dublicator up and running as a automated backup solution. While it is working as expected if I trigger it manually, I'm still figuring out the automation. But this will come ?

    Anyway. I wanted to report that if you delete packages via the Package Manager, the corresponding logs do not get deleted. This results in Packages shown in the summary on the config page. (see attachment). This might be a wanted behaviour but confused me. ? This could be fixed by deleting the logs manually via FTP.

    Cheers Sascha

    2020-02-14_10-16-23.png

    • Thanks 1
  9. Hi guys,

    I'm looking for the not so uncommon functionality to publish (or "un-hide") pages on a specific date and time. I did not notice till now, but this functionality seems to be missing from the core.
    Scheduled pages seems to do just that but is not supported for PW3... Is there really no module or function that publishes pages in the future? I know that I need to setup a cron job or use lazy cron, but I'm wondering if I miss something? :)

    Cheers Sascha

  10. Hi guys,

    I'm working with pagefieldset and have several fields in there. 

    Every field has a accompanying checkbox. I want to only show the field, if the checkbox is checked. That works as expected if I have a rule in "visible only if" like "checkboxfield=1". 
    However, I would like this field to be required (of course only if it is visible aka the checkbox is checked). The visibility thing works, but on save PW complains about the field not being filled, even if the checkbox is not checked. Usually if a field is hidden, the check for required is not executed. This does not work in "pagefieldset"? Even If I add "checkboxfield=1" to "Only required if" it does not work.

    Is this because dependencies in repeaters do not work stable and pagefieldset works like a repeater?

    Cheers Sascha

  11. This sounds about right. I think I will switch to the FieldsetPage structure. 

    I used that before but forgot about it ? Question related to FieldsetPage: Usually I do the following. Mark a field as required and have a visibility condition so the field only shows up if needed. This does not give an error on saving is the field is hidden. With FieldsetPage I have an error that the required field cannot be empty. Even adding the condititon to "required only if" does not help. Funny thing is, the visibility condition works as expected otherwise. So, the field only shows if the condition is met, but it is marked as required. Do you have any idea why that is @BitPoet?

    In my example above I have "sender_trailer_file1_changes_check=1" as condition.

  12. Hi guys,

    I'm trying to achieve a timed update of posts kind of feature. I'm using a process mentioned here: 

     In short: I have a date field and if the date is in the past I switch content from fields (like "title_change") to the origional fields (like "title"). After that I clear the change fields. Full code here:

    		// set date
    		date_default_timezone_set("Europe/Berlin");
    		$planned_date = $single->sender_change_datetime;
    			//check if date is in the past and if so, work your macgic
    			if($planned_date < time()) {
    					echo "date is overtime" ;
    					// stop output formating
    					$single->of(false);
    				
    					// Collect change data
    					// Title
    					if($single->sender_title_changes_check) {
    						//set new field						
    						$single->title = $single->sender_title_changes;
    						$single->sender_title_changes = false;
    						$single->sender_title_changes_check = false;
    					}
    					// Quality
    					if($single->sender_quality_changes_check) {
    						//set new field						
    						$single->sender_quality = $single->sender_quality_changes;
    						$single->sender_quality_changes = false;
    						$single->sender_quality_changes_check = false;
    					}	
    					// Genre
    					if($single->sender_genre_changes_check) {
    						//set new field						
    						$single->sender_genre = $single->sender_genre_changes;
    						$single->sender_genre_changes = false;
    						$single->sender_genre_changes_check = false;
    					}
    					// Description
    					if($single->sender_description_changes_check) {
    						//set new field						
    						$single->sender_description = $single->sender_description_changes;
    						$single->sender_description_changes = false;
    						$single->sender_description_changes_check = false;
    					}
    					// Pakete
    					if($single->sender_paket_changes_check) {
    						//set new field						
    						$single->sender_paket = $single->sender_paket_changes;
    						$single->sender_paket_changes->removeAll();
    						$single->sender_paket_changes_check = false;
    					}	
    					// Logo
    					if($single->sender_logo_standard_changes_check) {
    						//set new field					
    						echo $single->sender_logo_standard_changes->eq(0)->filename;
    						$single->sender_logo_standard->removeAll();
    						$single->sender_logo_standard->add($single->sender_logo_standard_changes->eq(0)->filename);
    						$single->sender_logo_standard_changes->removeAll();
    						$single->sender_logo_standard_changes_check = false;
    					}				
    				
    					//remove the changes checkbox and clear date
    					$single->sender_change_check = false;
    				    $single->sender_change_datetime = false;
    				
    					//save page
    					$single->save();
    				
    					//flag changes necessary
    					$changes_necessary = true;
    			} 
    		

    Works as expected. BUT my issue is with images.

    Look at the detailed code here:

    					if($single->sender_logo_standard_changes_check) {
    						//set new field					
    						echo $single->sender_logo_standard_changes->eq(0)->filename;
    						$single->sender_logo_standard->removeAll();
    						$single->sender_logo_standard->add($single->sender_logo_standard_changes->eq(0)->filename);
    						$single->sender_logo_standard_changes->removeAll();
    						$single->sender_logo_standard_changes_check = false;
    					}	

    This works fine, but the image is empty. There are no files present. I guess this is because I clear the "sender_logo_standard_chages" field with "removeAll()"? It automatically deletes the files? 
     

    If this is my problem: How do I delete just the file reference in "sender_logo_standard_chages" while keeping the files? 
    If this is NOT the problem: How do I achieve what I want to achieve? :)

    Thanks guys for any input Sascha

  13. Hi guys,

    I added a date-time field to a template that will initiate some scheduled stuff by a cron.

    However I would like to check if the date and time the editor has chosen is in the future (in fact it should be at least 30min into the future). And through out a validation error if the date/time is not valid in this way.

    Any help how to hook into the validation process? Or is there a way to limit the date picker in this way in advance, before the page would be saved?

    Cheers and thanks for any input

    Sascha

×
×
  • Create New...