Jump to content

Lance O.

Members
  • Posts

    371
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Lance O.

  1. I have a custom login page where a user should be directed to a members only page when the form is submitted and the user has been validated. What is wrong with my logic in the code below? Regardless of the user's role, the user is never authenticated and displays as a guest.

    if ( $input->post->user || $input->post->pass ) {
        // user submitted the login form
    
        if ( $session->login($input->post->user, $input->post->pass) ) {
            // user was authenticated and logged in
            // user has "admin" or "superuser" role
    		foreach ($user->roles as $role) {
    			$content .= $role->name . "<br/>";
    		}
        } else {
            // user is not authenticated
            // user is "guest"
    		foreach ($user->roles as $role) {
    			$content .= $role->name . "<br/>";
    		}
        }
    
    } elseif ( $input->get->logout ) {
        // page was accessed with ?logout=1 GET variable, so log them out
        $session->logout();
        $content = $form;
    
    } else {
        // user arrived at login page for first time
        $content = $form;
    }

     

  2. My client has a need to create a new PW admin user and assign permissions that restrict access to only one assigned page of the site on the frontend.

    Each user only has access to the single page that is assigned to them. Example:

    User #1 -> Page #1 -> Access
    User #1 -> Page #2 -> No Access
    User #1 -> Page #3 -> No Access

    User #2 -> Page #1 -> No Access
    User #2 -> Page #2 -> Access
    User #2 -> Page #3 -> No Access

    User #3 -> Page #1 -> No Access
    User #3 -> Page #2 -> No Access
    User #3 -> Page #3 -> Access
    etc.

    There may be 100 different users that all need access to just their page. Without having to create 100 templates and manage access through the template, what is currently considered the best method for restricting page access? All of these pages should use the same template.

  3. This issue may have been answered earlier, but I'd like a little clarification if possible.

    The site I am developing has one section that is translated into French Canadian. Only the pages in this section are translated. The site's Home page is only in English, which is the default language. The English name setting on the Home page is blank, and the French name setting is "fr".

    All of the pages in the translated section have the Active? checkbox next to the French name on the Settings tab checked. No other pages have this option checked, including the Home page.

    URL examples:
    http://domain.com/drainage-pipe-products/
    http://domain.com/fr/drainage-pipe-products/

    When viewing the http://domain.com/fr/drainage-pipe-products/ page, links included in the page's navigation automatically include the /fr/ in the url, even though those pages don't explicitly have the Active? checkbox selected. That's not the behavior I was expecting.

    Is this normal behavior? If this is normal behavior, then what is the purpose of the Active? checkbox? Have I configured something incorrectly? Any insight is appreciated. I feel like there is something I'm missing.

  4. I've checked the forums for an answer that works, but I can't seem to find one. Sorry for having to post this question.

    Upon dragging and dropping an image into a file field in the PW admin, I receive a "Filesize 11594 kb is too big. Maximum allowed is 8192 kb." error. I've updated the PHP ini settings to the following, yet I'm still receiving the error:

    file_uploads = On
    max_execution_time = 120
    max_input_time = 120
    max_input_vars = 1000
    memory_limit = 512M
    upload_max_filesize = 50M


    I'm using PW 3.0.33. What am I overlooking? Is there a PW config setting that I need to set?

     

     

  5. I should have mentioned that I already have those two lines commented out before I posted my question. But now that I check the sitemap.xml file again, the "www" has been added to the urls. Looks like it may have just been a caching issue. Thanks for your insight!

  6. I know this question has been asked before, but in this case, I don't want to use a PW module.

    I have added redirects at the very top of my .htaccess file, formatted like the examples below:

    RedirectMatch 301 /onsite2/ http://domain.com/
    Redirect 301 /onsitefocusedthanks/ http://domain.com/club/

    Unfortunately, the redirects are going to:

    http://www.domain.com/onsite/ (404 page not found)
    http://www.domain.com/club/?it=onsitefocusedthanks/

    Is there a way to removed the "?it=index.html" and prevent these redirect errors?

  7. Selections aren't being retained or are being automatically selected/deselected in the "Template Types" area under the "Details" tab. If I make multiple edits to these checkboxes and save the page after each edit, the module is confused about my settings and messes up what I selected. :-(

  8. I upgraded from PW 3.0.15 to PW 3.0.17 and the alt attribute still didn't work. Frustrated, I then downgraded to PW 2.7.2 and it still doesn't work. :-(

    At some point I had the ImageExtra fieldtype module installed, but it has since been removed. Is there the possibility that it broke something? I've already had problems with uploading images that required some manipulation of the database structure. https://processwire.com/talk/topic/13078-error-when-uploading-image-field-caption-doesnt-have-a-default-value/

    Here is the field export for the Body field, if that helps:

    {    "body": {
            "id": 98,
            "type": "FieldtypeTextarea",
            "flags": 0,
            "name": "body",
            "label": "Body",
            "qtyMin": 1,
            "qtyMax": 10,
            "trashable": 1,
            "size": 0,
            "maxlength": 2048,
            "inputfieldConfigNames": "rows,toolbar,inlineMode,useACF,usePurifier,toggles,formatTags,extraAllowedContent,contentsCss,contentsInlineCss,stylesSet,extraPlugins,plugin_sourcedialog,removePlugins",
            "schemaClass": "FieldtypeTextarea",
            "inputfieldClass": "InputfieldCKEditor",
            "contentType": 2,
            "pageLinkAbstractor": 2,
            "rows": 9,
            "toolbar": "Format, Styles, -, Bold, Italic, -, RemoveFormat\nNumberedList, BulletedList, -, Blockquote\nPWLink, Unlink, Anchor\nPWImage, Table, HorizontalRule, SpecialChar\nJustifyLeft, JustifyCenter, JustifyRight, JustifyBlock\nPasteText, PasteFromWord\nScayt, -, Sourcedialog",
            "inlineMode": 0,
            "useACF": 1,
            "usePurifier": 1,
            "formatTags": "p;h1;h2;h3;h4;h5;h6;pre;address",
            "removePlugins": "image,magicline",
            "sortable": 1,
            "collapsed": 2,
            "extraPlugins": [
                "pwimage",
                "pwlink",
                "sourcedialog"
            ],
            "textformatters": [
                "TextformatterVideoEmbed",
                "TextformatterHannaCode"
            ],
            "contentsCss": "/site/modules/InputfieldCKEditor/contents.css",
            "extraAllowedContent": "div(*)\n*[id](*)\n*[class](*)",
            "icon": "code",
            "notes": "Enter a full YouTube or Vimeo URL by itself in any paragraph and it will automatically convert it to an embedded video.\n\nYour link must match one of the formats below:\nhttp://www.youtube.com/watch?v=**video_id**\nhttps://vimeo.com/**video_id**\n\nExamples:\nhttp://www.youtube.com/watch?v=Wl4XiYadV_k\nhttps://vimeo.com/152189763",
            "htmlOptions": [
                4
            ],
            "showIf": "",
            "columnWidth": 100,
            "required": "",
            "requiredIf": "",
            "toggles": "",
            "contentsInlineCss": "",
            "stylesSet": "",
            "customOptions": "",
            "plugin_sourcedialog": ""
        }
    }
  9. @tpr I'm using PW 3.0.15 and that option is labeled as:

    Update image alt attributes: Replace blank alt attributes with image description

    With this option checked on the Body CKEditor field, I uploaded an image, entered a description, and inserted it into the Body field. The alt attribute remains empty. Perhaps something broke between the two versions we are using?

    @szabesz Looks like that page references an earlier version of PW. Hopefully this will all be updated in a future version of PW.

×
×
  • Create New...