skip to Main Content

I want to make changes to the ultimate member plugin template file.
enter image description here

Now I want to check the details that are inside the user object but I don’t know how to print or var dump the user object
can anyone help me with that, please?

Thanx in advance 🙂

3

Answers


  1. Try

    <?php var_dump(obj) ?>
    

    or

    <?php print_r(obj) ?>
    
    Login or Signup to reply.
  2. The code you showed us is part of a template object embedded in the HTML your server sends to your user’s browser. This object gets interpreted by some Javascript code your server also sends.

    Debugging this stuff is tricky because various languages are embedded in each other. In your case you want to see the data variable. It is in …

    • Javascript,
    • embedded in a template object,
    • interpreted by other Javascript,
    • embedded in HTML,
    • embedded in php.

    To debug it you first have to guess what is embedded in what. And you need a bit of luck to guess correctly. I am guessing.

    The template itself can contain Javascript code, and you’re asking about the value of data in that Javascript code. So, if you want to see that data you can put a Javascript console.log() call into the template for debugging purposes. To do that, change this line

    <# _.each( data, function( user, key, list ) { #>
    

    to this

    <# console.log('data from member grid', data ); _.each( data, function( user, key, list ) { #>
    

    The output from console.log appears in the console tab of your browser’s devtools: it’s generated by the browser not your WordPress / php server.

    You could, if you want to use your browser devtools Javascript debugger, use this line instead.

    <# debugger; _.each( data, function( user, key, list ) { #>
    

    The debugger will engage right before the _.each loop and let you examine your variables, like data.

    Notice that my suggestions are not debugged, and I have no way to debug them.

    Login or Signup to reply.
  3. The code shows that it’s a member grid template of Ultimate member plugin.

    You can check the ajax call output in the following file:

    ultimate-member/assets/js/um-member.js 
    

    Line number 329 has an ajax call which further has an answer variable that probably contains the object you need.

    ultimate-member-grid

    Please note that editing a plugin is not suggested. So, you can do it locally for testing purposes.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search