Jump to content

Torsten Baldes

Members
  • Posts

    186
  • Joined

  • Last visited

Everything posted by Torsten Baldes

  1. @kixe Do you have any special settings for the sessions? $xy->session->hasCookie(true) is always false, where $xy->session->hasCookie() is true. (I'm logged in to xy.) Thanks!
  2. Thanks! It's my way for a multi-site installation, which I can't/won't use because it's also multilanguage and an existing installation with lot's of pages. So I thought, this would be the easier way.
  3. Thanks! Yes, that could be my way to login. But the user also has to have an account in the other instance to login. That's the problem where my sync question comes from.
  4. @kixe Nice! But I don't think this would work for me. Does this work with backend access and editing? My users need access to every backend to edit content. But I don't want them to manage multiple profiles with (worst case) different passwords.
  5. Hi, i'm looking for a way to automatically sync users from a main installation to (multiple) other installations which all live on the the same server (pw native multi-site). Is there an easy way to do this? Or is the "easy way" to get all the users (with a specific role) via multi-instance (https://processwire.com/blog/posts/multi-instance-pw3/#using-multi-instance-in-pw3) and import/update them regularly (cron job) and disable profile editing for the subsites? Thanks!
  6. @ryan Thanks! I was refering to your "Future multi-instance goals" https://processwire.com/blog/posts/multi-instance-pw3/#future-multi-instance-goals That would possibly a great nice-to-have, but i guess, it's not that easy to implement.
  7. Thanks @ryan! I'll give it a try! Is it also working via http? --- Regarding the profile image: Yes it's from a running clothing brand and it's a statement against racism. The following screenshot is from their website: No, not that I know.
  8. @szabesz @wbmnfktr Thanks for your comments. As I said I'm evaluating the different methods right now. And part of this evaluation is doing some research (e.g. posting here). Narrowing down the possible solutions and building some testcases is the next step. As the main site is already done and live since 2016, the multi site solutions with third party modules are too much hassle. So the possible ways to go are "native" multi site or multi instances. My profile image is from my twitter account and automatically pulled in from there. I don't see where it is part of a discussion here and frankly it's not even political but common sense.
  9. Hi, I just read about Multi-Instance in PW3 (https://processwire.com/blog/posts/multi-instance-pw3/#using-multi-instance-in-pw3). As I'm in the process of evaluating different approaches of a multi site setup, this is one of the choices. Is this working properly or are there any downsides or caveats? @ryan Is this already possible or is it still on the todo list: https://processwire.com/blog/posts/multi-instance-pw3/#future-multi-instance-goals Thanks!
  10. Great module! Thanks! I just started to implement it on a site. There we load some stuff with Ajax after the initial page load. Is there a way (a public js function) to trigger the functionality (loading iframes) for elements which are added dynamically? Thanks!
  11. I got the same issue as @androbey and his solution worked for me too.
  12. Hi and thanks for the module! Do you send every log to Logstash or is there a way to only send a few selected logs? Thanks!
  13. @sekru Did you found a solution for this? I've got a similar/the same problem, which i just discovered on a live site 😱. For me headlines get underlined with "=" or "-", when i truncate text. It seems like that in newer versions from ProcessWire (since 22 May) the markupToText function (https://github.com/processwire/processwire/blob/dev/wire/core/WireTextTools.php#L57), which is used by truncate when stripTags=true, got some new options like linksToUrls (your problem) and underlineHeadlines (my problem). Unfortunately it seems not possible to set these options via the truncate function. I think truncate should set these options to false. @ryan Ist this by intent? Is there a way to prevent this? Thanks!
  14. The sorting of these queries is not really important. The important thing for me is, that the results from $find1 are in front of $find2. It's like a lazy weighted search, where I first search the titles of the pages for a keyword/phrase ($find1) and then search the other fields (body etc.) for the same keyword (excluding the ids from $find1). The logic here is, that pages, which have the keyword in their title, are more relevant/important than the other results and should come first.
  15. @dragan @bernhard Yes adding works to get a "unified" PageArray with the right order, but the pagination for this remains empty. $unifiedMatches = $find1->add($find2)->find("limit=$limit"); $unifiedMatches->renderPager() returns nothing.
  16. Thanks, but I'm afraid this doesn't work with pagination. At first I created a new wirearray and added the others. This worked regarding maintaining the order, but got me problems with the pagination. Your approach would possibly work too, but I would have the same pagination trouble. 😕
  17. Hi, I have multiple $pages->find() operations which result in multiple page ids. e.g.: $find1: 8044|10045|3702|11067 $find2: 2004|5421|9392 Next i'm searching these ids to get a new WireArray, which i can limit and paginate: $unifiedMatches = $pages->find("id=$find1|$find2, limit=$limit"); This works all as intended. The problem is, that this new collection of pages doesn't maintain the order of the ids in the selector. They are sorted by their id. $unifiedMatches: 2004|3702|5421|8044|9392|10045|11067 Is there a way to get the pages in the $unifiedMatches result in the order of the selector input? $unifiedMatches: 8044|10045|3702|11067|2004|5421|9392 Thanks!
  18. Thanks! I just posted a feature request.
  19. Thanks for your help! For now I ended up with something like this: wire('user')->setTrackChanges(Wire::trackChangesOn | Wire::trackChangesValues); wire()->addHookAfter("Pages::saved", null, function($event){ $user = $event->arguments(0); if($user->template->name == 'user'){ $userfields = $user->template->fieldgroup; $excludeFields = ['pass', 'roles', 'language', 'admin_theme', 'schedulerSkip', 'cpf_added']; $changes = $event->arguments(1); // check if there are any changes, if it's not an InputfieldFileAjax (also triggers the hook), the user changed his own profile, if the changed user is not a superuser (could be any other role to exclude) if(count($changes) && !wire('input')->get->InputfieldFileAjax && wire('user')->id == $user->id && !$user->hasRole('superuser')){ $userfieldsArray = array(); foreach($userfields as $userfield){ $userfieldsArray[] = $userfield->name; } //remove unwanted fields $changes = array_diff($changes, $excludeFields); // order changed fields like template $changesSorted = array(); foreach ($userfieldsArray as $item) { if(in_array($item, $changes)){ $changesSorted[] = $changes[$item]; } } $changes = $changesSorted; unset($changesSorted); // probably not necessary // get the changes in a string $changedFields = ''; foreach($changes as $change){ $changedFields .= $userfields->get($change)->label . "\r\n"; } // compose the mail $subject = "Änderung im Nutzerprofil von »".$user->u_fullname."«"; $message = "Hallo,\r\n\r\n das Nutzerprofil von ".$user->u_fullname." wurde aktualisiert.\r\nFolgende Felder haben sich geändert:\r\n\r\n" ; $message .= $changedFields; $message .= "\r\n\r\n" ; $message .= "Klicken Sie hier, um das Profil zu bearbeiten: ".trim(wire('urls')->httpRoot, '/').$user->editUrl ; $message .= "\r\n\r\n\r\n"; $mailmessage = wire('mail')->new(); $mailmessage->to('mail@domain.tld')->from($user->email); $mailmessage->subject($subject)->body($message); $sent = $mailmessage->send(); } } }); I decided that it's not necessary to send the before and after values within the email. This could even be a privacy and/or security issue. Thanks again for your ideas and help!
  20. Hi, I'm building a site with user profiles, where the users can change and update their profile. For different reasons it's important that the person who oversees these users get's an email, when a user updates his profile. At best with all the values that changed and their value before. I tried to hook into User::changed and this kind of works, but it get's triggered for every field, that's changed. With each trigger the list of fields also get's longer, so that only the last run contains all the changed fields. This would mean, i would send multiple emails for one profile change. Is there a way to prevent this and get all changes at once in only one hook run? This is my code so far (in ready.php): wire('user')->setTrackChanges(Wire::trackChangesOn | Wire::trackChangesValues); wire()->addHookAfter("User::changed", null, function($event){ $user = $event->object; $changes = $user->getChanges(true); // output changes as log entry wire('log')->save('testchangelog', print_r($changes, true) ); // TODO: send mail }); Thanks!
  21. Most of the time other users/editors use this Field to "generate" a selection of posts/pages which are applicable for the topic of the current post. Something like "If you liked this post, then these posts could also be interesting to you".
  22. Hi, I'm using the core module FieldTypeSelector (like Lister) to be able to create custom lists of pages on my pages. e.g. show me pages with template=foo, somevalue=bar and someothervalue=foobar. Is there a way to use OR groups (https://processwire.com/docs/selectors/#or-groups) with FieldTypeSelector? This way I could build a list of pages which have somevalue=bar OR someothervalue=foobar As a selector this would look like this: template=foo, (somevalue=bar), (someothervalue=foobar) Is this possible? I know I could insert this as a _custom selector, but this would kind of defeat the purpose of FieldTypeSelector. Thanks!
  23. Hi bernhart ;-), thanks, that did the trick! Here's my code, if someone also needs to do this: wire()->addHookAfter('ProcessPageEdit::buildForm', function (HookEvent $e) { // skip the whole thing and return, if the user has not the proper role if (!wire('user')->hasRole('superuser') && !wire('user')->hasRole('useradmin')) return; $form = $e->return; $boxes = ['privacy', 'consent']; foreach ($boxes as $box) { $boxfield = $form->getChildByName($box); if($boxfield){ $boxfield->required = false; } } });
  24. Hi, I have a website with some users and admins who create and administrate these users. In their user profile is a checkbox which is set to required. When the admins create or edit an user they have to check this checkbox to be able to publish this user. But this checkbox should only be checked by the user itself. So I want to set this checkbox to "unrequired" when a user with a certain role is editing this profile. I tried to do this with the following hook (check for role not yet included), but I can't get it to work. wire()->addHookBefore('InputfieldCheckbox::render', function (HookEvent $event) { if ($event->object->name != 'consent') return; $field = $event->object; $field->required = false; $field->set('required', 0); }); It catches the right field but it doesn't set the field to unrequired. Is this hook too late in the chain or do I have to do this with another property or method? Thanks!
×
×
  • Create New...