Jump to content

imandreas

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by imandreas

  1. We made like this, in the header PHP template we checked, if the user is able to edit the page if ( wire('page')->template == "user-item-template" and (wire('user')->hasRole('frontendeditor') ) ) { echo "<!-- skip jquery -->"; } elseif ( wire('page')->template == "user-content-template" and (wire('user')->hasRole('frontendeditor') ) ) { echo "<!-- skip jquery -->"; } else { ?> <script src="<?php echo $config->urls->templates;?>js/jquery-3.7.0.min.js"></script> <? } Then it was possible to call the alfred: <div class="btn btn_default" <?= alfred($item, "title,text,content") ?>> <i class="fa-solid fa-pen-to-square"></i> Edit </div> It was opening the edit mode in a modal view with some administration header stuff.
  2. Hi, it is almost 6 months, since I worked on this, but I remember, that you have to use the jquery version from PW admin. You should see the magic lines "ALFRED is ready :)" in console, if you include the PW jquery, which is loaded by alfred Maybe that helps
  3. Hi, unfortunately not, I had to re-install it, quite bad, but I had not idea howto solve it.
  4. Hi , this topic is quite tricky, using the API to insert multilangual content, thanks for the above input. This works for me, just if someone needs it. Code is not cleaned: // Array with parent ID, object IDs of external database $externalDataFromJson["pwParentID"] = 12345; $externalDataFromJson["DE"] = '{"12": "Äpfel", "13": "Orangen" }'; $externalDataFromJson["EN"] = '{"13": "Oranges","12": "Apples"}'; createIt($externalDataFromJson); function createIt($data) { $dataDE = json_decode($data["DE"], true); $dataEN = json_decode($data["EN"], true); $DE = \ProcessWire\wire("languages")->get("name=default"); // Get the language object for the default language $EN = \ProcessWire\wire("languages")->get("name=en"); // Get the language object for the second language foreach ($dataDE as $id => $term_DE) { $findItBefore = \ProcessWire\wire("pages")->findOne('template=_vocabulary,external_id=' . $id); if ($findItBefore instanceof NullPage) { echo "<br>Do not Exists: " . $id . ' - ' . $term_DE . ' create: external_id '; $p = new \ProcessWire\Page(); $p->setOutputFormatting(false); $p->parent = \ProcessWire\wire("pages")->get( $data["pwParentID"] ); $p->template = '_vocabulary'; } else { echo "<br>Exists: " . $id . ' ' . $term_DE; //var_dump($findItBefore); $p = $findItBefore; $p->setOutputFormatting(false); //$p->of(false); // outputFormatting must be OFF } if (isset($dataEN[$id])) { $term_EN = $dataEN[$id]; } else { $term_EN = "Eng not found"; } $p->name = \ProcessWire\wire('sanitizer')->pageName($term_DE, true); $p->title->setLanguageValue($DE, $term_DE, true); $p->title->setLanguageValue($EN, $term_EN); $p->external_id = $id; $p->save(); //$p->set("status$de",1); $p->set("status$EN",1); //$p->set("name$de", \ProcessWire\wire('sanitizer')->pageName($term_DE, [true])); $p->set("name$EN", \ProcessWire\wire('sanitizer')->pageName($term_EN, [true])); $p->save(); $url = $p->localUrl("de"); echo "<hr>"; var_dump($url); $url = $p->localUrl("en"); echo "<hr>"; var_dump($url); echo "<hr>"; } } Now in settings/ the second URL (in my case "en") is "active" and translated :)
  5. On my latest PW installation the login was suddenly not possible anymore. I tried to to follow both instructions, but it didn't solve the issue. At the end I had to fully re-install PW. Just as a note: bot codes above are working only once. On every call the password has to be changed.
  6. Hi there, there is a strange issue on ProcessWire 3.0.226, I have this error message: Templates: Template 'language' page class 'Language' is not available Templates: Template 'language' page class 'Language' is not available The reason, why I want to install Language, is that my PW installation is showing all the time this Info message: ModulesInstaller: Unable to install module (LanguageSupport): There is already a template installed called 'language' +1 I don't know how this happened, but I can't install any Language modules to fix this issue. If I try to install Modules / Core / Language / LanguageSupport, its showing Errors: Error installing module - LanguageSupport ProcessModule: Failed module dependency: ProcessLanguage requires LanguageSupport ProcessModule: Failed module dependency: ProcessLanguageTranslator requires LanguageSupport I have no clue right now, how to solve.
  7. Hi @JoseFrasherunfortunately not. As PW is so perfect and fast on all frontend issues, it is a bit tricky on the user generated content. So I still use the API as above to create the new content. Then I list the newly created page in the template called "my-pages": foreach( wire("pages")->find("created_users_id=$user->id, template=user-generated-content-template") as $item){ ... <div class="btn btn_default" <?= alfred($item, "title,body,.....") ?>> <i class="fa-solid fa-pen-to-square"></i> Edit </div> } And one problem is still remaining: Users can edit other templates of "user-generated-content-template" created by other users as well, if they know how to. Here I should add somewhere a hook on this template for edit, if the current user is equal to the user, who created that page.
  8. Yes, if I want to restrict the access only to frontend, it is. In backend it is quite tricky, since on user generated content all users create content with the same type of template, so the backend has not the possibility right now to show only templates, that are created (owned) by the logged in user. Right now I solved the issue like this: - installed the module "Admin Restrict Page Tree": this disables all content for users with a selected role in the backend. This is ok, because I show their content in the frontend with: My content: <?php foreach( wire("pages")->find("created_users_id=$user->id, template=my-user-content-template, sort=-created") as $item){ echo "<br><a href='$item->url'> Detail view: $item->title</a>"; } ?> - but as I see, there is no possibility to restrict with roles and permissions the list of content, especial in the nav item of the backend with the content tree. So I made a hack in /wire, or better, lets say a "patch" when rendering the nav items (search also removed): wire/modules/AdminTheme/AdminThemeUikit/_masthead.php <?php if($adminTheme->isLoggedIn): ?> <ul class='uk-navbar-nav pw-primary-nav'> <?php //bd($user); foreach ($user->roles as $itmRole) { //bd($itmRole); if ($itmRole->name == "superuser") { echo $adminTheme->renderPrimaryNavItems(); } } ?> </ul> <?php endif; ?> .... <?php if($adminTheme->isLoggedIn): ?> <ul class='uk-navbar-nav pw-primary-nav'> <?php foreach ($user->roles as $itmRole) { if ($itmRole->name == "superuser") { $adminTheme->includeFile('_search-form.php'); } } ?> </ul> <?php endif; ?>
  9. I'm trying to setup a website, where users can generate their own content. Frontendprogramming is working fine on PW as a charm, for user registration I'm using the module "Login Register Pro" and for frontend editing right now "RockFrontend" with Alfred looks so good, all fields are perfect accessible. But there are remaining security issues, that I can't solve: Users might be accessing the PW backend and have the possibility to read the whole content. - trying module "Admin Restrict Branch" will disable RockFrontend, because jquery from PW backend can't be loaded and the "navbar-nav" menu in backend is showing content anyway - RockFrontend Role granted to Permission "page-edit-front" has jquery problems in Frontend with older jQuery version - creating a new content: I found only a solution with API programming, creating a form field and processing it on PHP in template. Once this content is created, it can be edited with Alfred <form action="/my-user-content-template/" method="post"> <input type="text" name="title"> <button type="submit" name="create-new-content">Create New Content</button> </form> But overall it is not straigthforward as everything else on ProcessWire. Are there any other approaches?
  10. Solved :) This Permission needs to be added to the user role "frontend": - "page-edit-front".
  11. Now I have installed a blank ProcessWire and installed only one module, the RockFrontend. As an admin user the frontend editing is working perfect, but with a dedicated frontend user with its owh user role, in javascript console its writing : Loading jQuery... jQuery not found So I'm missing the nice "ALFRED is ready :)" console output. Here are my screens. To clarify: I want to use the nice frontend feature, not the RockFrontend popup, which is shown in the screens as well. Frontend editing, ALFRED shows ready Frontend editing with frontenduser, ALFRED is not ready, jQuery modules are missing (I suppose from PW backend) Installed modules Here a screen of the frontend editing, when ALFRED is ready:
  12. I'm trying to check it out on a clean installation @bernhard, but unfortunately the linked documentation from the module is not available anymore: https://www.baumrock.com/modules/rockfrontend/docs Maybe you can restore it?
  13. It is working now for admin on frontend as well as for editors with granted access. But for any reason for the admin is showing in modal view, for editor it is opening the PW backend. Is there a way to configure this behaviour ?
  14. Hi, I'm just starting trying to use Alfred, it looks like, as it is the only way to provide frontend editing using the HTML markup of the fields from backend. Right now it is working as logged in with admin, but it should work also for editors on frontend. I hope to have it ready soon. Since it is not working on frontend with editor permissions, I'll just post here my problems: In console of the browser there is the log console.log("Loading jQuery..."); jQuery not found The access / Role is already granted to "rockfrontend-alfred". By the way, it is fantastic, that alfred is so flexible and can be limited to specific fields of a template!!!
×
×
  • Create New...