I'm basically trying to set up the inbox so I can have the message subject and under that a teaser view of the message body. However I can't seem to print the message body. I made a module to make use of hook_privatemsg_sql_list_alter but it doesn't seem to take. I also tried using the same method in my template.php file. Am I doing something wrong? I looked around and haven't found much documentation with examples.
Heres what's in my module file. The module name is fp_privatemsg
function fp_privatemsg_privatemsg_sql_list_alter(&$fragment, $account) {
$fragments['select'][]= "pm.body";
}
Comments
Comment #1
naheemsays commentedWhat is the custom module called? if it is fp_privatemsg, the function name above is correct. if it is called fp only, then try
instead.
After that, you will also need to use the theme functions to show the teaser - by default the module will NOT show extra fields.
Comment #2
walker2238 commentedWow talk about fast support...
The module is indeed fp_privatemsg
And I should also note that I tried to print is using $thread['body'] which I printed in function fp_privatemsg_list_field__participants($thread), fp being my theme.
This works fine if I hack the module but adding $fragments['select'][]= "pm.body"; into function privatemsg_sql_list(&$fragments, $account, $argument = 'list')
Comment #3
naheemsays commentedalso, you are using both &$fragment and $fragments - is that the case is the code too? if so, change one to the other (I am talking about the "s" at the end)
Comment #4
walker2238 commentedUm, you lost me on that one, I don't understand.
Comment #5
naheemsays commentedthere is a missing "s" at the end in one of them.
Comment #6
walker2238 commentedThat odd... your right. It works fine after I changed fp_privatemsg_privatemsg_sql_list_alter(&$fragment, $account, $argument) to fp_privatemsg_privatemsg_sql_list_alter(&$fragments, $account, $argument)...
Maybe I don't understand how this works but when I was looking at the documentation the funtion is listed as...
soure: http://blog.worldempire.ch/api/function/hook_privatemsg_sql_list_alter/1
Comment #7
walker2238 commentedI understand that my issue was me not examining the code well... but whats the difference between $fragments and $fragment?
Comment #8
naheemsays commentedyou can use whatever name you like as long as it is consistent throughout. if you use $fragment in the function name, you have to use $fragment throughout. If however you append the s in the function name, it should also be appended throughout.
You can even call it $random_arg all the way through - it is the positioning (and consistency) that matters.
The docs probably need to be fixed to be more consistent.
Comment #9
walker2238 commentedOk sorry I'm trying to work while doing this so I'm not processing the information. I understand that the variables have to match, just didn't understand why theres two variables that do the same thing. I do agree that the documents are well... under documented. But it's free so I can't really complain.
Thanks so much for your quick replies. I'd say lets trade brains but I already know the answer to that.
Cheers!
Comment #10
naheemsays commented:)
There aren't - just the one, but the documentation seems to miss the s that breaks consistency.