We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25551 ☆ A M B ☆
    • 1,231 Posts
    I’m getting an error when I use the &type=`users` parameter.

    Error: Invalid argument supplied for foreach()
    Error type/ Nr.: Warning - 2
    File: /home/site/public_html/assets/snippets/webloginpe/webloginpe.class.php
    Line: 1174
    Line 1174 source: foreach ($theUser as $attribute => $value)

    I checked the usernames and none have foreign characters and I checked the database in case and nothing seems wrong there.

    What could this be? I’m using the latest modified version 1.3.1
      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
      AugmentBLU - MODX Partner

      BLUcart - MODX Revolution E-Commerce & Shopping Cart
      • 6038
      • 228 Posts
      I’m having the same issue at the minute, and struggling to work out what the problem is...
      Im using the same version (1.3.1) of WebLoginPE on Modx 0.9.6.1.p2
      The page has been working for me ok, but somewhere along the way it stopped working - perhaps because of some customisation elsewhere or change to the database I suspect

      Did you manager to resolve the issue at your end?
        • 27442
        • 103 Posts
        Can you post the snippet call?
          • 6038
          • 228 Posts
          snippet call:
          [!WebLoginPE? &type=`users` &usersList=`List of All Members:default:member_privateuser:fullname:ASC:` &viewProfileTpl=`member_privateprofile` !] 
          


          member_privateuser chunk:
          [+wlpe.message+]
          <div class="wlpeUserPage">
          	<p class="wlpeUserPageUsername"><a href = "[~[*id*]~]?service=viewprofile&username=[+view.username+]">[+view.fullname+]</a></p>
          	<p>Phone: [+view.phone+]</p>
          	<p>Email: [+view.email+]</p>
          </div>
          


          member_privateprofile chunk:
          [+wlpe.message+]
          <table id="wlpeViewProfileTable">
          	<tr>
          		<td colspan=2 class="wlpeViewProfileHeader"><h3><strong>[+view.fullname+]</strong></h3></td>
          	</tr>
          	<tr class="wlpeUserPageMainDetail">
          		<th scope="row">Phone:</th>
          		<td>[+view.phone+]</td>
          	</tr>
          	<tr class="wlpeUserPageMainDetail">
          		<th scope="row">Mobile:</th>
          		<td>[+view.mobile+]</td>
          	</tr>
          	<tr class="wlpeUserPageMainDetail">
          		<th scope="row">Email:</th>
          		<td>[+view.email+]</td>
          	</tr>
          	<tr>
          		<th scope="row">Fax:</th>
          		<td>[+view.fax+]</td>
          	</tr>
          	<tr>
          		<th scope="row">Suburb:</th>
          		<td>[+view.suburb+]</td>
          	</tr>
          	<tr>
          		<th scope="row">Postcode:</th>
          		<td>[+view.postcode+]</td>
          	</tr>
          	<tr>
          		<th scope="row">Web Username:</th>
          		<td>[+view.username+]</td>
          	</tr>
          	<tr class="wlpeUserPageAttrLastLogin">
          		<th scope="row">Last Login</th>
          		<td>[+view.thislogin+]</td>
          	</tr>
          	<tr class="wlpeUserPageAttrComment">
          		<th scope="row">Comment:</th>
          		<td>[+view.comment+]</td>
          	</tr>
          </table>
          
          <h3>[+view.fullname+]'s Businesses</h3>
          
          
          [[get_member_businesses? &user=`[+view.id+]` ]]
          
          <form name="wlpeViewContactForm" id="wlpeViewContactForm" method="post" action="[~[*id*]~]">
          	<fieldset id="wlpeViewContactFormFieldset">
          		<h4>Contact [+view.fullname+]</h4>
          
          		<div>
          			<label for="wlpeViewContactSubject" id="wlpeViewContactSubjectLabel">Subject:
          				<input type="text" id="wlpeViewContactSubject" name="subject" />
          			</label>
          		</div>
          		<div>
          			<label for="wlpeViewContactMessage" id="wlpeViewContactMessageLabel">Message:
          				<textarea id="wlpeViewContactMessage" name="message"></textarea>
          			</label>
          		</div>
          
          		<div id="wlpeViewContactButtons">
          			<button type="submit" id="wlpeContactSend" name="service" value="messageuser">Send Message to [+view.fullname+]</button>
          		</div>
          
          	</fieldset>
          </form>
          

            • 27442
            • 103 Posts
            Everything looks OK to me (assuming that custom fields & input handlers are ok). One thought that comes to mind is: does anything different happen if you call snippet get_member_businesses uncached in your member_privateprofile chunk?
              • 6038
              • 228 Posts
              good call with the trying the snippet call uncached - I have had experience where calling a parent snippet uncached meant you need to call the child snippet cached or vice versa - i think this was when working with ditto actually...
              Nevertheless, the full profile snippet that this is called in is not used in the overview page, and I did try changing it just for the sake of it but it made no difference. I even tried calling the snippet bare eg
              [tt][[WebLoginPE? type=`users` ]][/tt]
              so it used all default settings, but i’m still getting the parse error
              Sigh....back to the drawing board...
                • 6038
                • 228 Posts
                i fixed the problem, but im not exactly sure what the problem was but i have a feeling it was some weird character in my database tables that i had imported. Because the page had been working previously and I had not changed it, i felt that something that had been added to the db table might be causing the error, and heres how i tested and resolved that:
                - i duplicated the db tables ’web_user_attributes’ and ’web_users’, to have a backup of my existing data
                - i removed all but the first 5 rows from both tables (leaving a few users and their attributes from an initial set up)
                - i check the ’all users’ page i had set up, and it now worked.
                - i copied the data from the just deleted rows from the backup into the original tables
                - i checked the ’all users’ page again. and rather unexpectedly, it worked.....
                I can only imagine that either the database table was corrupt, or a character was dodgy from a user import that i had done, and was ’fixed’ by moving the data around.... i don’t really know... but now im happy anyway! would be nice to know why though...