Jump to content

jon9china

Members
  • Posts

    43
  • Joined

  • Last visited

Posts posted by jon9china

  1. Sorry for missing the reply, adrian. Yeah, in fact I am using the latest version of Processwire. Just installed it earlier this year for this new site.  Hmm. surprised that didn't recreate the error.  Not sure my description is accurate, then, in light of that fact. Nevertheless, my changing that field from taking a page where template=user, to just a text field did solve the issue and haven't had any surprises from the module since. At least this I can say.

  2. If that is confusing, then it might be simpler to just say the following:

    to recreate the error, create a template with a field of type page that accepts template=user. (you could name the field 'master_of_this_branch')

    create a page with that template and select a test user as 'master_of_this_branch'

    in the test user's profile, restrict him to a branch using that page as its root.

    reference that field ('master_of_this_branch') in a page in the test user's tree and signed in as that test user, navigate to that page and should produce the infinite loop.

  3. ok, here it goes.  Here is the offending code block after being changed:

    //do we find that a user field for teacher root page matches the logged in user's data?

    $isTeacherPage=0;

    $loggedInUsername=$users->getCurrentUser()->name;

    foreach($myTeacherRootPages as $thisTeacherPage){

        $herUserName = $thisTeacherPage->teacher_user_name;
        if($herUserName==$loggedInUsername) {
                 $thisTeacherId = $thisTeacherPage->id; //found a teacher match; this guyz'a teacher
                 $isTeacherPage = 1;
        }
    }

    the 'teacher_user_name' is a text field. Formerly, what was causing the error, was when this field was a page field that contained pages of template=user. (And on the appropriate page in that field, the restricted user would be selected to indicate that this was her branch) When the user who reaches this page on the frontend is a user who has been restricted to this branch of the tree, which also contains this page, then the page caused the error.

    The template for these $myTeacherRootPages formerly contained a field of type Page, called 'user_profile'  where template=user

    With the above code, where problem was solved, in the template, this field was deleted and replaced with a text field 'teacher_user_name' whose value is hardcoded to match the 'name' field of the desired user's user page.

    If, incidentally, the user's restricted branch did not contain this page, then this user being logged in and opening this page did not cause an error.

    the code formerly was something like this:

    $loggedInUsername=$users->getCurrentUser()
     
    foreach($myTeacherRootPages as $thisTeacherPage){
        $herUserProfile = $thisTeacherPage->teacher_profile
        if($herUserProfile==$loggedInUser) {
                 $thisTeacherId = $thisTeacherPage->id; //found a teacher match; this guyz'a teacher
                 $isTeacherPage = 1;
        }
    }
     
    It seemed on any page where I referenced the 'teacher_profile' field in the template, like above, when the restricted user was the one opening that page, then produced the error/infinite loop.
  4. Looks like I solved the problem. Your mention of an infinite loop got me looking out for a potential cause. I had a field of type Page Reference that selected from user pages. When I used that field in selectors - those are the pages that caused the error. They were looking for the page that identified the restricted user that was logged in - if that makes any sense.

    So hope this description is helpful for understanding the problem. I just modified that field instead of choosing a page with template user, I use a field for email. Not the best solution for me for now, because the user could change their email and then my code will miss the match with that user, but does clean up the code so that I can use the module without having that fatal error.

    Thanks!

  5. This module can really be a lifesaver for me if I can use it. But unfortunately I am getting this error on certain pages when i have it installed and am using the  user restricted branch setting (when i uninstall the module, errors go away):

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /home/u985981598/domains/clozewizard.com/public_html/wire/core/Wire.php on line 1160

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

     

  6. I am creating a tutor/student management system where i give processwire’s backend access by roles to tutors and allow them to info such as concerning payments on pages. But I want to be able to keep data like that non-viewable by other ‘tutors’.  Is this possible?  ‘View’ rights for all things are automatically granted for all roles. Is there a way to, for example, keep child pages of certain pages viewable only by super user and the author?

  7. I want to return a repeater object in my pages by matching the value of a field within the repeater.  In docs, it says repeater can be treated like a page, but what does that mean for this sort of case?

    for example, my repeater might be named:  'word_object', which includes fields 'this_word', 'definition', etc.

    and i want to return a word_object where the field 'this_word' == 'apple'

  8.  Thanks for reply, szabesz.  Here's what I find in the php.error.log, which doesn't sound like a fatal sort:

    PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; Wire has a deprecated constructor in /Applications/MAMP/htdocs/wire/core/Wire.php on line 47
     

    No errors in the other two logs. but comes up on MAMP website page: 500 Internal Server error

    Suggestions?

  9. Back to this thread again...I still haven't gotten a setup working.  I've tried installing MAMP on my Mac mini but am getting server error there, too.  I modified the config.php file in the site folder:

    $config->dbHost = 'localhost';
    $config->dbName = 'name_of_my_db';
    $config->dbUser = 'root';
    $config->dbPass = 'root';
    $config->dbPort = '3306';

    and copied wire and site folders to the htdocs folder in the MAMP application folder, along with index.php and htaccess files, and imported the database.

    If anyone knows what part of the recipe I'm missing, I'd appreciate the kind help!

  10. ​Not sure what's the problem. I really appreciate the help. But still getting the 500 server error.

    Permissions seem to be right on folders and files. Also checked the dev site against the operational one, and files and folders match accordingly (0755 and 0644)

    Fortunately not an urgent problem for me right now.

  11. Seems I've missed something. Getting a 500 internal server error.  Copied folders and files as described, and used phpadmin to export my database and then created a new db and imported the exported one. Modified the site/config.php file to point to it (tried pointing to original database, too), but getting the internal server error.

    Are there some permissions that need modifying?

    also I see something in the config file:

    $config->httpHosts = array('www.mysite.com', 'mysite.com'); 

    should this be modified to specify the subdomain?  (though I did try it and it did not fix my internal server error)

  12. I currently test changes to my javascript and templates by setting up some 'dummy' pages and 'dummy templates', and uploading everything to the server.

    Is there a way to replicate my site on my local machine, so I can do away with keeping track of versions of my templates and other complexities?

    I will be working on a Mac.

    The easier the solution, the better, as I am not well versed with back-end technologies at all!

    Thanks!

×
×
  • Create New...