I want to make changes to the ultimate member plugin template file.
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?
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.
3
Answers
Try
or
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 …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 lineto this
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.
The debugger will engage right before the
_.each
loop and let you examine your variables, likedata
.Notice that my suggestions are not debugged, and I have no way to debug them.
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:
Line number 329 has an ajax call which further has an answer variable that probably contains the object you need.
Please note that editing a plugin is not suggested. So, you can do it locally for testing purposes.